Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-01-25 14:12:14 -0500
committermkersten2006-01-25 14:12:14 -0500
commit4eb4f8006a7a53fd849dbc079b4c09a7427739ad (patch)
tree03a1b8b73e85163f683f07b9aa964d0f0f494dc5
parent1233cd4aa004a295638042b53eb685503c322abb (diff)
downloadorg.eclipse.mylyn.tasks-4eb4f8006a7a53fd849dbc079b4c09a7427739ad.tar.gz
org.eclipse.mylyn.tasks-4eb4f8006a7a53fd849dbc079b4c09a7427739ad.tar.xz
org.eclipse.mylyn.tasks-4eb4f8006a7a53fd849dbc079b4c09a7427739ad.zip
Progress on: Bug 125095: make task/report editor extensible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=125095
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java13
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryHit.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java)132
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java46
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java155
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListManager.java86
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java33
-rw-r--r--org.eclipse.mylyn.help.ui/doc/devfaq.html15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java2
-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/ITaskRepositoryClient.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java14
20 files changed, 330 insertions, 310 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 7f4854009..1aab21a25 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -18,7 +18,7 @@
point="org.eclipse.mylar.tasklist.repositories">
<repositoryClient
- class="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskRepositoryClient"
+ class="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryClient"
id="org.eclipse.mylar.bugzilla.tasklist.repositories"
name="Bugzilla Client"
type="bugzilla"/>
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
index 459ef0772..570f7c6ef 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
@@ -13,7 +13,6 @@ package org.eclipse.mylar.internal.bugzilla.ui;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRefreshManager;
-import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskListManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -24,7 +23,7 @@ import org.osgi.framework.BundleContext;
*/
public class BugzillaUiPlugin extends AbstractUIPlugin {
- private BugzillaTaskListManager bugzillaTaskListManager;
+// private BugzillaTaskListManager bugzillaTaskListManager;
private BugzillaRefreshManager bugzillaRefreshManager;
@@ -37,9 +36,9 @@ public class BugzillaUiPlugin extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
BugzillaPlugin.setResultEditorMatchAdapter(new BugzillaResultMatchAdapter());
- bugzillaTaskListManager = new BugzillaTaskListManager();
+// bugzillaTaskListManager = new BugzillaTaskListManager();
bugzillaRefreshManager = new BugzillaRefreshManager();
- BugzillaPlugin.getDefault().addOfflineStatusListener(bugzillaTaskListManager);
+// BugzillaPlugin.getDefault().addOfflineStatusListener(bugzillaTaskListManager);
}
@@ -71,9 +70,9 @@ public class BugzillaUiPlugin extends AbstractUIPlugin {
return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylar.internal.bugzilla.ui", path);
}
- public BugzillaTaskListManager getBugzillaTaskListManager() {
- return bugzillaTaskListManager;
- }
+// public BugzillaTaskListManager getBugzillaTaskListManager() {
+// return bugzillaTaskListManager;
+// }
public BugzillaRefreshManager getBugzillaRefreshManager() {
return bugzillaRefreshManager;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
index 7fa409ec9..b185d317c 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
@@ -106,7 +106,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
protected Display display;
- public static final Font TITLE_FONT = JFaceResources.getHeaderFont();
+ public static final Font TITLE_FONT = JFaceResources.getBannerFont();
public static final Font TEXT_FONT = JFaceResources.getDefaultFont();
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 3c67987b6..89b169605 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
@@ -29,7 +29,6 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.search.BugzillaSearchHit;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaResultCollector;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaCategorySearchOperation.ICategorySearchListener;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
@@ -37,6 +36,8 @@ import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
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.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.graphics.Font;
@@ -114,9 +115,10 @@ public class BugzillaQueryCategory implements IRepositoryQuery {
}
public void addHit(IQueryHit hit) {
- BugzillaTask task = BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().getFromBugzillaTaskRegistry(
+ ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ ITask correspondingTask = client.getFromBugzillaTaskRegistry(
hit.getHandleIdentifier());
- hit.setCorrespondingTask(task);
+ 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 04b0dc70c..43ee2be3a 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
@@ -11,13 +11,15 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
+import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
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.MylarTaskListPlugin;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -125,7 +127,9 @@ public class BugzillaQueryHit implements IQueryHit {
public ITask getOrCreateCorrespondingTask() {
if (task == null) {
task = new BugzillaTask(this, true);
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry(task);
+ ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ client.addTaskToArchive(task);
+// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskArchive(task);
}
return task;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java
index 8ac60eeb7..a800fd36e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryClient.java
@@ -11,12 +11,20 @@
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.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.SynchronizeReportsAction;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
+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;
@@ -32,10 +40,21 @@ import org.eclipse.swt.widgets.Display;
/**
* @author Mik Kersten
*/
-public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
+public class BugzillaRepositoryClient implements ITaskRepositoryClient, IOfflineBugListener {
+
+ private static final String LABEL = "Bugzilla (supports uncustomized 2.16-2.20)";
+ private Map<String, BugzillaTask> bugzillaTaskArchive = new HashMap<String, BugzillaTask>();
+
+ private TaskCategory archiveCategory = null;
+
+ public BugzillaRepositoryClient() {
+ // TODO: remove on dispose?
+ BugzillaPlugin.getDefault().addOfflineStatusListener(this);
+ }
+
public String getLabel() {
- return "Bugzilla (supports uncustomized 2.16-2.20)";
+ return LABEL;
}
public String toString() {
@@ -50,6 +69,48 @@ public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
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 Map<String, BugzillaTask> getBugzillaTaskRegistry() {
+// return bugzillaTaskArchive;
+// }
+
+ public void setArchiveCategory(TaskCategory category) {
+ this.archiveCategory = category;
+ }
+
+
public ITask createTaskFromExistingId(TaskRepository repository, String id) {
int bugId = -1;
try {
@@ -63,24 +124,26 @@ public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
return null;
}
- ITask newTask = new BugzillaTask(TaskRepositoryManager.getHandle(repository.getUrl().toExternalForm(), bugId),
+ BugzillaTask newTask = new BugzillaTask(TaskRepositoryManager.getHandle(repository.getUrl().toExternalForm(), bugId),
"<bugzilla info>", true, true);
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(newTask);
- if (taskHandler != null) {
- ITask addedTask = taskHandler.addTaskToRegistry(newTask);
- if (addedTask instanceof BugzillaTask) {
- BugzillaTask newTask2 = (BugzillaTask) addedTask;
- if (newTask2 == newTask) {
- ((BugzillaTask) newTask).scheduleDownloadReport();
- } else {
- newTask = newTask2;
- ((BugzillaTask) newTask).updateTaskDetails();
- }
- }
- } else {
- ((BugzillaTask) newTask).scheduleDownloadReport();
- }
+ // 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;
}
@@ -121,7 +184,7 @@ public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
} catch (Exception e) {
}
queryCategory.setMaxHits(maxHits);
-
+
new SynchronizeReportsAction(queryCategory).run();
}
} else if (query instanceof BugzillaQueryCategory) {
@@ -139,9 +202,34 @@ public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
} catch (Exception e) {
}
queryCategory.setMaxHits(maxHits);
-
+
new SynchronizeReportsAction(queryCategory).run();
}
}
}
-}
+
+ public void offlineStatusChange(IBugzillaBug bug, BugzillaOfflineStaus status) {
+ BugReportSyncState state = null;
+ if (status == BugzillaOfflineStaus.SAVED_WITH_OUTGOING_CHANGES) {
+ state = BugReportSyncState.OUTGOING;
+ } else if (status == BugzillaOfflineStaus.SAVED) {
+ state = BugReportSyncState.OK;
+ } else if (status == BugzillaOfflineStaus.SAVED_WITH_INCOMMING_CHANGES) {
+ state = BugReportSyncState.INCOMMING;
+ } else if (status == BugzillaOfflineStaus.CONFLICT) {
+ state = BugReportSyncState.CONFLICT;
+ }
+ if (state == null) {
+ // this means that we got a status that we didn't understand
+ return;
+ }
+
+ String handle = TaskRepositoryManager.getHandle(bug.getRepository(), bug.getId());
+ ITask task = MylarTaskListPlugin.getTaskListManager().getTaskForHandle(handle, true);
+ if (task != null && task instanceof BugzillaTask) {
+ BugzillaTask bugTask = (BugzillaTask) task;
+ bugTask.setSyncState(state);
+ MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(bugTask);
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
index f27e189e0..a59e42230 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
@@ -399,7 +399,7 @@ public class BugzillaTask extends Task {
state = BugTaskState.FREE;
updateTaskDetails();
- MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(BugzillaTask.this);
+// MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(BugzillaTask.this);
// notifyTaskDataChange();
saveBugReport(true);
MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(BugzillaTask.this);
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 01842c96e..ae0dc4131 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
@@ -14,20 +14,19 @@ package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
import java.util.Date;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask.BugReportSyncState;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask.BugTaskState;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.DelegatingLocalTaskExternalizer;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskList;
import org.eclipse.mylar.internal.tasklist.TaskListExternalizerException;
import org.eclipse.mylar.internal.tasklist.TaskListManager;
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.IRepositoryQuery;
+import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -74,11 +73,16 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
private static final String TAG_TASK = "BugzillaReport";
+ private ITaskRepositoryClient repositoryClient;
+
+ public BugzillaTaskExternalizer() {
+ repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ }
+
@Override
public void createRegistry(Document doc, Node parent) {
Element node = doc.createElement(BUGZILLA_TASK_REGISTRY);
- for (BugzillaTask task : BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().getBugzillaTaskRegistry()
- .values()) {
+ for (ITask task : repositoryClient.getArchiveTasks()) {
try {
createTaskElement(task, doc, node);
} catch (Exception e) {
@@ -89,6 +93,10 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
parent.appendChild(node);
}
+ public ITaskRepositoryClient getRepositoryClient() {
+ return repositoryClient;
+ }
+
@Override
public boolean canReadCategory(Node node) {
return node.getNodeName().equals(getCategoryTagName()) || node.getNodeName().equals(BUGZILLA_TASK_REGISTRY);
@@ -155,17 +163,19 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
public void readRegistry(Node node, TaskList taskList) throws TaskListExternalizerException {
boolean hasCaughtException = false;
NodeList list = node.getChildNodes();
- TaskCategory cat = new TaskCategory(BUGZILLA_ARCHIVE_LABEL);
- cat.setIsArchive(true);
- taskList.internalAddCategory(cat);
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().setTaskRegistyCategory(cat);
+ TaskCategory archiveCategory = new TaskCategory(BUGZILLA_ARCHIVE_LABEL);
+ archiveCategory.setIsArchive(true);
+ taskList.internalAddCategory(archiveCategory);
+ repositoryClient.setArchiveCategory(archiveCategory);
+// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().setTaskRegistyCategory(cat);
for (int i = 0; i < list.getLength(); i++) {
try {
Node child = list.item(i);
ITask task = readTask(child, taskList, null, null);
if (task instanceof BugzillaTask) {
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry(
- (BugzillaTask) task);
+ repositoryClient.addTaskToArchive(task);
+// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskArchive(
+// (BugzillaTask) task);
}
} catch (TaskListExternalizerException e) {
hasCaughtException = true;
@@ -261,13 +271,17 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
}
}
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(task);
- if (taskHandler != null) {
- ITask addedTask = taskHandler.addTaskToRegistry(task);
- if (addedTask instanceof BugzillaTask)
- task = (BugzillaTask) addedTask;
+ ITaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ if (repositoryClient != null) {
+ repositoryClient.addTaskToArchive(task);
}
return task;
+// ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(task);
+// if (taskHandler != null) {
+// ITask addedTask = taskHandler.addTaskToArchive(task);
+// if (addedTask instanceof BugzillaTask)
+// task = (BugzillaTask) addedTask;
+// }
}
public boolean canReadQueryHit(Node node) {
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
index b230860df..e76be7147 100644
--- 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
@@ -13,7 +13,6 @@ 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.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
@@ -34,7 +33,76 @@ import org.eclipse.mylar.tasklist.ITask;
*/
public class BugzillaTaskHandler implements ITaskHandler {
-// public void itemOpened(ITaskListElement element) {
+ 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);
//
@@ -123,89 +191,6 @@ 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 ITask addTaskToRegistry(ITask newTask) {
- if (newTask instanceof BugzillaTask) {
- BugzillaTask bugTask = BugzillaUiPlugin.getDefault().getBugzillaTaskListManager()
- .getFromBugzillaTaskRegistry(newTask.getHandleIdentifier());
- if (bugTask == null) {
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry(
- (BugzillaTask) newTask);
- bugTask = (BugzillaTask) newTask;
- }
- return bugTask;
- }
- return null;
- }
-
- 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 ITask getCorrespondingTask(IQueryHit queryHit) {
// if (queryHit instanceof BugzillaQueryHit) {
// BugzillaQueryHit hit = (BugzillaQueryHit) queryHit;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListManager.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListManager.java
deleted file mode 100644
index ba6fbdaca..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListManager.java
+++ /dev/null
@@ -1,86 +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 java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
-import org.eclipse.mylar.internal.bugzilla.core.IOfflineBugListener;
-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.tasklist.ITask;
-import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
-
-/**
- * @author Mik Kersten and Ken Sueda
- */
-public class BugzillaTaskListManager implements IOfflineBugListener {
-
- private Map<String, BugzillaTask> bugzillaTaskRegistry = new HashMap<String, BugzillaTask>();
-
- private TaskCategory cat = null;
-
- // XXX we never delete anything from this registry
-
- public void addToBugzillaTaskRegistry(BugzillaTask task) {
- if (bugzillaTaskRegistry.get(task.getHandleIdentifier()) == null) {
- bugzillaTaskRegistry.put(task.getHandleIdentifier(), task);
- if (cat != null) {
- cat.internalAddTask(task);
- }
- }
- }
-
- public BugzillaTask getFromBugzillaTaskRegistry(String handle) {
- return bugzillaTaskRegistry.get(handle);
- }
-
- public Map<String, BugzillaTask> getBugzillaTaskRegistry() {
- return bugzillaTaskRegistry;
- }
-
- public void setTaskRegistyCategory(TaskCategory cat) {
- this.cat = cat;
- }
-
- public void offlineStatusChange(IBugzillaBug bug, BugzillaOfflineStaus status) {
- BugReportSyncState state = null;
- if (status == BugzillaOfflineStaus.SAVED_WITH_OUTGOING_CHANGES) {
- state = BugReportSyncState.OUTGOING;
- } else if (status == BugzillaOfflineStaus.SAVED) {
- state = BugReportSyncState.OK;
- } else if (status == BugzillaOfflineStaus.SAVED_WITH_INCOMMING_CHANGES) {
- state = BugReportSyncState.INCOMMING;
- } else if (status == BugzillaOfflineStaus.CONFLICT) {
- state = BugReportSyncState.CONFLICT;
- }
- if (state == null) {
- // this means that we got a status that we didn't understand
- return;
- }
-
- String handle = TaskRepositoryManager.getHandle(bug.getRepository(), bug.getId());
- ITask task = MylarTaskListPlugin.getTaskListManager().getTaskForHandle(handle, true);
- if (task != null && task instanceof BugzillaTask) {
- BugzillaTask bugTask = (BugzillaTask) task;
- bugTask.setSyncState(state);
- if (TaskListView.getDefault() != null && TaskListView.getDefault().getViewer() != null
- && !TaskListView.getDefault().getViewer().getControl().isDisposed()) {
- TaskListView.getDefault().getViewer().refresh();
- }
- }
- }
-
-}
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 e68ca19d1..fb42bbe07 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
@@ -13,16 +13,15 @@ package org.eclipse.mylar.internal.bugzilla.ui.wizard;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.OfflineView;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
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.ITask;
+import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
@@ -107,16 +106,21 @@ public class NewBugzillaReportWizard extends AbstractBugWizard {
selectedObject = ((IStructuredSelection) TaskListView.getDefault().getViewer().getSelection())
.getFirstElement();
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(newTask);
- if (taskHandler != null) {
- ITask addedTask = taskHandler.addTaskToRegistry(newTask);
- if (addedTask instanceof BugzillaTask) {
- BugzillaTask newTask2 = (BugzillaTask) addedTask;
- if (newTask2 != newTask) {
- newTask = newTask2;
- }
- }
+ ITaskRepositoryClient repositoryClient = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ if (repositoryClient != null) {
+ repositoryClient.addTaskToArchive(newTask);
}
+
+// ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(newTask);
+// if (taskHandler != null) {
+// ITask addedTask = taskHandler.addTaskToArchive(newTask);
+// if (addedTask instanceof BugzillaTask) {
+// BugzillaTask newTask2 = (BugzillaTask) addedTask;
+// if (newTask2 != newTask) {
+// newTask = newTask2;
+// }
+// }
+// }
if (selectedObject instanceof TaskCategory) {
MylarTaskListPlugin.getTaskListManager().moveToCategory(((TaskCategory) selectedObject), newTask);
@@ -124,7 +128,10 @@ public class NewBugzillaReportWizard extends AbstractBugWizard {
} else {
MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask);
}
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry((BugzillaTask) newTask);
+
+ ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(BugzillaPlugin.REPOSITORY_KIND);
+ client.addTaskToArchive(newTask);
+// BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskArchive((BugzillaTask) newTask);
// newTask.openTaskInEditor(false);
TaskListUiUtil.openEditor(newTask);
diff --git a/org.eclipse.mylyn.help.ui/doc/devfaq.html b/org.eclipse.mylyn.help.ui/doc/devfaq.html
index a3574fd51..f83067c75 100644
--- a/org.eclipse.mylyn.help.ui/doc/devfaq.html
+++ b/org.eclipse.mylyn.help.ui/doc/devfaq.html
@@ -75,14 +75,13 @@ and leave the password blank.</li>
helpwanted</a> list
of Bugzilla reports.</i></p>
<h3>&nbsp;</h3>
-<h3>Using Bugzilla</h3>
- <ul>
- <li>...</li>
- </ul>
- <p><b><i>Tip</i></b><i>: When writing comments, Bugzilla will
- automatically convert the text &quot;bug 1234&quot; to a hyperlink which will
- direct the reader to bug 1234.</i></p>
- <h3>&nbsp;</h3>
+<h3><a name=building-bugzilla>Building the Bugzilla Client</a></h3>
+<ul>
+ <li>Bugzilla support can be built independently of the Mylar UI by checking
+ out the following projects mylar.bugzilla.core, mylar.bugzilla.ui,
+ mylar.tasklist, mylar.core </li>
+</ul>
+<p>&nbsp;</p>
<h3><a name="building-eclipse-3.1">Building the Eclipse 3.1 branch</a></h3>
<ul>
<li>Right-click the org.eclipse.mylar.java, mylar.ide, and mylar.xml
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 1ba966c19..18eea60ae 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,6 +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.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -101,6 +102,13 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer {
private List<ITaskListExternalizer> delegateExternalizers = new ArrayList<ITaskListExternalizer>();
/**
+ * TODO: make local task externalizer use repository.
+ */
+ public ITaskRepositoryClient getRepositoryClient() {
+ return null;
+ }
+
+ /**
* Set these on the TaskListWriter instead
*/
void setDelegateExternalizers(List<ITaskListExternalizer> externalizers) {
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
index b948b7ad2..8a326cb80 100644
--- 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
@@ -13,7 +13,6 @@ 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;
-import org.eclipse.mylar.tasklist.ITask;
/**
* TODO: usage should be refactored to TaskListManager
@@ -28,7 +27,7 @@ public interface ITaskHandler {
public abstract boolean acceptsItem(ITaskListElement element);
- public abstract ITask addTaskToRegistry(ITask newTask);
+// public abstract ITask addTaskToArchive(ITask newTask);
/**
* This is called both before and after the tasklist is read
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 aa957f66f..b162f0e60 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
@@ -72,36 +72,40 @@ public class TaskListExtensionReader {
List<ITaskListExternalizer> externalizers = new ArrayList<ITaskListExternalizer>();
if (!extensionsRead) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ // HACK: has to be read first
+ IExtensionPoint repositoriesExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORIES);
+ IExtension[] repositoryExtensions = repositoriesExtensionPoint.getExtensions();
+ for (int i = 0; i < repositoryExtensions.length; i++) {
+ IConfigurationElement[] elements = repositoryExtensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ if (elements[j].getName().compareTo(ELMNT_REPOSITORY_CLIENT) == 0) {
+ readRepositoryClient(elements[j]);
+ }
+ }
+ }
+
IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_TASK_CONTRIBUTOR);
IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
if (elements[j].getName().compareTo(ELMNT_TASK_HANDLER) == 0) {
- readTaskHandler(elements[j], externalizers);
- } else if (elements[j].getName().compareTo(ELMNT_REPOSITORY_CLIENT) == 0) {
- readRepository(elements[j]);
- // } else if
- // (elements[j].getName().compareTo(TASK_LISTENER_ELEMENT)
- // == 0) {
- // readTaskListener(elements[j]);
+ readHandlerAndExternalizer(elements[j], externalizers);
} else if (elements[j].getName().compareTo(DYNAMIC_POPUP_ELEMENT) == 0) {
readDynamicPopupContributor(elements[j]);
}
}
}
-
- IExtensionPoint repositoriesExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORIES);
- IExtension[] repositoryExtensions = repositoriesExtensionPoint.getExtensions();
- for (int i = 0; i < repositoryExtensions.length; i++) {
- IConfigurationElement[] elements = repositoryExtensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- if (elements[j].getName().compareTo(ELMNT_REPOSITORY_CLIENT) == 0) {
- readRepository(elements[j]);
- }
- }
- }
-
+// for (int i = 0; i < extensions.length; i++) {
+// IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+// for (int j = 0; j < elements.length; j++) {
+// if (elements[j].getName().compareTo(ELMNT_REPOSITORY_CLIENT) == 0) {
+// readRepositoryClient(elements[j]);
+// }
+// }
+// }
+
IExtensionPoint editorsExtensionPoint = registry.getExtensionPoint(EXTENSION_EDITORS);
IExtension[] editors = editorsExtensionPoint.getExtensions();
for (int i = 0; i < editors.length; i++) {
@@ -131,12 +135,11 @@ public class TaskListExtensionReader {
}
}
- private static void readRepository(IConfigurationElement element) {
+ private static void readRepositoryClient(IConfigurationElement element) {
try {
Object type = element.getAttribute(ELMNT_TYPE);
Object repository = element.createExecutableExtension(ATTR_CLASS);
if (repository instanceof ITaskRepositoryClient && type != null) {
- // MylarTaskListPlugin.getRepositoryManager().addType((String)type);
MylarTaskListPlugin.getRepositoryManager().addRepositoryClient((ITaskRepositoryClient) repository);
} else {
MylarStatusHandler.log("could not not load extension: " + repository, null);
@@ -146,24 +149,6 @@ public class TaskListExtensionReader {
}
}
- // private static void readTaskListener(IConfigurationElement element) {
- // try {
- // Object taskListener =
- // element.createExecutableExtension(TASK_LISTENER_CLASS_ID);
- // if (taskListener instanceof ITaskActivityListener) {
- // MylarTaskListPlugin.getTaskListManager().addListener((ITaskActivityListener)
- // taskListener);
- // } else {
- // MylarStatusHandler.log("Could not load tasklist listener: " +
- // taskListener.getClass().getCanonicalName()
- // + " must implement " + ITaskActivityListener.class.getCanonicalName(),
- // null);
- // }
- // } catch (CoreException e) {
- // MylarStatusHandler.log(e, "Could not load tasklist listener extension");
- // }
- // }
-
private static void readDynamicPopupContributor(IConfigurationElement element) {
try {
Object dynamicPopupContributor = element.createExecutableExtension(ATTR_CLASS);
@@ -180,13 +165,14 @@ public class TaskListExtensionReader {
}
}
- private static void readTaskHandler(IConfigurationElement element, List<ITaskListExternalizer> externalizers) {
+ private static void readHandlerAndExternalizer(IConfigurationElement element, List<ITaskListExternalizer> externalizers) {
try {
- Object externalizer = element.createExecutableExtension(ATTR_EXTERNALIZER_CLASS);
- if (externalizer instanceof ITaskListExternalizer) {
+ Object externalizerObject = element.createExecutableExtension(ATTR_EXTERNALIZER_CLASS);
+ if (externalizerObject instanceof ITaskListExternalizer) {
+ ITaskListExternalizer externalizer = (ITaskListExternalizer)externalizerObject;
externalizers.add((ITaskListExternalizer) externalizer);
} else {
- MylarStatusHandler.log("Could not load externalizer: " + externalizer.getClass().getCanonicalName()
+ MylarStatusHandler.log("Could not load externalizer: " + externalizerObject.getClass().getCanonicalName()
+ " must implement " + ITaskListExternalizer.class.getCanonicalName(), null);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java
index 91977032b..d58be6563 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java
@@ -270,11 +270,12 @@ public class TaskListWriter {
if (externalizer.canReadTask(child)) {
// TODO add the tasks properly
ITask newTask = externalizer.readTask(child, tlist, null, null);
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(
- newTask);
- if (taskHandler != null) {
- newTask = taskHandler.addTaskToRegistry(newTask);
- }
+ externalizer.getRepositoryClient().addTaskToArchive(newTask);
+// ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(
+// newTask);
+// if (taskHandler != null) {
+// newTask = taskHandler.addTaskToArchive(newTask);
+// }
tlist.addRootTask(newTask);
wasRead = true;
@@ -480,11 +481,13 @@ public class TaskListWriter {
if (externalizer.canReadTask(child)) {
// TODO add the tasks properly
ITask newTask = externalizer.readTask(child, tlist, null, null);
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(
- newTask);
- if (taskHandler != null) {
- newTask = taskHandler.addTaskToRegistry(newTask);
- }
+ externalizer.getRepositoryClient().addTaskToArchive(newTask);
+
+// ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(
+// newTask);
+// if (taskHandler != null) {
+// newTask = taskHandler.addTaskToArchive(newTask);
+// }
tlist.addRootTask(newTask);
wasRead = true;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java
index 0c67aacd6..7844800cb 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java
@@ -23,8 +23,6 @@ public interface ITaskCategory extends ITaskListElement {
public List<ITask> getChildren();
- // public void removeTask(ITask task);
-
public boolean isArchive();
public void setIsArchive(boolean isArchive);
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 569ca4317..7177c0f3a 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,6 +28,8 @@ import org.w3c.dom.Node;
*/
public interface ITaskListExternalizer {
+ public abstract ITaskRepositoryClient getRepositoryClient();
+
/**
* Note that registries get read as a normal category, but get written out
* first.
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/ITaskRepositoryClient.java
index f94eb2d88..2e85464de 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/ITaskRepositoryClient.java
@@ -11,10 +11,15 @@
package org.eclipse.mylar.tasklist;
+import java.util.List;
+
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
*/
@@ -27,6 +32,15 @@ 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
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 955d81a4a..b89d20625 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
@@ -298,24 +298,22 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
workbench.getDisplay().asyncExec(new Runnable() {
public void run() {
try {
-
TaskListExtensionReader.initExtensions(taskListWriter);
-
taskRepositoryManager.readRepositories();
-
+
taskListManager.addListener(CONTEXT_TASK_ACTIVITY_LISTENER);
taskListManager.addListener(taskListSaveManager);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
- MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addDisposeListener(
- taskListSaveManager);
-
restoreTaskHandlerState();
taskListManager.readExistingOrCreateNewList();
restoreTaskHandlerState();
migrateHandlesToRepositorySupport();
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
+ MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addDisposeListener(
+ taskListSaveManager);
} catch (Exception e) {
MylarStatusHandler.fail(e, "Task List initialization failed", true);
}

Back to the top