Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-01-25 15:38:24 -0500
committermkersten2006-01-25 15:38:24 -0500
commit801c8826f3256cafc4464308ba6d4b6d54edc2f4 (patch)
tree911bca5c1abc489e473bc8cabafc7639c6e186a0
parent151ef1700bb44b03aa40144531ac228956f6f941 (diff)
downloadorg.eclipse.mylyn.tasks-801c8826f3256cafc4464308ba6d4b6d54edc2f4.tar.gz
org.eclipse.mylyn.tasks-801c8826f3256cafc4464308ba6d4b6d54edc2f4.tar.xz
org.eclipse.mylyn.tasks-801c8826f3256cafc4464308ba6d4b6d54edc2f4.zip
Completed: Bug 125095: make task/report editor extensible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=125095
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPreferencePage.java15
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java79
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java285
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/schema/providers.exsd10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java45
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListPreferenceConstants.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java18
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java65
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepositoryClient.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java)49
26 files changed, 187 insertions, 544 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPreferencePage.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPreferencePage.java
index 116eb3842..16cbd970b 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPreferencePage.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaPreferencePage.java
@@ -15,7 +15,6 @@ import java.net.URL;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
@@ -38,8 +37,6 @@ public class BugzillaPreferencePage extends FieldEditorPreferencePage implements
private IntegerFieldEditor maxResults;
- private BooleanFieldEditor refreshQueries;
-
/**
* Constructor for the preferences page
*/
@@ -84,13 +81,13 @@ public class BugzillaPreferencePage extends FieldEditorPreferencePage implements
new String[][] { { IBugzillaConstants.SERVER_220, IBugzillaConstants.SERVER_VERSION },
{ IBugzillaConstants.SERVER_218, IBugzillaConstants.SERVER_VERSION },
{ IBugzillaConstants.SERVER_216, IBugzillaConstants.SERVER_VERSION } }, getFieldEditorParent());
- refreshQueries = new BooleanFieldEditor(IBugzillaConstants.REFRESH_QUERY,
- "Automatically refresh Bugzilla reports and queries on startup", BooleanFieldEditor.DEFAULT,
- getFieldEditorParent());
+// refreshQueries = new BooleanFieldEditor(IBugzillaConstants.REFRESH_QUERY,
+// "Automatically refresh Bugzilla reports and queries on startup", BooleanFieldEditor.DEFAULT,
+// getFieldEditorParent());
addField(maxResults);
addField(bugzillaVersionEditor);
- addField(refreshQueries);
+// addField(refreshQueries);
}
public static void initDefaults(IPreferenceStore store) {
@@ -117,8 +114,8 @@ public class BugzillaPreferencePage extends FieldEditorPreferencePage implements
}
}
- BugzillaPlugin.getDefault().getPreferenceStore().setValue(IBugzillaConstants.REFRESH_QUERY,
- refreshQueries.getBooleanValue());
+// BugzillaPlugin.getDefault().getPreferenceStore().setValue(IBugzillaConstants.REFRESH_QUERY,
+// refreshQueries.getBooleanValue());
try {
int numMaxResults = maxResults.getIntValue();
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 1aab21a25..0cdd82f13 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -4,11 +4,9 @@
<plugin>
<extension point="org.eclipse.mylar.tasklist.providers">
- <taskHandler
- taskHandlerClass="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskHandler"
+ <taskHandler
externalizerClass="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskExternalizer"
- id="org.eclipse.mylar.bugzilla.ui.tasklist"
- >
+ id="org.eclipse.mylar.bugzilla.ui.tasklist">
</taskHandler>
</extension>
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
index 89b169605..8af89bc7b 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
@@ -37,7 +37,7 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.IQueryHit;
import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.graphics.Font;
@@ -115,8 +115,8 @@ public class BugzillaQueryCategory implements IRepositoryQuery {
}
public void addHit(IQueryHit hit) {
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
- ITask correspondingTask = client.getFromBugzillaTaskRegistry(
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ ITask correspondingTask = client.getTaskFromArchive(
hit.getHandleIdentifier());
hit.setCorrespondingTask(correspondingTask);
hits.add(hit);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java
index 43ee2be3a..3e7430e3c 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java
@@ -18,7 +18,7 @@ import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.tasklist.IQueryHit;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -127,7 +127,7 @@ public class BugzillaQueryHit implements IQueryHit {
public ITask getOrCreateCorrespondingTask() {
if (task == null) {
task = new BugzillaTask(this, true);
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
client.addTaskToArchive(task);
// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskArchive(task);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java
index 5771bc83e..372838380 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java
@@ -11,28 +11,24 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositorySettingsPage;
import org.eclipse.mylar.internal.bugzilla.core.IOfflineBugListener;
+import org.eclipse.mylar.internal.bugzilla.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.internal.bugzilla.ui.actions.SynchronizeReportsAction;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask.BugReportSyncState;
-import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractAddExistingTaskWizard;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.mylar.internal.tasklist.ui.wizards.ExistingTaskWizardPage;
import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.widgets.Display;
@@ -40,15 +36,14 @@ import org.eclipse.swt.widgets.Display;
/**
* @author Mik Kersten
*/
-public class BugzillaRepositoryClient implements ITaskRepositoryClient, IOfflineBugListener {
+public class BugzillaRepositoryClient extends TaskRepositoryClient implements IOfflineBugListener {
- private static final String LABEL = "Bugzilla (supports uncustomized 2.16-2.20)";
+ private static final String DESCRIPTION_DEFAULT = "<needs synchronize>";
- private Map<String, BugzillaTask> bugzillaTaskArchive = new HashMap<String, BugzillaTask>();
+ private static final String LABEL = "Bugzilla (supports uncustomized 2.16-2.20)";
- private TaskCategory archiveCategory = null;
-
public BugzillaRepositoryClient() {
+ super();
// TODO: remove on dispose?
BugzillaPlugin.getDefault().addOfflineStatusListener(this);
}
@@ -69,43 +64,12 @@ public class BugzillaRepositoryClient implements ITaskRepositoryClient, IOffline
return BugzillaPlugin.REPOSITORY_KIND;
}
- public void addTaskToArchive(ITask newTask) {
- if (newTask instanceof BugzillaTask
- && !bugzillaTaskArchive.containsKey(newTask.getHandleIdentifier())) {
- bugzillaTaskArchive.put(newTask.getHandleIdentifier(), (BugzillaTask)newTask);
- if (archiveCategory != null) {
- archiveCategory.internalAddTask(newTask);
- }
- }
- }
-
-// ITask taskToAdd = getFromBugzillaTaskRegistry(newTask.getHandleIdentifier());
-// BugzillaTask bugTask = BugzillaUiPlugin.getDefault().getBugzillaTaskListManager()
-// .getFromBugzillaTaskRegistry(newTask.getHandleIdentifier());
-
-// if (retrievedTask instanceof BugzillaTask) {
-// if (bugzillaTaskArchive.get(newTask.getHandleIdentifier()) == null) {
-
-// }
-// retrievedTask = (BugzillaTask) newTask;
-// }
-// }
-// }
-
- public ITask getFromBugzillaTaskRegistry(String handle) {
- return bugzillaTaskArchive.get(handle);
- }
-
- public List<ITask> getArchiveTasks() {
- List<ITask> archiveTasks = new ArrayList<ITask>();
- archiveTasks.addAll(bugzillaTaskArchive.values());
- return archiveTasks;
- }
-
- public void setArchiveCategory(TaskCategory category) {
- this.archiveCategory = category;
+ public void synchronize() {
+ RefreshBugzillaReportsAction refresh = new RefreshBugzillaReportsAction();
+ refresh.setShowProgress(false);
+ refresh.run();
+ refresh.setShowProgress(true);
}
-
public ITask createTaskFromExistingId(TaskRepository repository, String id) {
int bugId = -1;
@@ -116,30 +80,15 @@ public class BugzillaRepositoryClient implements ITaskRepositoryClient, IOffline
return null;
}
} catch (NumberFormatException nfe) {
- TaskListView.getDefault().showMessage("Invalid report id.");
+ MessageDialog.openInformation(null, MylarTaskListPlugin.TITLE_DIALOG, "Invalid report id: " + id);
return null;
}
BugzillaTask newTask = new BugzillaTask(TaskRepositoryManager.getHandle(repository.getUrl().toExternalForm(), bugId),
- "<bugzilla info>", true, true);
+ DESCRIPTION_DEFAULT, true, true);
- // ITaskHandler taskHandler =
- // MylarTaskListPlugin.getDefault().getHandlerForElement(newTask);
- // if (taskHandler != null) {
addTaskToArchive(newTask);
newTask.scheduleDownloadReport();
-// if (addedTask instanceof BugzillaTask) {
-// BugzillaTask newTask2 = (BugzillaTask) addedTask;
-// if (newTask2 == newTask) {
-// ((BugzillaTask) newTask).scheduleDownloadReport();
-// } else {
-// newTask = newTask2;
-// ((BugzillaTask) newTask).updateTaskDetails();
-// }
-// // }
-// } else {
-// ((BugzillaTask) newTask).scheduleDownloadReport();
-// }
return newTask;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
index ae0dc4131..e032e0c88 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
@@ -26,7 +26,7 @@ import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskCategory;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -73,7 +73,7 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
private static final String TAG_TASK = "BugzillaReport";
- private ITaskRepositoryClient repositoryClient;
+ private TaskRepositoryClient repositoryClient;
public BugzillaTaskExternalizer() {
repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
@@ -93,7 +93,7 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
parent.appendChild(node);
}
- public ITaskRepositoryClient getRepositoryClient() {
+ public TaskRepositoryClient getRepositoryClient() {
return repositoryClient;
}
@@ -271,7 +271,7 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
}
}
- ITaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ TaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
if (repositoryClient != null) {
repositoryClient.addTaskToArchive(task);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java
deleted file mode 100644
index e76be7147..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 University Of British Columbia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.actions.RefreshBugzillaReportsAction;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
-import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
-import org.eclipse.mylar.internal.tasklist.ui.actions.CopyDescriptionAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.DeleteAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.GoIntoAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskInExternalBrowserAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskListElementAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.RemoveFromCategoryAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.RenameAction;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
-import org.eclipse.mylar.tasklist.ITask;
-
-/**
- * @author Mik Kersten and Ken Sueda
- *
- * TODO: refactor
- */
-public class BugzillaTaskHandler implements ITaskHandler {
-
- public boolean acceptsItem(ITaskListElement element) {
- return element instanceof BugzillaTask || element instanceof BugzillaQueryHit
- || element instanceof BugzillaQueryCategory;
- }
-
-// public void taskClosed(ITask element, IWorkbenchPage page) {
-// try {
-// IEditorInput input = null;
-// if (element instanceof BugzillaTask) {
-// input = new BugzillaTaskEditorInput((BugzillaTask) element, true);
-// }
-// IEditorPart editor = page.findEditor(input);
-//
-// if (editor != null) {
-// page.closeEditor(editor, false);
-// }
-// } catch (Exception e) {
-// MylarStatusHandler.log(e, "Error while trying to close a bugzilla task");
-// }
-// }
-
- public void restoreState(TaskListView taskListView) {
- if (BugzillaPlugin.getDefault().refreshOnStartUpEnabled()) {
- RefreshBugzillaReportsAction refresh = new RefreshBugzillaReportsAction();
- refresh.setShowProgress(false);
- refresh.run();
- refresh.setShowProgress(true);
- }
- }
-
- public boolean enableAction(Action action, ITaskListElement element) {
-
- if (element instanceof BugzillaQueryHit) {
- BugzillaQueryHit hit = (BugzillaQueryHit) element;
- if (hit.getCorrespondingTask() != null && hit.getCorrespondingTask().hasValidUrl()) {
- return true;
- }
- return false;
- } else if (element instanceof BugzillaTask) {
- if (action instanceof OpenTaskInExternalBrowserAction) {
- if (((ITask) element).hasValidUrl()) {
- return true;
- } else {
- return false;
- }
- } else if (action instanceof DeleteAction || action instanceof CopyDescriptionAction
- || action instanceof OpenTaskListElementAction || action instanceof RemoveFromCategoryAction) {
- return true;
- } else {
- return false;
- }
- } else if (element instanceof BugzillaQueryCategory) {
- if (action instanceof DeleteAction || action instanceof CopyDescriptionAction
- || action instanceof OpenTaskListElementAction || action instanceof RenameAction) {
- return true;
- } else if (action instanceof GoIntoAction) {
- BugzillaQueryCategory cat = (BugzillaQueryCategory) element;
- if (cat.getHits().size() > 0) {
- return true;
- }
- } else {
- return false;
- }
- }
- return false;
- }
-
-}
-
-//public void itemOpened(ITaskListElement element) {
-//
-// boolean offline = MylarTaskListPlugin.getPrefs().getBoolean(TaskListPreferenceConstants.WORK_OFFLINE);
-//
-// if (element instanceof BugzillaTask) {
-// BugzillaTask bugzillaTask = (BugzillaTask) element;
-// TaskListUiUtil.openEditor(bugzillaTask);
-// MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
-// if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
-// bugzillaTask.openTaskInEditor(offline);
-// } else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
-// if (offline) {
-// MessageDialog.openInformation(null, "Unable to open bug",
-// "Unable to open the selected bugzilla task since you are currently offline");
-// return;
-// }
-// String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(bugzillaTask.getHandleIdentifier());
-// TaskListUiUtil.openUrl(title, title, bugzillaTask.getUrl());
-// } else {
-// // not supported
-// }
-// } else if (element instanceof BugzillaCustomQueryCategory) {
-// BugzillaCustomQueryCategory queryCategory = (BugzillaCustomQueryCategory) element;
-// BugzillaCustomQueryDialog sqd = new BugzillaCustomQueryDialog(Display.getCurrent().getActiveShell(),
-// queryCategory.getQueryUrl(), queryCategory.getDescription(), queryCategory.getMaxHits() + "");
-// if (sqd.open() == Dialog.OK) {
-// queryCategory.setDescription(sqd.getName());
-// queryCategory.setQueryUrl(sqd.getUrl());
-// int maxHits = -1;
-// try {
-// maxHits = Integer.parseInt(sqd.getMaxHits());
-// } catch (Exception e) {
-// }
-// queryCategory.setMaxHits(maxHits);
-//
-// new SynchronizeReportsAction(queryCategory).run();
-// }
-// } else if (element instanceof BugzillaQueryCategory) {
-// BugzillaQueryCategory queryCategory = (BugzillaQueryCategory) element;
-// BugzillaQueryDialog queryDialog = new BugzillaQueryDialog(Display.getCurrent().getActiveShell(),
-// queryCategory.getRepositoryUrl(), queryCategory.getQueryUrl(), queryCategory.getDescription(),
-// queryCategory.getMaxHits() + "");
-// if (queryDialog.open() == Dialog.OK) {
-// queryCategory.setDescription(queryDialog.getName());
-// queryCategory.setQueryUrl(queryDialog.getUrl());
-// queryCategory.setRepositoryUrl(queryDialog.getRepository().getUrl().toExternalForm());
-// int maxHits = -1;
-// try {
-// maxHits = Integer.parseInt(queryDialog.getMaxHits());
-// } catch (Exception e) {
-// }
-// queryCategory.setMaxHits(maxHits);
-//
-// new SynchronizeReportsAction(queryCategory).run();
-// }
-// } else if (element instanceof BugzillaQueryHit) {
-// BugzillaQueryHit hit = (BugzillaQueryHit) element;
-// MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
-// if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
-// if (hit.getCorrespondingTask() != null) {
-// hit.getCorrespondingTask().openTaskInEditor(offline);
-// } else {
-// if (offline) {
-// MessageDialog.openInformation(null, "Unable to open bug",
-// "Unable to open the selected bugzilla report since you are currently offline");
-// return;
-// }
-// BugzillaOpenStructure open = new BugzillaOpenStructure(((BugzillaQueryHit) element)
-// .getRepositoryUrl(), ((BugzillaQueryHit) element).getId(), -1);
-// List<BugzillaOpenStructure> selectedBugs = new ArrayList<BugzillaOpenStructure>();
-// selectedBugs.add(open);
-// ViewBugzillaAction viewBugs = new ViewBugzillaAction("Display bugs in editor", selectedBugs);
-// viewBugs.schedule();
-// }
-// }
-// else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
-// if (offline) {
-// MessageDialog.openInformation(null, "Unable to open bug",
-// "Unable to open the selected bugzilla report since you are currently offline");
-// return;
-// }
-// String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(hit.getHandleIdentifier());
-// TaskListUiUtil.openUrl(title, title, hit.getBugUrl());
-// } else {
-// // not supported
-// }
-// }
-// }
-
-// public ITask getCorrespondingTask(IQueryHit queryHit) {
-// if (queryHit instanceof BugzillaQueryHit) {
-// BugzillaQueryHit hit = (BugzillaQueryHit) queryHit;
-// return hit.getOrCreateCorrespondingTask();
-// } else {
-// return null;
-// }
-// }
-
-// public void itemRemoved(ITaskListElement element, ITaskCategory category) {
-// if (element instanceof BugzillaTask) {
-// BugzillaTask task = (BugzillaTask) element;
-// if (category instanceof TaskCategory) {
-// MylarTaskListPlugin.getTaskListManager().removeFromCategoryAndRoot((TaskCategory)
-// category, task);
-// // category.removeTask(task);
-// } else {
-// String message = MESSAGE_CONFIRM_DELETE;
-// boolean deleteConfirmed =
-// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-// .getShell(), "Confirm delete", message);
-// if (!deleteConfirmed)
-// return;
-// MylarTaskListPlugin.getTaskListManager().deleteTask(task);
-// }
-// }
-// }
-
-// private static final String MESSAGE_CONFIRM_DELETE = "Remove this report from
-// the task list, and discard any task context or local notes?";
-
-// public boolean deleteElement(ITaskListElement element) {
-// if (element instanceof BugzillaQueryCategory) {
-// boolean deleteConfirmed =
-// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-// .getShell(), "Confirm delete", "Delete the selected query and all contained
-// tasks?");
-// if (!deleteConfirmed)
-// return false;
-// BugzillaQueryCategory query = (BugzillaQueryCategory) element;
-// MylarTaskListPlugin.getTaskListManager().deleteQuery(query);
-// } else if (element instanceof BugzillaTask) {
-// BugzillaTask task = (BugzillaTask) element;
-// if (task.isActive()) {
-// MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-// "Delete failed",
-// "Task must be deactivated in order to delete.");
-// return false;
-// }
-//
-// // String message = task.getDeleteConfirmationMessage();
-// boolean deleteConfirmed =
-// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-// .getShell(), "Confirm delete", MESSAGE_CONFIRM_DELETE);
-// if (!deleteConfirmed)
-// return false;
-//
-// // task.removeReport();
-// MylarTaskListPlugin.getTaskListManager().deleteTask(task);
-// MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier());
-// IWorkbenchPage page =
-// MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
-// .getActivePage();
-//
-// // if we couldn't get the page, get out of here
-// if (page == null)
-// return true;
-// try {
-// TaskListView.getDefault().closeTaskEditors(task, page);
-// } catch (Exception e) {
-// MylarStatusHandler.log(e, " deletion failed");
-// }
-// }
-// TaskListView.getDefault().getViewer().refresh();
-// return true;
-// }
-
-// public void dropItem(ITaskListElement element, TaskCategory cat) {
-// if (element instanceof BugzillaQueryHit) {
-// BugzillaQueryHit bugzillaHit = (BugzillaQueryHit) element;
-// if (bugzillaHit.getAssociatedTask() != null) {
-// MylarTaskListPlugin.getTaskListManager().moveToCategory(cat,
-// bugzillaHit.getAssociatedTask());
-// } else {
-// BugzillaTask bugzillaTask = new BugzillaTask(bugzillaHit, true);
-// bugzillaHit.setAssociatedTask(bugzillaTask);
-// MylarTaskListPlugin.getTaskListManager().moveToCategory(cat,
-// bugzillaTask);
-// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry(bugzillaTask);
-// }
-// }
-// }
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
index fb42bbe07..212fb4699 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
@@ -21,7 +21,7 @@ import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
@@ -106,7 +106,7 @@ public class NewBugzillaReportWizard extends AbstractBugWizard {
selectedObject = ((IStructuredSelection) TaskListView.getDefault().getViewer().getSelection())
.getFirstElement();
- ITaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ TaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
if (repositoryClient != null) {
repositoryClient.addTaskToArchive(newTask);
}
@@ -129,7 +129,7 @@ public class NewBugzillaReportWizard extends AbstractBugWizard {
MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask);
}
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
client.addTaskToArchive(newTask);
// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskArchive((BugzillaTask) newTask);
diff --git a/org.eclipse.mylyn.tasks.ui/schema/providers.exsd b/org.eclipse.mylyn.tasks.ui/schema/providers.exsd
index 0d7259d94..9d13e9e34 100644
--- a/org.eclipse.mylyn.tasks.ui/schema/providers.exsd
+++ b/org.eclipse.mylyn.tasks.ui/schema/providers.exsd
@@ -60,16 +60,6 @@
</appInfo>
</annotation>
</attribute>
- <attribute name="taskHandlerClass" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.mylar.tasklist.ITaskHandler"/>
- </appInfo>
- </annotation>
- </attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java
index 18eea60ae..cc96096d4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java
@@ -25,7 +25,7 @@ import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskCategory;
import org.eclipse.mylar.tasklist.ITaskListExternalizer;
import org.eclipse.mylar.tasklist.IRepositoryQuery;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -104,7 +104,7 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer {
/**
* TODO: make local task externalizer use repository.
*/
- public ITaskRepositoryClient getRepositoryClient() {
+ public TaskRepositoryClient getRepositoryClient() {
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java
deleted file mode 100644
index 8a326cb80..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 University Of British Columbia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylar.internal.tasklist;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
-
-/**
- * TODO: usage should be refactored to TaskListManager
- *
- * @author Mik Kersten
- */
-public interface ITaskHandler {
-
-// public abstract void itemOpened(ITaskListElement element);
-
-// public abstract void taskClosed(ITask element, IWorkbenchPage page);
-
- public abstract boolean acceptsItem(ITaskListElement element);
-
-// public abstract ITask addTaskToArchive(ITask newTask);
-
- /**
- * This is called both before and after the tasklist is read
- */
- public abstract void restoreState(TaskListView taskListView);
-
- public abstract boolean enableAction(Action action, ITaskListElement element);
-
- // public abstract boolean deleteElement(ITaskListElement element);
-
- // public abstract void itemRemoved(ITaskListElement element, ITaskCategory
- // category);
-
- // public abstract ITask getCorrespondingTask(IQueryHit element);
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
index b162f0e60..6807c3664 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
@@ -23,7 +23,7 @@ import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
import org.eclipse.mylar.internal.tasklist.ui.IDynamicSubMenuContributor;
import org.eclipse.mylar.tasklist.ITaskListExternalizer;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
/**
@@ -91,7 +91,7 @@ public class TaskListExtensionReader {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
if (elements[j].getName().compareTo(ELMNT_TASK_HANDLER) == 0) {
- readHandlerAndExternalizer(elements[j], externalizers);
+ readExternalizer(elements[j], externalizers);
} else if (elements[j].getName().compareTo(DYNAMIC_POPUP_ELEMENT) == 0) {
readDynamicPopupContributor(elements[j]);
}
@@ -139,8 +139,8 @@ public class TaskListExtensionReader {
try {
Object type = element.getAttribute(ELMNT_TYPE);
Object repository = element.createExecutableExtension(ATTR_CLASS);
- if (repository instanceof ITaskRepositoryClient && type != null) {
- MylarTaskListPlugin.getRepositoryManager().addRepositoryClient((ITaskRepositoryClient) repository);
+ if (repository instanceof TaskRepositoryClient && type != null) {
+ MylarTaskListPlugin.getRepositoryManager().addRepositoryClient((TaskRepositoryClient) repository);
} else {
MylarStatusHandler.log("could not not load extension: " + repository, null);
}
@@ -165,7 +165,7 @@ public class TaskListExtensionReader {
}
}
- private static void readHandlerAndExternalizer(IConfigurationElement element, List<ITaskListExternalizer> externalizers) {
+ private static void readExternalizer(IConfigurationElement element, List<ITaskListExternalizer> externalizers) {
try {
Object externalizerObject = element.createExecutableExtension(ATTR_EXTERNALIZER_CLASS);
if (externalizerObject instanceof ITaskListExternalizer) {
@@ -176,13 +176,13 @@ public class TaskListExtensionReader {
+ " must implement " + ITaskListExternalizer.class.getCanonicalName(), null);
}
- Object taskHandler = element.createExecutableExtension(ATTR_ACTION_CONTRIBUTOR_CLASS);
- if (taskHandler instanceof ITaskHandler) {
- MylarTaskListPlugin.getDefault().addTaskHandler((ITaskHandler) taskHandler);
- } else {
- MylarStatusHandler.log("Could not load contributor: " + taskHandler.getClass().getCanonicalName()
- + " must implement " + ITaskHandler.class.getCanonicalName(), null);
- }
+// Object taskHandler = element.createExecutableExtension(ATTR_ACTION_CONTRIBUTOR_CLASS);
+// if (taskHandler instanceof ITaskHandler) {
+// MylarTaskListPlugin.getDefault().addTaskHandler((ITaskHandler) taskHandler);
+// } else {
+// MylarStatusHandler.log("Could not load contributor: " + taskHandler.getClass().getCanonicalName()
+// + " must implement " + ITaskHandler.class.getCanonicalName(), null);
+// }
} catch (CoreException e) {
MylarStatusHandler.log(e, "Could not load task handler extension");
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListPreferenceConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListPreferenceConstants.java
index 16eb63a17..72d229ead 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListPreferenceConstants.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListPreferenceConstants.java
@@ -54,4 +54,6 @@ public class TaskListPreferenceConstants {
public static final String CONTEXTS_MIGRATED = "org.eclipse.mylar.tasklist.repositories.migrated.single";
+ public static final String REPOSITORY_SYNCH_ON_STARTUP = "org.eclipse.mylar.tasklist.repositories.synch.startup";
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java
index b6e079a27..e52d36427 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java
@@ -26,7 +26,7 @@ import java.util.StringTokenizer;
import org.eclipse.mylar.internal.core.MylarContextManager;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.ITaskRepositoryListener;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
@@ -38,7 +38,7 @@ public class TaskRepositoryManager {
public static final String PREF_REPOSITORIES = "org.eclipse.mylar.tasklist.repositories.";
- private Map<String, ITaskRepositoryClient> repositoryClients = new HashMap<String, ITaskRepositoryClient>();
+ private Map<String, TaskRepositoryClient> repositoryClients = new HashMap<String, TaskRepositoryClient>();
private Map<String, Set<TaskRepository>> repositoryMap = new HashMap<String, Set<TaskRepository>>();
@@ -58,21 +58,21 @@ public class TaskRepositoryManager {
private static final String PREF_STORE_DELIM = ", ";
- public Collection<ITaskRepositoryClient> getRepositoryClients() {
+ public Collection<TaskRepositoryClient> getRepositoryClients() {
return Collections.unmodifiableCollection(repositoryClients.values());
}
- public ITaskRepositoryClient getRepositoryClient(String kind) {
+ public TaskRepositoryClient getRepositoryClient(String kind) {
return repositoryClients.get(kind);
}
- public void addRepositoryClient(ITaskRepositoryClient repositoryClient) {
+ public void addRepositoryClient(TaskRepositoryClient repositoryClient) {
if (!repositoryClients.values().contains(repositoryClient)) {
repositoryClients.put(repositoryClient.getKind(), repositoryClient);
}
}
- public void removeRepositoryClient(ITaskRepositoryClient repositoryClient) {
+ public void removeRepositoryClient(TaskRepositoryClient repositoryClient) {
repositoryClients.remove(repositoryClient);
}
@@ -125,7 +125,7 @@ public class TaskRepositoryManager {
public List<TaskRepository> getAllRepositories() {
List<TaskRepository> repositories = new ArrayList<TaskRepository>();
- for (ITaskRepositoryClient repositoryClient : repositoryClients.values()) {
+ for (TaskRepositoryClient repositoryClient : repositoryClients.values()) {
if (repositoryMap.containsKey(repositoryClient.getKind())) {
repositories.addAll(repositoryMap.get(repositoryClient.getKind()));
}
@@ -169,7 +169,7 @@ public class TaskRepositoryManager {
}
public Map<String, Set<TaskRepository>> readRepositories() {
- for (ITaskRepositoryClient repositoryClient : repositoryClients.values()) {
+ for (TaskRepositoryClient repositoryClient : repositoryClients.values()) {
String read = MylarTaskListPlugin.getPrefs().getString(PREF_REPOSITORIES + repositoryClient.getKind());
Set<TaskRepository> repositories = new HashSet<TaskRepository>();
if (read != null) {
@@ -194,7 +194,7 @@ public class TaskRepositoryManager {
private void saveRepositories() {
String store = "";
- for (ITaskRepositoryClient repositoryClient : repositoryClients.values()) {
+ for (TaskRepositoryClient repositoryClient : repositoryClients.values()) {
if (repositoryMap.containsKey(repositoryClient.getKind())) {
for (TaskRepository repository : repositoryMap.get(repositoryClient.getKind())) {
store += repository.getUrl().toExternalForm() + PREF_STORE_DELIM;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
index c7db82880..7ab440cd0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
@@ -506,19 +506,21 @@ public class TaskPlannerEditorPart extends EditorPart {
updateEstimatedHours(contentProvider);
continue;
} else if (selectedObject instanceof ITaskListElement) {
- if (MylarTaskListPlugin.getDefault().getHandlerForElement((ITaskListElement) selectedObject) != null) {
- ITask task = null;
- if (selectedObject instanceof ITask) {
- task = (ITask) selectedObject;
- } else if (selectedObject instanceof IQueryHit) {
- task = ((IQueryHit) selectedObject).getOrCreateCorrespondingTask();
- }
- if (task != null) {
- contentProvider.addTask(task);
- updateEstimatedHours(contentProvider);
- continue;
- }
+ // if
+ // (MylarTaskListPlugin.getDefault().getHandlerForElement((ITaskListElement)
+ // selectedObject) != null) {
+ ITask task = null;
+ if (selectedObject instanceof ITask) {
+ task = (ITask) selectedObject;
+ } else if (selectedObject instanceof IQueryHit) {
+ task = ((IQueryHit) selectedObject).getOrCreateCorrespondingTask();
}
+ if (task != null) {
+ contentProvider.addTask(task);
+ updateEstimatedHours(contentProvider);
+ continue;
+ }
+ // }
} else {
return false;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
index 515d10a14..2f38945a7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
@@ -47,8 +47,10 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
private Button reportInternal = null;
- private Button multipleActive = null;
+ private Button refreshQueries = null;
+// private Button refreshQueries;
+
public MylarTaskListPreferencePage() {
super();
setPreferenceStore(MylarTaskListPlugin.getPrefs());
@@ -77,14 +79,20 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
container.setLayoutData(gridData);
GridLayout gl = new GridLayout(1, false);
container.setLayout(gl);
+
+// refreshQueries = new Button(container, SWT.CHECK)
+// refreshQueries.setText("Automatically refresh Bugzilla reports and queries on startup", BooleanFieldEditor.DEFAULT,
+// getFieldEditorParent());
+//
+
// closeEditors = new Button(container, SWT.CHECK);
// closeEditors.setText("Close all editors on task deactivation
// (defaults to close only editors of interesting resources)");
// closeEditors.setSelection(getPreferenceStore().getBoolean(MylarPlugin.AUTO_MANAGE_EDITORS));
- multipleActive = new Button(container, SWT.CHECK);
- multipleActive.setText("Enable multiple task contexts to be active");
- multipleActive.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS));
+ refreshQueries = new Button(container, SWT.CHECK);
+ refreshQueries.setText("Automatically perform a repository refresh on startup");
+ refreshQueries.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
}
private void createBugzillaReportOption(Composite parent) {
@@ -128,7 +136,7 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
// getPreferenceStore().setValue(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL,
// reportExternal.getSelection());
getPreferenceStore().setValue(TaskListPreferenceConstants.DEFAULT_URL_PREFIX, taskURLPrefixText.getText());
- getPreferenceStore().setValue(TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS, multipleActive.getSelection());
+ getPreferenceStore().setValue(TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP, refreshQueries.getSelection());
return true;
}
@@ -139,7 +147,7 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
reportEditor.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.REPORT_OPEN_EDITOR));
reportInternal.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.REPORT_OPEN_INTERNAL));
// reportExternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL));
- multipleActive.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS));
+ refreshQueries.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
// saveCombo.setText(getPreferenceStore().getString(MylarTaskListPlugin.SAVE_TASKLIST_MODE));
return true;
}
@@ -161,8 +169,8 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
// reportExternal.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL));
taskURLPrefixText.setText(getPreferenceStore().getDefaultString(TaskListPreferenceConstants.DEFAULT_URL_PREFIX));
- multipleActive.setSelection(getPreferenceStore().getDefaultBoolean(
- TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS));
+ refreshQueries.setSelection(getPreferenceStore().getDefaultBoolean(
+ TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
}
private Label createLabel(Composite parent, String text) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
index c9def9a30..95a979de1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
@@ -25,7 +25,6 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
@@ -44,7 +43,6 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.internal.core.dt.MylarWebRef;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskPriorityFilter;
import org.eclipse.mylar.internal.tasklist.ui.AbstractTaskFilter;
@@ -1025,18 +1023,15 @@ public class TaskListView extends ViewPart {
}
}
- /**
- * Refactor handler stuff
- */
private void addAction(Action action, IMenuManager manager, ITaskListElement element) {
manager.add(action);
if (element != null) {
- ITaskHandler handler = MylarTaskListPlugin.getDefault().getHandlerForElement(element);
- if (handler != null) {
- action.setEnabled(handler.enableAction(action, element));
- } else {
- updateActionEnablement(action, element);
- }
+// ITaskHandler handler = MylarTaskListPlugin.getDefault().getHandlerForElement(element);
+// if (handler != null) {
+// action.setEnabled(handler.enableAction(action, element));
+// } else {
+ updateActionEnablement(action, element);
+// }
}
}
@@ -1196,9 +1191,9 @@ public class TaskListView extends ViewPart {
});
}
- public void showMessage(String message) {
- MessageDialog.openInformation(getViewer().getControl().getShell(), "TaskList Message", message);
- }
+// public void showMessage(String message) {
+// MessageDialog.openInformation(getViewer().getControl().getShell(), "TaskList Message", message);
+// }
/**
* Passing the focus request to the viewer's control.
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java
index c10c61c5c..4181e1b1e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.ui.IWorkbench;
@@ -36,7 +36,7 @@ public abstract class AbstractAddExistingTaskWizard extends Wizard {
@Override
public final boolean performFinish() {
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
this.repository.getKind());
ITask newTask = client.createTaskFromExistingId(repository, getTaskId());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java
index e13e257f4..d6eea4005 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java
@@ -12,7 +12,7 @@
package org.eclipse.mylar.internal.tasklist.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.ui.INewWizard;
/**
@@ -24,13 +24,13 @@ public abstract class AbstractRepositoryClientWizard extends Wizard implements I
protected AbstractRepositorySettingsPage abstractRepositorySettingsPage;
- protected ITaskRepositoryClient repositoryClient;
+ protected TaskRepositoryClient repositoryClient;
- public void setRepositoryClient(ITaskRepositoryClient repository) {
+ public void setRepositoryClient(TaskRepositoryClient repository) {
this.repositoryClient = repository;
}
- public ITaskRepositoryClient getRepositoryClient() {
+ public TaskRepositoryClient getRepositoryClient() {
return repositoryClient;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java
index af8724c56..b95ee71c4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java
@@ -12,7 +12,7 @@
package org.eclipse.mylar.internal.tasklist.ui.wizards;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
@@ -27,7 +27,7 @@ public class AddExistingTaskWizard extends MultiRepositoryAwareWizard {
@Override
protected IWizard createWizard(TaskRepository taskRepository) {
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
taskRepository.getKind());
return client.getAddExistingTaskWizard(taskRepository);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java
index 141fd7c13..6b997bf09 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java
@@ -13,7 +13,7 @@ package org.eclipse.mylar.internal.tasklist.ui.wizards;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.ui.INewWizard;
@@ -32,7 +32,7 @@ public class EditRepositoryWizard extends Wizard implements INewWizard {
public EditRepositoryWizard(TaskRepository repository) {
super();
// super.setForcePreviousAndNextButtons(true);
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
repository.getKind());
abstractRepositorySettingsPage = client.getSettingsPage();
abstractRepositorySettingsPage.setRepository(repository);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java
index 4192f51d8..749404b4b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java
@@ -12,7 +12,7 @@
package org.eclipse.mylar.internal.tasklist.ui.wizards;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
@@ -26,7 +26,7 @@ public class NewQueryWizard extends MultiRepositoryAwareWizard {
@Override
protected IWizard createWizard(TaskRepository taskRepository) {
- ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
+ TaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(
taskRepository.getKind());
return client.getQueryWizard(taskRepository);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java
index 06809f6c3..28749393a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
+import org.eclipse.mylar.tasklist.TaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
@@ -78,8 +78,8 @@ public class SelectRepositoryClientPage extends WizardPage {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.getFirstElement() instanceof ITaskRepositoryClient) {
- wizard.setRepositoryClient((ITaskRepositoryClient) selection.getFirstElement());
+ if (selection.getFirstElement() instanceof TaskRepositoryClient) {
+ wizard.setRepositoryClient((TaskRepositoryClient) selection.getFirstElement());
SelectRepositoryClientPage.this.setPageComplete(true);
wizard.getContainer().updateButtons();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java
index 7177c0f3a..e45989af8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java
@@ -28,7 +28,7 @@ import org.w3c.dom.Node;
*/
public interface ITaskListExternalizer {
- public abstract ITaskRepositoryClient getRepositoryClient();
+ public abstract TaskRepositoryClient getRepositoryClient();
/**
* Note that registries get read as a normal category, but get written out
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
index b89d20625..28097bef9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
@@ -23,7 +23,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.internal.core.MylarPreferenceContstants;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.TaskListExtensionReader;
import org.eclipse.mylar.internal.tasklist.TaskListManager;
import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
@@ -35,7 +34,6 @@ import org.eclipse.mylar.internal.tasklist.planner.TaskReportGenerator;
import org.eclipse.mylar.internal.tasklist.ui.IDynamicSubMenuContributor;
import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
import org.eclipse.mylar.internal.tasklist.ui.ITaskHighlighter;
-import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.TasksReminderDialog;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.swt.events.ShellEvent;
@@ -63,7 +61,8 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
private TaskListSaveManager taskListSaveManager = new TaskListSaveManager();
- private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO:
+ // private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>();
+ // // TODO:
private List<ITaskEditorFactory> taskEditors = new ArrayList<ITaskEditorFactory>();
@@ -300,16 +299,20 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
try {
TaskListExtensionReader.initExtensions(taskListWriter);
taskRepositoryManager.readRepositories();
-
+
taskListManager.addListener(CONTEXT_TASK_ACTIVITY_LISTENER);
taskListManager.addListener(taskListSaveManager);
- restoreTaskHandlerState();
+ // restoreTaskHandlerState();
taskListManager.readExistingOrCreateNewList();
- restoreTaskHandlerState();
-
migrateHandlesToRepositorySupport();
-
+
+ if (getPrefs().getBoolean(TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP)) {
+ for (TaskRepositoryClient repositoryClient : taskRepositoryManager.getRepositoryClients()) {
+ repositoryClient.synchronize();
+ }
+ }
+
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addDisposeListener(
@@ -383,8 +386,8 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
}
if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().removeShellListener(SHELL_LISTENER);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
- .removeDisposeListener(taskListSaveManager);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().removeDisposeListener(
+ taskListSaveManager);
}
} catch (Exception e) {
MylarStatusHandler.fail(e, "Mylar Java stop failed", false);
@@ -398,7 +401,10 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
store.setDefault(TaskListPreferenceConstants.REPORT_OPEN_EDITOR, true);
store.setDefault(TaskListPreferenceConstants.REPORT_OPEN_INTERNAL, false);
store.setDefault(TaskListPreferenceConstants.REPORT_OPEN_EXTERNAL, false);
+ store.setDefault(TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP, false);
+
store.setDefault(TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS, false);
+ store.setValue(TaskListPreferenceConstants.MULTIPLE_ACTIVE_TASKS, false);
store.setDefault(TaskListPreferenceConstants.SAVE_TASKLIST_MODE, TaskListSaveMode.THREE_HOURS.toString());
}
@@ -441,6 +447,9 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
}
public static IPreferenceStore getPrefs() {
+ // TODO: should be using the task list's prefernece store, but can't
+ // change without migrating because this will cause people to lose
+ // repositories
return MylarPlugin.getDefault().getPreferenceStore();
}
@@ -514,27 +523,27 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
}
}
- public List<ITaskHandler> getTaskHandlers() {
- return taskHandlers;
- }
+ // public List<ITaskHandler> getTaskHandlers() {
+ // return taskHandlers;
+ // }
- public ITaskHandler getHandlerForElement(ITaskListElement element) {
- for (ITaskHandler taskHandler : taskHandlers) {
- if (taskHandler.acceptsItem(element))
- return taskHandler;
- }
- return null;
- }
+ // public ITaskHandler getHandlerForElement(ITaskListElement element) {
+ // for (ITaskHandler taskHandler : taskHandlers) {
+ // if (taskHandler.acceptsItem(element))
+ // return taskHandler;
+ // }
+ // return null;
+ // }
- public void addTaskHandler(ITaskHandler taskHandler) {
- taskHandlers.add(taskHandler);
- }
+ // public void addTaskHandler(ITaskHandler taskHandler) {
+ // taskHandlers.add(taskHandler);
+ // }
- private void restoreTaskHandlerState() {
- for (ITaskHandler handler : taskHandlers) {
- handler.restoreState(TaskListView.getDefault());
- }
- }
+ // private void restoreTaskHandlerState() {
+ // for (ITaskHandler handler : taskHandlers) {
+ // handler.restoreState(TaskListView.getDefault());
+ // }
+ // }
private List<IDynamicSubMenuContributor> menuContributors = new ArrayList<IDynamicSubMenuContributor>();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepositoryClient.java
index 2e85464de..c7647ea11 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepositoryClient.java
@@ -11,19 +11,23 @@
package org.eclipse.mylar.tasklist;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractRepositorySettingsPage;
/**
- * Mixes UI with task creation, but OK for now.
- *
* @author Mik Kersten
- * @author Brock Janiczak
*/
-public interface ITaskRepositoryClient {
+public abstract class TaskRepositoryClient {
+
+ private Map<String, ITask> archiveMap = new HashMap<String, ITask>();
+
+ private TaskCategory archiveCategory = null;
public abstract String getLabel();
@@ -32,15 +36,6 @@ public interface ITaskRepositoryClient {
*/
public abstract String getKind();
-
- public ITask getFromBugzillaTaskRegistry(String handle);
-
- public void addTaskToArchive(ITask newTask);
-
- public List<ITask> getArchiveTasks();
-
- public void setArchiveCategory(TaskCategory category);
-
/**
* @param id
* identifier, e.g. "123" bug Bugzilla bug 123
@@ -48,6 +43,11 @@ public interface ITaskRepositoryClient {
*/
public abstract ITask createTaskFromExistingId(TaskRepository repository, String id);
+ /**
+ * Synchronize state with the repository (e.g. queries, task contents)
+ */
+ public abstract void synchronize();
+
public abstract AbstractRepositorySettingsPage getSettingsPage();
public abstract IWizard getQueryWizard(TaskRepository repository);
@@ -55,4 +55,27 @@ public interface ITaskRepositoryClient {
public abstract void openEditQueryDialog(IRepositoryQuery query);
public abstract IWizard getAddExistingTaskWizard(TaskRepository repository);
+
+ public void addTaskToArchive(ITask newTask) {
+ if (!archiveMap.containsKey(newTask.getHandleIdentifier())) {
+ archiveMap.put(newTask.getHandleIdentifier(), newTask);
+ if (archiveCategory != null) {
+ archiveCategory.internalAddTask(newTask);
+ }
+ }
+ }
+
+ public ITask getTaskFromArchive(String handle) {
+ return archiveMap.get(handle);
+ }
+
+ public List<ITask> getArchiveTasks() {
+ List<ITask> archiveTasks = new ArrayList<ITask>();
+ archiveTasks.addAll(archiveMap.values());
+ return archiveTasks;
+ }
+
+ public void setArchiveCategory(TaskCategory category) {
+ this.archiveCategory = category;
+ }
}

Back to the top