Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-07-12 19:41:41 -0400
committermkersten2005-07-12 19:41:41 -0400
commit23c8cbf0c6d069ce144d0844eb6071420662b796 (patch)
tree5767983ebefbf27e4b6e6fe04cb55f5118c191cf /org.eclipse.mylyn.tasks.ui
parentbe3f7f6ab9e002af2321a0c1858251ba98df0441 (diff)
downloadorg.eclipse.mylyn.tasks-23c8cbf0c6d069ce144d0844eb6071420662b796.tar.gz
org.eclipse.mylyn.tasks-23c8cbf0c6d069ce144d0844eb6071420662b796.tar.xz
org.eclipse.mylyn.tasks-23c8cbf0c6d069ce144d0844eb6071420662b796.zip
Progress on Bugzilla Bug 103099
decouple tasks from mylar.ui
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF9
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-complete.gifbin0 -> 131 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-priority.gifbin0 -> 190 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category-new.gifbin0 -> 343 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gifbin0 -> 349 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gifbin0 -> 332 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category.gifbin0 -> 213 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/color-palette.gifbin0 -> 252 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gifbin0 -> 179 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gifbin0 -> 359 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gifbin0 -> 362 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gifbin0 -> 340 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-complete.gifbin0 -> 343 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gifbin0 -> 66 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-incomplete.gifbin0 -> 148 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-new.gifbin0 -> 340 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task.gifbin0 -> 218 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java95
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java164
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java490
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java112
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java56
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java87
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java131
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaContentProvider.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaEditingMonitor.java46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java142
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReferencesProvider.java142
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java184
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java278
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/StackTrace.java375
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java226
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java138
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearch.java148
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java109
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java526
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java182
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaNodeLabelProvider.java67
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaUiBridge.java141
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java291
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditorInput.java135
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java18
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaQueryCategoryAction.java71
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaTaskAction.java76
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/FilterCompletedTasksAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskIncompleteAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MoveTaskToRootAction.java42
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java110
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaAction.java73
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaReportsAction.java149
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/TaskActivateAction.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java225
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java131
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java490
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java208
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/ITaskListExternalizer.java53
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java591
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java712
69 files changed, 1484 insertions, 5991 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index 876d5c37d..cfa825a52 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -17,18 +17,13 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.ui,
org.eclipse.pde.ui,
org.eclipse.mylar.core,
- org.eclipse.mylar.ui,
- org.eclipse.jdt.core,
- org.eclipse.mylar.bugzilla.core,
- org.eclipse.mylar.bugzilla.ui
+ org.eclipse.jdt.core
Eclipse-AutoStart: true
Bundle-Vendor: University of British Columbia
Bundle-ClassPath: mylar-tasklist.jar
Export-Package: org.eclipse.mylar.tasks,
- org.eclipse.mylar.tasks.bugzilla,
- org.eclipse.mylar.tasks.bugzilla.search,
- org.eclipse.mylar.tasks.bugzilla.ui,
org.eclipse.mylar.tasks.ui,
org.eclipse.mylar.tasks.ui.actions,
+ org.eclipse.mylar.tasks.ui.preferences,
org.eclipse.mylar.tasks.ui.views,
org.eclipse.mylar.tasks.util
diff --git a/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-complete.gif b/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-complete.gif
new file mode 100644
index 000000000..13ac9f725
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-complete.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-priority.gif b/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-priority.gif
new file mode 100644
index 000000000..55816a55a
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/elcl16/filter-priority.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-new.gif
new file mode 100644
index 000000000..d3f43d977
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-new.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif
new file mode 100644
index 000000000..09fcacad3
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif
new file mode 100644
index 000000000..94e7d5d1c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category.gif
new file mode 100644
index 000000000..7efb86ec1
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/category.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/color-palette.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/color-palette.gif
new file mode 100644
index 000000000..4c9452786
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/color-palette.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif
new file mode 100644
index 000000000..758e83e64
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif
new file mode 100644
index 000000000..04f3028c2
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif
new file mode 100644
index 000000000..bb8538b39
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif
new file mode 100644
index 000000000..f2d2f3762
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-complete.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-complete.gif
new file mode 100644
index 000000000..9cacb96dc
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-complete.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif
new file mode 100644
index 000000000..443eab400
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-incomplete.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-incomplete.gif
new file mode 100644
index 000000000..f6b9f8a59
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-incomplete.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-new.gif
new file mode 100644
index 000000000..8ce54634b
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-new.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif
new file mode 100644
index 000000000..9881d3872
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index bf7a1eedf..35d52a32b 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -2,11 +2,12 @@
<?eclipse version="3.0"?>
<plugin>
+<!--
<extension
name="Mylar Tasks startup"
point="org.eclipse.ui.startup">
</extension>
-
+-->
<extension point="org.eclipse.ui.views">
<view name="Mylar Task List"
@@ -22,11 +23,6 @@
class="org.eclipse.mylar.tasks.ui.TaskEditor"
name="Task Viewer"
id="org.eclipse.mylar.tasks.ui.taskEditor"/>
- <editor
- icon="icons/eview16/task-bug.gif"
- name="Bugzilla task viewer"
- class="org.eclipse.mylar.tasks.ui.BugzillaTaskEditor"
- id="org.eclipse.mylar.tasks.ui.bugzillaTaskEditor"/>
</extension>
<extension point="org.eclipse.ui.commands">
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java
deleted file mode 100644
index 2e7a28de4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks;
-
-import org.eclipse.mylar.bugzilla.core.BugzillaImages;
-import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Ken Sueda
- */
-public class BugzillaHit implements ITaskListElement {
-
- private String description;
- private String priority;
- private int id;
- private BugzillaTask task;
-
- public BugzillaHit(String description, String priority, int id, BugzillaTask task) {
- this.description = description;
- this.priority = priority;
- this.id = id;
- this.task = task;
- }
-
- public boolean isTask(){
- return task != null;
- }
-
- public BugzillaTask getAssociatedTask(){
- return task;
- }
-
- public void setAssociatedTask(BugzillaTask task){
- this.task = task;
- }
-
- public Image getIcon() {
- if(isTask()){
- return task.getIcon();
- } else {
- return BugzillaImages.getImage(BugzillaImages.BUG);
- }
- }
-
- public Image getStatusIcon() {
- if (isTask()) {
- return task.getStatusIcon();
- } else {
- return MylarImages.getImage(MylarImages.TASK_INACTIVE);
- }
- }
-
- public String getPriority() {
- return priority;
- }
-
- public String getDescription(boolean label) {
- return description;
- }
-
- public String getHandle() {
- return getServerName()+"-"+getID();
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getServerName() {
- // TODO need the right server name - get from the handle
- return "Bugzilla";
- }
- public int getID() {
-
- return id;
- }
-
- public String getIDString() {
- Integer bugId = new Integer(this.id);
- return bugId.toString();
- }
-
- public String getBugUrl() {
- return BugzillaRepository.getBugUrl(id);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java
deleted file mode 100644
index 7a7259a0e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit;
-import org.eclipse.mylar.tasks.bugzilla.search.BugzillaCategorySearchOperation;
-import org.eclipse.mylar.tasks.bugzilla.search.BugzillaResultCollector;
-import org.eclipse.mylar.tasks.bugzilla.search.BugzillaCategorySearchOperation.ICategorySearchListener;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Shawn Minto
- */
-public class BugzillaQueryCategory extends AbstractCategory {
-
- private static final long serialVersionUID = 5517146402031743253L;
- private String url;
- private List<BugzillaHit> hits = new ArrayList<BugzillaHit>();
- private boolean hasBeenRefreshed = false;
-
- public class BugzillaQueryCategorySearchListener implements
- ICategorySearchListener {
-
- Map<Integer, BugzillaSearchHit> hits = new HashMap<Integer, BugzillaSearchHit>();
-
- public void searchCompleted(BugzillaResultCollector collector) {
- for(BugzillaSearchHit hit: collector.getResults()){
-
- // HACK need the server name and handle properly
- addHit(new BugzillaHit(hit.getId() + ": " + hit.getDescription(), hit.getPriority(), hit.getId(), null));
- }
- }
-
- }
-
- private ICategorySearchListener listener = new BugzillaQueryCategorySearchListener();
-
- public BugzillaQueryCategory(String label, String url) {
- super(label);
- this.url = url;
- }
-
- public String getDescription(boolean label) {
- if (hits.size() > 0 || !label) {
- return super.getDescription(label);
- } else if (!hasBeenRefreshed) {
- return super.getDescription(label) + " <needs refresh>";
- } else {
- return super.getDescription(label) + " <no hits>";
- }
- }
-
-
- public Image getIcon() {
- return MylarImages.getImage(MylarImages.CATEGORY_QUERY);
- }
-
- public String getUrl() {
- return url;
- }
-
- public List<BugzillaHit> getHits() {
- return hits;
- }
-
- public void addHit(BugzillaHit hit) {
- BugzillaTask task = MylarTasksPlugin.getTaskListManager().getTaskList().getFromBugzillaTaskRegistry(hit.getHandle());
- hit.setAssociatedTask(task);
- hits.add(hit);
- }
-
- public void removeHit(BugzillaHit hit) {
- hits.remove(hit);
- }
-
- public void refreshBugs() {
- hits.clear();
- final BugzillaCategorySearchOperation catSearch = new BugzillaCategorySearchOperation(
- getUrl());
- catSearch.addResultsListener(listener);
- final IStatus[] status = new IStatus[1];
-
- try {
- // execute the search operation
- catSearch.execute(new NullProgressMonitor());
- hasBeenRefreshed = true;
-
- // get the status of the search operation
- status[0] = catSearch.getStatus();
-
- // determine if there was an error, if it was cancelled, or if it is
- // ok
- if (status[0].getCode() == IStatus.CANCEL) {
- // it was cancelled, so just return
- status[0] = Status.OK_STATUS;
- // return status[0];
- return;
- } else if (!status[0].isOK()) {
- // there was an error, so display an error message
- PlatformUI.getWorkbench().getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- ErrorDialog.openError(null,
- "Bugzilla Search Error", null,
- status[0]);
- }
- });
- status[0] = Status.OK_STATUS;
- return;
- // return status[0];
- }
- } catch (LoginException e) {
- // we had a problem while searching that seems like a login info
- // problem
- // thrown in BugzillaSearchOperation
- MessageDialog
- .openError(
- null,
- "Login Error",
- "Bugzilla could not log you in to get the information you requested since login name or password is incorrect.\nPlease check your settings in the bugzilla preferences. ");
- BugzillaPlugin.log(new Status(IStatus.ERROR,
- IBugzillaConstants.PLUGIN_ID, IStatus.OK, "", e));
- }
- return;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getPriority() {
- String highestPriority = "P5";
- for (BugzillaHit hit : hits) {
- if (highestPriority.compareTo(hit.getPriority()) > 0) {
- highestPriority = hit.getPriority();
- }
- }
- return highestPriority;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java
deleted file mode 100644
index f0fac7247..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on 14-Jan-2005
- */
-package org.eclipse.mylar.tasks;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
-import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
-import org.eclipse.mylar.bugzilla.core.offline.OfflineReportsFile;
-import org.eclipse.mylar.bugzilla.ui.OfflineView;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
-
-
-/**
- * @author Mik Kersten
- */
-public class BugzillaTask extends Task {
-
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3257007648544469815L;
-
- public static final String FILE_EXTENSION = ".bug_reports";
-
- public enum BugTaskState {FREE, WAITING, DOWNLOADING, COMPARING, OPENING}
- private transient BugTaskState state;
-
- /**
- * The bug report for this BugzillaTask. This is <code>null</code> if the
- * bug report with the specified ID was unable to download.
- */
- protected transient BugReport bugReport = null;
-
- /**
- * Value is <code>true</code> if the bug report has saved changes that
- * need synchronizing with the Bugzilla server.
- */
- private boolean isDirty;
-
- /** The last time this task's bug report was downloaded from the server. */
- protected Date lastRefresh;
-
- public static final ISchedulingRule rule = new ISchedulingRule() {
- public boolean isConflicting(ISchedulingRule schedulingRule) {
- return schedulingRule == this;
- }
- public boolean contains(ISchedulingRule schedulingRule) {
- return schedulingRule == this;
- }
- };
-
- public BugzillaTask(String id, String label) {
- super(id, label);
- isDirty = false;
- GetBugReportJob job = new GetBugReportJob("Downloading from Bugzilla server...");
- job.schedule();
- }
-
- public BugzillaTask(String id, String label, boolean noDownload) {
- super(id, label);
- isDirty = false;
- if (!noDownload) {
- GetBugReportJob job = new GetBugReportJob("Downloading from Bugzilla server...");
- job.schedule();
- }
- }
-
- public BugzillaTask(BugzillaHit hit) {
- this(hit.getHandle(), hit.getDescription(false));
- }
-
- @Override
- public String getLabel() {
- return MylarTasksPlugin.getDefault().getBugzillaProvider().getBugzillaDescription(this);
- }
-
- /**
- * @return Returns the bugReport.
- */
- public BugReport getBugReport() {
- return bugReport;
- }
-
- /**
- * @param bugReport The bugReport to set.
- */
- public void setBugReport(BugReport bugReport) {
- this.bugReport = bugReport;
- }
-
- /**
- * @return Returns the serialVersionUID.
- */
- public static long getSerialVersionUID() {
- return serialVersionUID;
- }
- /**
- * @return Returns the lastRefresh.
- */
- public Date getLastRefresh() {
- return lastRefresh;
- }
- /**
- * @param lastRefresh The lastRefresh to set.
- */
- public void setLastRefresh(Date lastRefresh) {
- this.lastRefresh = lastRefresh;
- }
- /**
- * @param state The state to set.
- */
- public void setState(BugTaskState state) {
- this.state = state;
- }
- /**
- * @return Returns <code>true</code> if the bug report has saved changes
- * that need synchronizing with the Bugzilla server.
- */
- public boolean isDirty() {
- return isDirty;
- }
-
- /**
- * @param isDirty The isDirty to set.
- */
- public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
- notifyTaskDataChange();
- }
-
- /**
- * @return Returns the state of the Bugzilla task.
- */
- public BugTaskState getState() {
- return state;
- }
-
- /**
- * Try to download the bug from the server.
- * @param bugId The ID of the bug report to download.
- *
- * @return The bug report, or <code>null</code> if it was unsuccessfully
- * downloaded.
- */
- public BugReport downloadReport() {
-// BugzillaTaskEditorInput input = new BugzillaTaskEditorInput(this);
- try {
- // XXX make sure to send in the server name if there are multiple repositories
- return BugzillaRepository.getInstance().getBug(getBugId(getHandle()));
- } catch (LoginException e) {
- MylarPlugin.log(e, "download failed");
- } catch (IOException e) {
- MylarPlugin.log(e, "download failed");
- }
- return null;
- }
-
- @Override
- public void openTaskInEditor(){
- openTask(-1);
- }
-
- /**
- * Opens this task's bug report in an editor revealing the selected comment.
- * @param commentNumber The comment number to reveal
- */
- public void openTask(int commentNumber) {
- if (state != BugTaskState.FREE) {
- return;
- }
-
- state = BugTaskState.OPENING;
- notifyTaskDataChange();
- OpenBugTaskJob job = new OpenBugTaskJob("Opening Bugzilla task in editor...", this);
- job.schedule();
- job.addJobChangeListener(new IJobChangeListener(){
-
- public void aboutToRun(IJobChangeEvent event) {
- // don't care about this event
- }
-
- public void awake(IJobChangeEvent event) {
- // don't care about this event
- }
-
- public void done(IJobChangeEvent event) {
- state = BugTaskState.FREE;
- notifyTaskDataChange();
- }
-
- public void running(IJobChangeEvent event) {
- // don't care about this event
- }
-
- public void scheduled(IJobChangeEvent event) {
- // don't care about this event
- }
-
- public void sleeping(IJobChangeEvent event) {
- // don't care about this event
- }
- });
- }
-
- /**
- * @return <code>true</code> if the bug report for this BugzillaTask was
- * successfully downloaded.
- */
- public boolean isBugDownloaded() {
- return bugReport != null;
- }
-
- @Override
- public String toString() {
- return "bugzilla report id: " + getHandle();
- }
-
- protected void openTaskEditor(final IEditorInput input) {
- if (isBugDownloaded()) {
-
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
- public void run() {
- // get the active workbench page
- IWorkbenchPage page = MylarTasksPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
- // if we couldn't get the page, get out of here
- if (page == null)
- return;
-
- try {
- // try to open an editor on the input bug
- //page.openEditor(input, IBugzillaConstants.EXISTING_BUG_EDITOR_ID);
- page.openEditor(input, "org.eclipse.mylar.tasks.ui.bugzillaTaskEditor");
- }
- catch (PartInitException ex) {
- MylarPlugin.log(ex, "couldn't open");
- return;
- }
- }
- });
- }
- else {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Could not open bug.", "Bug #" + getHandle()
- + " could not be read from the server. Try refreshing the bug task.");
- }
- });
- }
- }
-
- /**
- * @return Returns the last time this task's bug report was downloaded from
- * the server.
- */
- public Date getLastRefreshTime() {
- return lastRefresh;
- }
-
- /**
- * @return The number of seconds ago that this task's bug report was
- * downloaded from the server.
- */
- public long getTimeSinceLastRefresh() {
- Date timeNow = new Date();
- return (timeNow.getTime() - lastRefresh.getTime())/1000;
- }
-
- private class GetBugReportJob extends Job {
- public GetBugReportJob(String name) {
- super(name);
- setRule(rule);
- state = BugTaskState.WAITING;
- notifyTaskDataChange();
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- state = BugTaskState.DOWNLOADING;
- notifyTaskDataChange();
- // Update time this bugtask was last downloaded.
- lastRefresh = new Date();
- bugReport = downloadReport();
- state = BugTaskState.FREE;
- updateTaskDetails();
- notifyTaskDataChange();
- saveBugReport(true);
- return new Status(IStatus.OK, MylarPlugin.IDENTIFIER, IStatus.OK, "", null);
- }
- }
-
- public void updateTaskDetails() {
- try {
- setPriority(bugReport.getAttribute("Priority").getValue());
- String status = bugReport.getAttribute("Status").getValue();
- if (status.equals("RESOLVED")) {
- setCompleted(true);
- }
- } catch (NullPointerException npe) {
- // TODO: handle this better
- }
- }
-
- private class OpenBugTaskJob extends Job {
-
- protected BugzillaTask bugTask;
-
- public OpenBugTaskJob(String name, BugzillaTask bugTask) {
- super(name);
- this.bugTask = bugTask;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try{
- final IEditorInput input = new BugzillaTaskEditorInput(bugTask);
- state = BugTaskState.OPENING;
- notifyTaskDataChange();
- openTaskEditor(input);
-
- state = BugTaskState.FREE;
- notifyTaskDataChange();
- return new Status(IStatus.OK, MylarPlugin.IDENTIFIER, IStatus.OK, "", null);
- }catch(Exception e){
- MylarPlugin.log(e, "couldn't open");
- }
- return Status.CANCEL_STATUS;
- }
- }
-
- /**
- * Refreshes the bug report with the Bugzilla server.
- */
- public void refresh() {
- // The bug report must be untouched, and this task must not be busy.
- if (isDirty() || (state != BugTaskState.FREE)) {
- return;
- }
- GetBugReportJob job = new GetBugReportJob("Refreshing with Bugzilla server...");
- job.schedule();
- }
-
- @Override
- public String getToolTipText() {
- if(lastRefresh == null)
- return "";
- // Get the current time.
- Date timeNow = new Date();
-
- // Get the number of minutes between the current time
- // and the last time the bug report was downloaded
- long timeDifference = (timeNow.getTime() - lastRefresh.getTime())/60000;
-
- // Calculate the number of minutes and hours.
- // The amount left in "timeDifference" is the
- // days' difference.
- long minutes = timeDifference % 60;
- timeDifference /= 60;
- long hours = timeDifference % 24;
- timeDifference /= 24;
-
- // Gradually generate the tooltip string...
- String toolTip;
- if (bugReport == null) {
- toolTip = "Last attempted download ";
- }
- else {
- toolTip = "Last downloaded ";
- }
-
- if (timeDifference > 0) {
- toolTip += timeDifference + ((timeDifference == 1) ? " day " : " days ");
- }
- if (hours > 0 || timeDifference > 0) {
- toolTip += hours + ((hours == 1) ? " hour " : " hours ");
- }
- toolTip += minutes + ((minutes == 1) ? " minute " : " minutes ") + "ago";
-
- return toolTip;
- }
-
- public boolean readBugReport() {
- // XXX server name needs to be with the bug report
- int location = BugzillaPlugin.getDefault().getOfflineReports().find(getBugId(getHandle()));
- if(location == -1){
- bugReport = null;
- return true;
- }
- bugReport = (BugReport)BugzillaPlugin.getDefault().getOfflineReports().elements().get(location);
- return true;
- }
-
- public void saveBugReport(boolean refresh) {
- if(bugReport == null)
- return;
-
- // XXX use the server name for multiple repositories
- OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports();
- int location = offlineReports.find(getBugId(getHandle()));
- if(location != -1){
- IBugzillaBug tmpBugReport = offlineReports.elements().get(location);
- List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1);
- l.add(tmpBugReport);
- offlineReports.remove(l);
- }
- offlineReports.add(bugReport);
-
- final IWorkbench workbench = PlatformUI.getWorkbench();
- if (refresh && !workbench.getDisplay().isDisposed()) {
- workbench.getDisplay().asyncExec(new Runnable() {
- public void run() {
- OfflineView.refresh();
- }
- });
- }
- }
-
- public void removeReport() {
- OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports();
- int location = offlineReports.find(getBugId(getHandle()));
- if(location != -1){
- IBugzillaBug tmpBugReport = offlineReports.elements().get(location);
- List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1);
- l.add(tmpBugReport);
- offlineReports.remove(l);
- }
- }
-
- public static String getServerName(String handle) {
- int index = handle.lastIndexOf('-');
- if(index != -1){
- return handle.substring(0, index);
- }
- return null;
- }
-
- public static int getBugId(String handle) {
- int index = handle.lastIndexOf('-');
- if(index != -1){
- String id = handle.substring(index+1);
- return Integer.parseInt(id);
- }
- return -1;
- }
-
- public Image getIcon() {
- return MylarImages.getImage(MylarImages.TASK_BUGZILLA);
- }
-
- public String getBugUrl() {
- return BugzillaRepository.getBugUrl(getBugId(handle));
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java
index 91ba7e260..7a19b201c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java
@@ -85,6 +85,10 @@ public interface ITask extends Serializable {
public abstract String getPriority();
+ public abstract boolean canEditDescription();
+
+ public abstract String getDeleteConfirmationMessage();
+
public abstract void setPriority(String priority);
@Deprecated
public abstract boolean isCategory();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java
index 0c4cdb164..a51dae414 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java
@@ -19,18 +19,13 @@ import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaContentProvider;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaEditingMonitor;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaMylarBridge;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaReferencesProvider;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaStructureBridge;
-import org.eclipse.mylar.tasks.bugzilla.ui.BugzillaUiBridge;
-import org.eclipse.mylar.ui.MylarUiPlugin;
+import org.eclipse.mylar.tasks.util.TaskListExternalizer;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -39,11 +34,15 @@ import org.osgi.framework.BundleContext;
/**
* @author Mik Kersten
*/
-public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
+public class MylarTasksPlugin extends AbstractUIPlugin {
private static MylarTasksPlugin plugin;
private static TaskListManager taskListManager;
- private BugzillaContentProvider bugzillaProvider;
+ private TaskListExternalizer externalizer;
+
+ // TODO: remove hard-coded fonts
+ public static final Font BOLD = new Font(null, "Tahoma", 8, SWT.BOLD);
+ public static final Font ITALIC = new Font(null, "Tahoma", 8, SWT.ITALIC);
public static final String REFRESH_QUERIES = "org.eclipse.mylar.tasks.queries.refresh";
public static final String REPORT_OPEN_EDITOR = "org.eclipse.mylar.tasks.report.open.editor";
@@ -94,12 +93,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
}
}
- /** The bridge between Bugzilla and mylar */
- private static BugzillaMylarBridge bridge = null;
- private BugzillaStructureBridge structureBridge;
-
- private static BugzillaReferencesProvider referencesProvider = new BugzillaReferencesProvider();
private static ITaskActivityListener TASK_LIST_LISTENER = new ITaskActivityListener() {
@@ -158,7 +152,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
getTaskListManager().updateTaskscapeReference(prevDir);
String path = MylarPlugin.getDefault().getUserDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
- getTaskListManager().setFile(new File(path));
+ getTaskListManager().setTaskListFile(new File(path));
}
} else {
}
@@ -168,43 +162,40 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
public MylarTasksPlugin() {
super();
plugin = this;
- initializeDefaultPreferences(getPrefs());
}
-
- public void earlyStartup() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- workbench.getDisplay().asyncExec(new Runnable() {
- public void run() {
-
- structureBridge = new BugzillaStructureBridge();
-
- MylarPlugin.getDefault().addBridge(structureBridge);
- MylarPlugin.getTaskscapeManager().addListener(referencesProvider);
- MylarUiPlugin.getDefault().addAdapter(BugzillaStructureBridge.EXTENSION, new BugzillaUiBridge());
- MylarPlugin.getDefault().getSelectionMonitors().add(new BugzillaEditingMonitor());
-
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
- MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
-
- if (window != null) {
- // create a new bridge and initialize it
- bridge = new BugzillaMylarBridge();
- }
- }
- });
- }
+// /**
+// * TODO: consider making a non early startup plug-in
+// */
+// public void earlyStartup() {
+// final IWorkbench workbench = PlatformUI.getWorkbench();
+// workbench.getDisplay().asyncExec(new Runnable() {
+// public void run() {
+//
+// }
+// });
+// }
+
@Override
public void start(BundleContext context) throws Exception {
- bugzillaProvider = new BugzillaContentProvider();
+ initializeDefaultPreferences(getPrefs());
+ externalizer = new TaskListExternalizer();
+
String path = MylarPlugin.getDefault().getUserDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
File taskListFile = new File(path);
taskListManager = new TaskListManager(taskListFile);
taskListManager.addListener(TASK_LIST_LISTENER);
taskListManager.readTaskList();
if (taskListManager.getTaskList() == null) taskListManager.createNewTaskList();
+
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
+ MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
+
+ }
+ });
super.start(context);
}
@@ -225,19 +216,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
store.setDefault(REPORT_OPEN_INTERNAL, true);
store.setDefault(REPORT_OPEN_EXTERNAL, false);
}
- /**
- * Get the bridge for this plugin
- *
- * @return The bugzilla mylar bridge
- */
- public static BugzillaMylarBridge getBridge() {
- // make sure that the bridge initialized, if not, make a new one
- if (bridge == null) {
- bridge = new BugzillaMylarBridge();
- }
- return bridge;
- }
-
+
public static TaskListManager getTaskListManager() {
return taskListManager;
@@ -275,23 +254,6 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
}
return resourceBundle;
}
-
- public BugzillaContentProvider getBugzillaProvider() {
- return bugzillaProvider;
- }
-
- public void setBugzillaProvider(BugzillaContentProvider bugzillaProvider) {
- this.bugzillaProvider = bugzillaProvider;
- }
-
- public BugzillaStructureBridge getStructureBridge() {
- return structureBridge;
- }
-
- public static BugzillaReferencesProvider getReferenceProvider() {
- return referencesProvider;
-
- }
public static IPreferenceStore getPrefs() {
return MylarPlugin.getDefault().getPreferenceStore();
@@ -345,4 +307,8 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup {
return Report_Open_Mode.EXTERNAL_BROWSER;
}
}
+
+ public TaskListExternalizer getTaskListExternalizer() {
+ return externalizer;
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java
index 79c4e3692..a2a0a0d26 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java
@@ -20,7 +20,6 @@ import java.util.List;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchPage;
@@ -175,6 +174,8 @@ public class Task implements ITask, ITaskListElement {
/**
* Refreshes the tasklist viewer.
+ *
+ * TODO: shouldn't be coupled to the TaskListView
*/
public void notifyTaskDataChange() {
final Task task = this;
@@ -305,7 +306,7 @@ public class Task implements ITask, ITaskListElement {
}
public Image getIcon() {
- return MylarImages.getImage(MylarImages.TASK);
+ return TaskListImages.getImage(TaskListImages.TASK);
}
public String getDescription(boolean label) {
@@ -314,9 +315,9 @@ public class Task implements ITask, ITaskListElement {
public Image getStatusIcon() {
if (isActive()) {
- return MylarImages.getImage(MylarImages.TASK_ACTIVE);
+ return TaskListImages.getImage(TaskListImages.TASK_ACTIVE);
} else {
- return MylarImages.getImage(MylarImages.TASK_INACTIVE);
+ return TaskListImages.getImage(TaskListImages.TASK_INACTIVE);
}
}
@@ -376,4 +377,12 @@ public class Task implements ITask, ITaskListElement {
return sec;
}
}
+
+ public boolean canEditDescription() {
+ return true;
+ }
+
+ public String getDeleteConfirmationMessage() {
+ return "Delete the selected task and discard task context?";
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java
index 50f69f9c1..a21d259fc 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java
@@ -17,7 +17,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.swt.graphics.Image;
@@ -35,7 +34,7 @@ public class TaskCategory extends AbstractCategory implements Serializable {
}
public Image getIcon() {
- return MylarImages.getImage(MylarImages.CATEGORY);
+ return TaskListImages.getImage(TaskListImages.CATEGORY);
}
@@ -50,16 +49,7 @@ public class TaskCategory extends AbstractCategory implements Serializable {
}
public void addTask(ITask task) {
- if(task instanceof BugzillaTask){
- BugzillaTask bugTask = MylarTasksPlugin.getTaskListManager().getTaskList().getFromBugzillaTaskRegistry(task.getHandle());
- if(bugTask == null){
- MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry((BugzillaTask)task);
- } else {
- task = bugTask;
- }
- }
tasks.add(task);
-
}
public void removeTask(ITask task) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
index 538712413..604d9050c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
@@ -15,9 +15,7 @@ package org.eclipse.mylar.tasks;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
@@ -31,35 +29,19 @@ public class TaskList implements Serializable {
private List<AbstractCategory> categories = new ArrayList<AbstractCategory>();
private transient List<ITask> activeTasks = new ArrayList<ITask>();
- // XXX we never delete anything from this registry
- private Map<String, BugzillaTask> bugzillaTaskRegistry = new HashMap<String, BugzillaTask>();
-
- public void addToBugzillaTaskRegistry(BugzillaTask task){
- if(bugzillaTaskRegistry.get(task.getHandle()) == null){
- bugzillaTaskRegistry.put(task.getHandle(), task);
- }
- }
-
- public BugzillaTask getFromBugzillaTaskRegistry(String handle){
- return bugzillaTaskRegistry.get(handle);
- }
-
- public Map<String, BugzillaTask> getBugzillaTaskRegistry(){
- return bugzillaTaskRegistry;
- }
-
public void addRootTask(ITask task) {
- if(task instanceof BugzillaTask){
- BugzillaTask bugTask = bugzillaTaskRegistry.get(task.getHandle());
- if(bugTask == null){
- bugzillaTaskRegistry.put(task.getHandle(), (BugzillaTask)task);
- rootTasks.add(task);
- } else {
- rootTasks.add(bugTask);
- }
- } else {
+ // XXX refactored
+// if(task instanceof BugzillaTask){
+// BugzillaTask bugTask = bugzillaTaskRegistry.get(task.getHandle());
+// if(bugTask == null){
+// bugzillaTaskRegistry.put(task.getHandle(), (BugzillaTask)task);
+// rootTasks.add(task);
+// } else {
+// rootTasks.add(bugTask);
+// }
+// } else {
rootTasks.add(task);
- }
+// }
}
public void addCategory(AbstractCategory cat) {
@@ -76,9 +58,10 @@ public class TaskList implements Serializable {
}
public void deleteTask(ITask task) {
- if (task instanceof BugzillaTask) {
- ((BugzillaTask)task).removeReport();
- }
+ // XXX refactored
+// if (task instanceof BugzillaTask) {
+// ((BugzillaTask)task).removeReport();
+// }
boolean deleted = deleteTaskHelper(rootTasks, task);
if (!deleted) {
for (TaskCategory cat : getTaskCategories()) {
@@ -157,11 +140,12 @@ public class TaskList implements Serializable {
int ihandle = 0;
int max = 0;
for (ITask t : tasks) {
- if (t instanceof BugzillaTask) {
- ihandle = 0;
- } else {
+ // XXX refactored
+// if (t instanceof BugzillaTask) {
+// ihandle = 0;
+// } else {
ihandle = Integer.parseInt(t.getHandle().substring(t.getHandle().indexOf('-')+1, t.getHandle().length()));
- }
+// }
max = Math.max(ihandle, max);
ihandle = largestTaskHandleHelper(t.getChildren());
max = Math.max(ihandle, max);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java
new file mode 100644
index 000000000..2f91b0bcc
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 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
+ *******************************************************************************/
+/*
+ * Created on Apr 20, 2004
+ */
+package org.eclipse.mylar.tasks;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Mik Kersten
+ */
+public class TaskListImages {
+
+ private static Map<ImageDescriptor, Image> imageMap = new HashMap<ImageDescriptor, Image>();
+
+ private static final String T_ELCL = "elcl16";
+ private static final String T_TOOL = "etool16";
+ private static final URL baseURL = MylarTasksPlugin.getDefault().getBundle().getEntry("/icons/");
+
+ public static final ImageDescriptor REMOVE = create(T_ELCL, "remove.gif");
+ public static final ImageDescriptor ERASE_TASKSCAPE = create(T_ELCL, "context-clear.gif");
+
+ public static final ImageDescriptor FILTER_COMPLETE = create(T_ELCL, "filter-complete.gif");
+ public static final ImageDescriptor FILTER_PRIORITY = create(T_ELCL, "filter-priority.gif");
+
+ public static final ImageDescriptor COLOR_PALETTE = create(T_ELCL, "color-palette.gif");
+ public static final ImageDescriptor BUG = create(T_ELCL, "bug.gif");
+
+ public static final ImageDescriptor TASK_BUGZILLA = create(T_TOOL, "task-bug.gif");
+ public static final ImageDescriptor TASK_BUGZILLA_NEW = create(T_TOOL, "task-bug-new.gif");
+ public static final ImageDescriptor TASK = create(T_TOOL, "task.gif");
+ public static final ImageDescriptor TASK_NEW = create(T_TOOL, "task-new.gif");
+ public static final ImageDescriptor CATEGORY = create(T_TOOL, "category.gif");
+ public static final ImageDescriptor CATEGORY_NEW = create(T_TOOL, "category-new.gif");
+ public static final ImageDescriptor CATEGORY_QUERY = create(T_TOOL, "category-query.gif");
+ public static final ImageDescriptor CATEGORY_QUERY_NEW = create(T_TOOL, "category-query-new.gif");
+ public static final ImageDescriptor TASK_ACTIVE = create(T_TOOL, "task-active.gif");
+ public static final ImageDescriptor TASK_INACTIVE = create(T_TOOL, "task-inactive.gif");
+ public static final ImageDescriptor TASK_COMPLETE = create(T_TOOL, "task-complete.gif");
+ public static final ImageDescriptor TASK_INCOMPLETE = create(T_TOOL, "task-incomplete.gif");
+ public static final ImageDescriptor TASK_BUG_REFRESH = create(T_TOOL, "task-bug-refresh.gif");
+
+ private static ImageDescriptor create(String prefix, String name) {
+ try {
+ return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
+ } catch (MalformedURLException e) {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+ }
+
+ private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
+ if (baseURL == null)
+ throw new MalformedURLException();
+
+ StringBuffer buffer= new StringBuffer(prefix);
+ buffer.append('/');
+ buffer.append(name);
+ return new URL(baseURL, buffer.toString());
+ }
+
+ /**
+ * Lazily initializes image map.
+ */
+ public static Image getImage(ImageDescriptor imageDescriptor) {
+ Image image = imageMap.get(imageDescriptor);
+ if (image == null) {
+ image = imageDescriptor.createImage();
+ imageMap.put(imageDescriptor, image);
+ }
+ return image;
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java
index b1dd5f9b0..738a97255 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java
@@ -19,7 +19,6 @@ import java.util.List;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.util.RelativePathUtil;
-import org.eclipse.mylar.tasks.util.XmlUtil;
/**
@@ -27,14 +26,14 @@ import org.eclipse.mylar.tasks.util.XmlUtil;
*/
public class TaskListManager {
- private File file;
+ private File taskListFile;
private TaskList taskList = new TaskList();
private List<ITaskActivityListener> listeners = new ArrayList<ITaskActivityListener>();
private int nextTaskId;
public TaskListManager(File file) {
- this.file = file;
- if (MylarPlugin.getDefault().getPreferenceStore().contains(MylarTasksPlugin.TASK_ID)) { // TODO: fix to MylarTasksPlugin
+ this.taskListFile = file;
+ if (MylarPlugin.getDefault() != null && MylarPlugin.getDefault().getPreferenceStore().contains(MylarTasksPlugin.TASK_ID)) { // TODO: fix to MylarTasksPlugin
nextTaskId = MylarPlugin.getDefault().getPreferenceStore().getInt(MylarTasksPlugin.TASK_ID);
} else {
nextTaskId = 1;
@@ -51,8 +50,8 @@ public class TaskListManager {
public boolean readTaskList() {
try {
- if (file.exists()) {
- XmlUtil.readTaskList(taskList, file);
+ if (taskListFile.exists()) {
+ MylarTasksPlugin.getDefault().getTaskListExternalizer().readTaskList(taskList, taskListFile);
int maxHandle = taskList.findLargestTaskHandle();
if (maxHandle >= nextTaskId) {
nextTaskId = maxHandle + 1;
@@ -61,18 +60,17 @@ public class TaskListManager {
}
return true;
} catch (Exception e) {
- MylarPlugin.log(e, "task read failed");
+ MylarPlugin.log(e, "Could not read task list");
return false;
}
}
public void saveTaskList() {
try {
- XmlUtil.writeTaskList(taskList, file);
+ MylarTasksPlugin.getDefault().getTaskListExternalizer().writeTaskList(taskList, taskListFile);
MylarPlugin.getDefault().getPreferenceStore().setValue(MylarTasksPlugin.TASK_ID, nextTaskId);
} catch (Exception e) {
- e.printStackTrace(); // TODO: fix
-// MylarPlugin.fail(e, "Could not save task list", true);
+ MylarPlugin.fail(e, "Could not save task list", true);
}
}
@@ -150,14 +148,14 @@ public class TaskListManager {
// updateTaskscapeReferenceHelper(task.getChildren(), prevDir);
}
}
- public void setFile(File f) {
- if (this.file.exists()) {
- this.file.delete();
+ public void setTaskListFile(File f) {
+ if (this.taskListFile.exists()) {
+ this.taskListFile.delete();
}
- this.file = f;
- }
-
- public void activateHit(BugzillaHit hit) {
-
+ this.taskListFile = f;
}
+
+ public File getTaskListFile() {
+ return taskListFile;
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java
deleted file mode 100644
index 706e9ecf0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.bugzilla;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
-
-/**
- * COPIED FROM @see org.eclipse.mylar.bugzilla.offlineReports.OfflineReportsFile
- *
- * @author Shawn Minto
- */
-public class BugzillaCacheFile {
-
- private File file;
-
- private ArrayList<IBugzillaBug> list = new ArrayList<IBugzillaBug>();
-
- protected int latestNewBugId = 0;
-
- public BugzillaCacheFile(File file) throws ClassNotFoundException, IOException {
- this.file = file;
- if (file.exists()) {
- readFile();
- }
- }
-
- public void add(IBugzillaBug entry) {
- // add the entry to the list and write the file to disk
- list.add(entry);
- writeFile();
- }
-
- public void update() {
- writeFile();
- }
-
- public int getNextOfflineBugId() {
- latestNewBugId++;
- return latestNewBugId;
- }
-
- public int find(int id) {
- for (int i = 0; i < list.size(); i++) {
- IBugzillaBug currBug = list.get(i);
- if (currBug != null && (currBug.getId() == id) && !currBug.isLocallyCreated())
- return i;
- }
- return -1;
- }
-
- public ArrayList<IBugzillaBug> elements() {
- return list;
- }
-
- private void writeFile() {
- try {
- ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
-
- // Write the size of the list so that we can read it back in easier
- out.writeInt(list.size());
-
- out.writeInt(latestNewBugId);
-
- // write each element in the array list
- for (int i = 0; i < list.size(); i++) {
- Object item = list.get(i);
- out.writeObject(item);
- }
- out.close();
- }
- catch (IOException e) {
- // put up a message and log the error if there is a problem writing to the file
- MessageDialog.openError(null,
- "I/O Error",
- "Bugzilla could not write to offline reports file.");
- BugzillaPlugin.log(e);
- }
- }
-
- private void readFile() throws ClassNotFoundException, IOException {
- ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
-
- // get the number of offline reports in the file
- int size = in.readInt();
-
- // get the bug id of the most recently created offline report
- latestNewBugId = in.readInt();
-
- // read in each of the offline reports in the file
- for (int nX = 0; nX < size; nX++) {
- IBugzillaBug item = (IBugzillaBug) in.readObject();
- // add the offline report to the offlineReports list
- list.add(item);
- }
- in.close();
- }
-
- public void remove(List<IBugzillaBug> sel) {
- list.removeAll(sel);
-
- // rewrite the file so that the data is persistant
- writeFile();
- }
-
- public void removeAll() {
- list.clear();
-
- // rewrite the file so that the data is persistant
- writeFile();
- }
-}
-
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaContentProvider.java
deleted file mode 100644
index 83af0e16c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaContentProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Jan 13, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.tasks.BugzillaTask;
-
-
-/**
- * @author Mik Kersten
- * @author Eric Booth
- */
-public class BugzillaContentProvider {
-
- public BugzillaContentProvider() {
- // don't have any initialization to do
- }
-
- /**
- * @return String containing bug priority and label, e.g. "[12345] P2: fix failing test"
- */
- public String getBugzillaDescription(BugzillaTask bugTask) {
- if (bugTask == null) return "<no info>";
-
- String prefix = //((bugTask.isDirty()) ? ">" : "") +
- BugzillaTask.getBugId(bugTask.getHandle()) + ": ";
-
- if (bugTask.getState() == BugzillaTask.BugTaskState.DOWNLOADING) {
- return prefix + "<Downloading bug report from server...>";
- } else if (bugTask.getState() == BugzillaTask.BugTaskState.OPENING) {
- return prefix + "<Opening bug report in editor...>";
- } else if (bugTask.getState() == BugzillaTask.BugTaskState.COMPARING) {
- return prefix + "<Comparing bug report with server...>";
- } else if (bugTask.getState() == BugzillaTask.BugTaskState.WAITING) {
- return prefix + "<Waiting to check server...>";
- }
-
- // generate the label
- if (bugTask.isBugDownloaded()) {
- BugReport report = bugTask.getBugReport();
- return prefix + report.getSummary();
- }
- else {
- return prefix + "<Could not find bug>";
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaEditingMonitor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaEditingMonitor.java
deleted file mode 100644
index 8eadb4e55..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaEditingMonitor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Apr 27, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.bugzilla.ui.outline.BugzillaReportSelection;
-import org.eclipse.mylar.core.AbstractSelectionMonitor;
-import org.eclipse.mylar.tasks.ui.BugzillaTaskEditor;
-import org.eclipse.ui.IWorkbenchPart;
-
-
-/**
- * @author Mik Kersten
- */
-public class BugzillaEditingMonitor extends AbstractSelectionMonitor {
-
- public BugzillaEditingMonitor() {
- super();
- }
-
- @Override
- protected void handleWorkbenchPartSelection(IWorkbenchPart part, ISelection selection) {
- if(!(part instanceof AbstractBugEditor) && !(part instanceof BugzillaTaskEditor))
- return;
-
- if(selection instanceof StructuredSelection){
- StructuredSelection ss = (StructuredSelection)selection;
- Object object = ss.getFirstElement();
- if(object instanceof BugzillaReportSelection) super.handleElementSelection(part, object);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java
deleted file mode 100644
index 6dc4033b9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 1, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-
-
-/**
- * Class to handle the bridge between mylar and bugzilla
- *
- * @author Shawn Minto
- */
-public class BugzillaMylarBridge {
-
- /** The hash of all of the landmarks and their related search hits */
- private HashMap<String, Map<Integer, List<BugzillaReportNode>>> landmarksHash;
- /**
- * The currently running search jobs so that we can cancel it if necessary <br> KEY: IMember VALUE: Job
- */
- public static HashMap<String, Job> runningJobs = new HashMap<String, Job>();
-
- /**
- * Constructor
- */
- public BugzillaMylarBridge() {
- landmarksHash = new HashMap<String, Map<Integer, List<BugzillaReportNode>>>();
- }
-
-
- /**
- * Remove a landmark from the hash
- *
- * @param removed
- * This landmark to remove (IJavaElement)
- */
- public void removeFromLandmarksHash(IJavaElement removed) {
- landmarksHash.remove(removed.getHandleIdentifier());
- }
-
- /**
- * Remove all of the landmarks from the hash that are in the list
- *
- * @param removed
- * This list of landmarks to remove (IJavaElements)
- */
- public void removeFromLandmarksHash(List<IJavaElement> removed) {
-
- for(IJavaElement je : removed) {
- landmarksHash.remove(je.getHandleIdentifier());
- }
- }
-
- /**
- * Add data to the landmarks hash
- *
- * @param doiList
- * The list of BugzillaSearchHitDoiInfo
- * @param m
- * The member that this list is for
- */
- public void addToLandmarksHash(List<BugzillaReportNode> doiList, IMember m, int scope) {
- Map<Integer, List<BugzillaReportNode>> searches = landmarksHash.get(m.getHandleIdentifier());
-
- if(searches == null){
- searches = new HashMap<Integer, List<BugzillaReportNode>>();
- }
- searches.put(scope, doiList);
- landmarksHash.put(m.getHandleIdentifier(), searches);
- }
-
- /**
- * Get the doiList for the given IMember from the landmarks hash
- *
- * @param m
- * The member to get the doiList for
- * @return The doiList or null if it doesn't exist
- */
- public List<BugzillaReportNode> getFromLandmarksHash(IMember m, int scope) {
- Map<Integer, List<BugzillaReportNode>> scopes = landmarksHash.get(m.getHandleIdentifier());
- if(scopes == null)
- return null;
- else
- return scopes.get(scope);
- }
-
- /**
- * Determine whether the current element has a search job running for it
- *
- * @param e
- * The element that we want to know whether there is a search job
- * or not
- * @return <code>true</code> if it does else <code>false</code>
- */
- public static boolean doesJobExist(String handle) {
- return runningJobs.containsKey(handle);
- }
-
- /**
- * Remove search job for the given element
- *
- * @param m
- * The element that we want to make sure that the search is
- * canceled for
- */
- public static void removeSearchJob(String handle) {
-
- // make sure that there wasn't a previous search job that we know
- // of. If there was, cancel it
- if (doesJobExist(handle)) {
- // get the search job and wait until it is cancelled
- Job prevJob = runningJobs.get(handle);
- prevJob.cancel();
- runningJobs.remove(handle);
- }
- }
-
- /**
- * Add a search job to our list
- * @param handle The handle of the element that we are searching for
- * @param searchJob The job that represents the search
- */
- public static void addJob(String handle, Job searchJob) {
- runningJobs.put(handle, searchJob);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReferencesProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReferencesProvider.java
deleted file mode 100644
index 6b810f142..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReferencesProvider.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Feb 2, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.mylar.core.model.ITaskscapeNode;
-import org.eclipse.mylar.core.search.IActiveSearchListener;
-import org.eclipse.mylar.core.search.IMylarSearchOperation;
-import org.eclipse.mylar.core.search.RelationshipProvider;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.bugzilla.search.BugzillaMylarSearch;
-
-
-/**
- * @author Shawn Minto
- */
-public class BugzillaReferencesProvider extends RelationshipProvider {
-
- public static final String ID = "org.eclipse.mylar.bugzilla.search.references";
- public static final String NAME = "Bugilla report references";
-
- public BugzillaReferencesProvider() {
- super(BugzillaStructureBridge.EXTENSION, ID);
- }
-
- protected boolean acceptElement(IJavaElement javaElement) {
- return javaElement != null
- && (javaElement instanceof IMember || javaElement instanceof IType);
- }
-
- /**
- * HACK: checking kind as string - don't want the dependancy to mylar.java
- */
- @Override
- protected void findRelated(final ITaskscapeNode node, int degreeOfSeparation) {
- if (!node.getStructureKind().equals("java")) return;
- IJavaElement javaElement = JavaCore.create(node.getElementHandle());
- if (!acceptElement(javaElement)) {
- return;
- }
- runJob(node, degreeOfSeparation);
-
- //XXX what if degreeOfSeparation is 5?
- }
-
- @Override
- public IMylarSearchOperation getSearchOperation(ITaskscapeNode node, int limitTo, int degreeOfSepatation) {
- IJavaElement javaElement = JavaCore.create(node.getElementHandle());
- return new BugzillaMylarSearch(degreeOfSepatation, javaElement);
- }
-
- private void runJob(final ITaskscapeNode node, final int degreeOfSeparation) {
- BugzillaMylarSearch search = (BugzillaMylarSearch)getSearchOperation(node, 0, degreeOfSeparation);
-
- search.addListener(new IActiveSearchListener(){
-
- private boolean gathered = false;
-
- public void searchCompleted(List<?> nodes) {
- Iterator<?> itr = nodes.iterator();
-
- BugzillaStructureBridge bridge = MylarTasksPlugin.getDefault().getStructureBridge();
-
- while(itr.hasNext()) {
- Object o = itr.next();
- if(o instanceof BugzillaReportNode){
- BugzillaReportNode bugzillaNode = (BugzillaReportNode)o;
- String handle = bugzillaNode.getElementHandle();
- if(bridge.getCached(handle) == null)
- cache(handle, bugzillaNode);
- incrementInterest(degreeOfSeparation, BugzillaStructureBridge.EXTENSION, handle);
- }
- }
- gathered = true;
- }
-
- public boolean resultsGathered() {
- return gathered;
- }
-
- });
- search.run(new NullProgressMonitor());
- }
-
- @Override
- protected String getSourceId() {
- return ID;
- }
-
- @Override
- public String getName() {
- return NAME;
- }
-
- /*
- *
- * STUFF FOR TEMPORARILY CACHING A PROXY REPORT
- *
- * TODO remove the proxys and update the BugzillaStructureBridge cache so that on restart,
- * we dont have to get all of the bugs
- *
- */
- private static final Map<String, BugzillaReportNode> reports = new HashMap<String, BugzillaReportNode>();
-
- public BugzillaReportNode getCached(String handle){
- return reports.get(handle);
- }
-
- protected void cache(String handle, BugzillaReportNode bugzillaNode) {
- reports.put(handle, bugzillaNode);
- }
-
- public void clearCachedReports(){
- reports.clear();
- }
-
- public Collection<? extends String> getCachedHandles() {
- return reports.keySet();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java
deleted file mode 100644
index 9552f5f21..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 21, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit;
-
-
-/**
- * Class to store the DoiInfo of a BugzillaSearchHit
- *
- * @author Shawn Minto
- */
-public class BugzillaReportNode {
-
- private static final long serialVersionUID = 3257004367222419506L;
-
- /** The BugzillaSearchHit associated with this DoiInfo */
- private BugzillaSearchHit hit;
-
- /** Whether this search hit was from an exact search like a stack trace */
- private boolean isExact = false;
-
- /** List of all of the StackTrace's in the given bug */
- private List<StackTrace> stackTraces;
-
- /** The bug report associated with this DoiInfo */
- private BugReport bug;
-
- /**
- * Constructor
- *
- * @param initialValue
- * The initial Doi value
- * @param hit
- * The BugzillaSearchHit associated with this DoiInfo
- * @param isExact
- * Whether the search was exact or not
- */
- public BugzillaReportNode(float initialValue, BugzillaSearchHit hit,
- boolean isExact) {
- this.hit = hit;
- this.isExact = isExact;
- bug = null;
- stackTraces = new ArrayList<StackTrace>();
- }
-
- /**
- * Get the bugzilla search hit relating to this DoiInfo
- *
- * @return The BugzillaSearchHit related to this DoiInfo
- */
- public BugzillaSearchHit getHit() {
- return hit;
- }
-
- @Override
- public String toString() {
- return hit.toString();
- }
-
- /**
- * Determine if the search hit this represents is exact or not
- *
- * @return <code>true</code> if the search was exact otherwise
- * <code>false</code>
- */
- public boolean isExact() {
- return isExact;
- }
-
- /**
- * Set whether this bug has any exact elements in it - the search used was fully qualified
- *
- * @param isExact -
- * Whether there are any exact element matches in it
- */
- public void setExact(boolean isExact) {
- this.isExact = isExact;
- }
-
- /**
- * Get the bug report associated with this DoiInfo<br>
- * The bug is downloaded if it was not previously
- *
- * @return Returns the BugReport
- *
- * @throws IOException
- * @throws LoginException
- * @throws MalformedURLException
- */
- public BugReport getBug() throws MalformedURLException, LoginException, IOException {
- if(bug == null){
-
- // get the bug report
- bug = BugzillaRepository.getInstance().getBug(
- hit.getId());
- }
- return bug;
- }
-
- /**
- * Set the bug report associated with this DoiInfo
- *
- * @param bug -
- * BugReport that this is associated with
- */
- public void setBug(BugReport bug) {
- this.bug = bug;
- }
-
- /**
- * Get all of the stack traces contained in the bug
- *
- * @return Returns a list of StackTrace's
- */
- public List<StackTrace> getStackTraces() {
- return stackTraces;
- }
-
- /**
- * Determine whether the doi info has any stack traces associated with it
- * @return <code>true</code> if there are some stack traces else <code>false</code>
- */
- public boolean hasStackTraces(){
- return !stackTraces.isEmpty();
- }
-
- /**
- * Add a stack trace to this DoiInfo
- *
- * @param stackTrace -
- * The StackTrace to add
- */
- public void addStackTrace(StackTrace stackTrace) {
- this.stackTraces.add(stackTrace);
- }
-
- /**
- * Add an array of stack traces to this DoiInfo
- *
- * @param stackTracesToAdd -
- * The StackTraces to add
- */
- public void addStackTraces(StackTrace[] stackTracesToAdd) {
- for (int i = 0; i < stackTracesToAdd.length; i++)
- this.stackTraces.add(stackTracesToAdd[i]);
- }
-
- /**
- * Get the name of the bug report
- * @return The name of the bug report, max 20 characters
- */
- public String getName() {
- final int MAX_LENGTH = 100;
- String description = hit.getDescription();
- int length = description.length();
- if (length > MAX_LENGTH) description = description.substring(0, MAX_LENGTH) + "..";
- return "bug " + hit.getId() + ": " + description;
- }
-
- public String getElementHandle() {
- return hit.getServer() + ";" + hit.getId();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java
deleted file mode 100644
index 9301c8135..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on May 2, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
-import org.eclipse.mylar.bugzilla.core.BugzillaTools;
-import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit;
-import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.bugzilla.ui.outline.BugzillaOutlineNode;
-import org.eclipse.mylar.bugzilla.ui.outline.BugzillaReportSelection;
-import org.eclipse.mylar.core.IMylarStructureBridge;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.progress.IProgressService;
-import org.eclipse.ui.views.markers.internal.ProblemMarker;
-
-
-public class BugzillaStructureBridge implements IMylarStructureBridge {
-
- public final static String EXTENSION = "bugzilla";
-
- public String getResourceExtension() {
- return EXTENSION;
- }
-
- public BugzillaStructureBridge() {
- super();
- readCacheFile();
- }
-
- /**
- * Handle format: <server-name:port>;<bug-id>;<comment#>
- *
- * Use: BugzillaTools ???
- */
- public String getHandleIdentifier(Object object) {
- if(object instanceof BugzillaOutlineNode){
- BugzillaOutlineNode n = (BugzillaOutlineNode)object;
- return BugzillaTools.getHandle(n);
- }
- else if(object instanceof BugzillaReportSelection){
- BugzillaReportSelection n = (BugzillaReportSelection)object;
- return BugzillaTools.getHandle(n);
- }
- return null;
- }
-
- private BugReport result;
-
- public Object getObjectForHandle(final String handle) {
- result = null;
-
- String [] parts = handle.split(";");
- if (parts.length >= 2){
- String server = parts[0];
- final int id = Integer.parseInt(parts[1]);
-
- String bugHandle = server + ";" + id;
-
- int commentNumber = -1;
- if(parts.length == 3){
- commentNumber = Integer.parseInt(parts[2]);
- }
-
- // get the bugzillaOutlineNode for the element
- IEditorPart editorPart = null;
- try{
- editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- }catch(NullPointerException e){
- // do nothing, this just means that there is no active page
- }
- if(editorPart != null && editorPart instanceof AbstractBugEditor){
- AbstractBugEditor abe = ((AbstractBugEditor)editorPart);
- BugzillaOutlineNode node = abe.getModel();
- return findNode(node, commentNumber);
- }
-
- // try to get from the cache, if it doesn't exist, startup an operation to get it
- result = getFromCache(bugHandle);
- if(result == null){
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Downloading Bug# " + id, IProgressMonitor.UNKNOWN);
- try {
- result = BugzillaRepository.getInstance().getCurrentBug(id);
- }catch(Exception e){
- result = null;
- }
- }};
-
- // Use the progess service to execute the runnable
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- try {
- service.run(false, false, op);
- } catch (InvocationTargetException e) {
- // Operation was canceled
- } catch (InterruptedException e) {
- // Handle the wrapped exception
- }
-
- if(result != null)
- cache(bugHandle, result);
- }
-
- BugzillaOutlineNode node = BugzillaOutlineNode.parseBugReport(result);
- return findNode(node, commentNumber);
- }
- else{
- return null;
- }
- }
-
- private BugzillaOutlineNode findNode(BugzillaOutlineNode startNode, int commentNumber){
-
- if(commentNumber == -1){
- return startNode;
- }else if(startNode.getComment() != null && startNode.getComment().getNumber() == commentNumber -1){
- return startNode;
- } else if(startNode.isCommentHeader() && commentNumber == 1){
- return startNode;
- }else if(startNode.isDescription() && commentNumber == 0){
- return startNode;
- }
-
- BugzillaOutlineNode[] children = startNode.getChildren();
- for(int i = 0; i < children.length; i++){
- BugzillaOutlineNode n = findNode(children[i], commentNumber);
- if(n != null)
- return n;
- }
- return null;
- }
-
- public String getParentHandle(String handle) {
-
- //check so that we don't need to try to get the parent if we are already at the bug report
- if(!handle.matches(".*;.*;.*"))
- return null;
-
- BugzillaOutlineNode bon = (BugzillaOutlineNode)getObjectForHandle(handle);
- if(bon != null && bon.getParent() != null)
- return BugzillaTools.getHandle(bon.getParent());
- else
- return null;
-// String [] parts = handle.split(";");
-// if (parts.length == 1){
-// return null;
-// }else if (parts.length > 2) {
-// String newHandle = "";
-// for(int i = 0; i < parts.length - 1; i++)
-// newHandle += parts[i] + ";";
-// return newHandle.substring(0, newHandle.length() - 1);
-//// return handle.substring(0, handle.lastIndexOf(";"));
-// }
-// return null;
- }
-
- public String getName(Object object) {
- if(object instanceof BugzillaOutlineNode){
- BugzillaOutlineNode b = (BugzillaOutlineNode)object;
- return BugzillaTools.getName(b);
- } else if (object instanceof BugzillaReportNode){
- BugzillaSearchHit hit = ((BugzillaReportNode)object).getHit();
- return hit.getServer() + ": Bug#: " + hit.getId() + ": " + hit.getDescription();
- }
- return "";
- }
-
- public boolean canBeLandmark(Object element) {
- return false;
- }
-
- public boolean acceptsObject(Object object) {
- return object instanceof BugzillaOutlineNode || object instanceof BugzillaReportSelection;
- }
-
- public boolean canFilter(Object element) {
- return true;
- }
-
- public boolean isDocument(String handle) {
- return (handle.indexOf(';') == handle.lastIndexOf(';') && handle.indexOf(";") != -1);
- }
-
- public String getHandleForMarker(ProblemMarker marker) {
- return null;
- }
-
- public IProject getProjectForObject(Object object) {
- // bugzilla objects do not yet sit in a project
- return null;
- }
-
- public String getResourceExtension(String elementHandle) {
- return getResourceExtension();
- }
-
- /*
- *
- * STUFF FOR CACHING BUG REPORTS
- *
- */
-
- // bug report cache
- private Map<String, BugReport> cache = new HashMap<String, BugReport>();
-
- public void cache(String handle, BugReport report) {
- cache.put(handle, report);
- cacheFile.add(report);
- }
-
- public void clearCache(){
- cache.clear();
- cacheFile.removeAll();
- }
-
- private BugReport getFromCache(String bugHandle) {
- return cache.get(bugHandle);
- }
-
- public Set<String> getCachedHandles(){
- return cache.keySet();
- }
-
- private BugzillaCacheFile cacheFile;
-
- private IPath getCacheFile() {
- IPath stateLocation = Platform.getPluginStateLocation(MylarTasksPlugin.getDefault());
- IPath configFile = stateLocation.append("offlineReports");
- return configFile;
- }
-
- private void readCacheFile() {
- IPath cachPath = getCacheFile();
-
- try {
- cacheFile = new BugzillaCacheFile(cachPath.toFile());
- ArrayList<IBugzillaBug> cached = cacheFile.elements();
- for(IBugzillaBug bug: cached){
- if(bug instanceof BugReport)
- cache.put(BugzillaTools.getHandle(bug), (BugReport)bug);
- }
- } catch (Exception e) {
- MylarPlugin.log(e, "occurred while restoring saved offline Bugzilla reports.");
- }
- }
-
- public BugReport getCached(String handle) {
- return cache.get(handle);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/StackTrace.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/StackTrace.java
deleted file mode 100644
index 096c0c732..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/StackTrace.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Dec 8, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Class to hold all of the information about a stack trace
- *
- * @author Shawn Minto
- */
-public class StackTrace {
-
- /** The length of the stack trace in the original string */
- private int length;
-
- /** The offset of the stack trace in the orignal string */
- private int offset;
-
- /** The string of the stack trace */
- private String stackTrace;
-
- /** This is the comment that the stack trace appeared in. String if desciption else Comment */
- private Object comment;
-
- /**
- * Constructor
- *
- * @param stackTrace
- * The stack trace string
- * @param offset
- * The offset of the stack trace in the original string
- * @param length
- * The length of the stack trace in the original string
- * @param comment
- * The comment that the stack trace came from
- */
- public StackTrace(String stackTrace, int offset, int length, Object comment) {
- this.stackTrace = stackTrace;
- this.offset = offset;
- this.length = length;
- this.comment = comment;
- }
-
- /**
- * Get the offset for the stack trace
- *
- * @return Returns the offset.
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Get the stack trace for the bug
- *
- * @return Returns the stackTrace.
- */
- public String getStackTrace() {
- return stackTrace;
- }
-
- /**
- * Get the length of the bug
- *
- * @return Returns the length.
- */
- public int getLength() {
- return length;
- }
-
- /**
- * Get the Comment that this stack trace came from
- *
- * @return Returns the Comment if it was a comment else a String if it was the description
- */
- public Object getComment() {
- return comment;
- }
-
- /**
- * Find a standard java stack trace in the given string
- *
- *
- * @param s
- * The string to search for stack traces
- * @param comment
- * The comment that the text came from.<br>
- * Comment if a comment else a String
- * @return String[] of stack traces - each element is 1 trace
- */
- public static StackTrace[] getStackTrace(String s, Object comment) {
-
- // setup the regex used to determine if it looks like we are at a
- // stack trace and whether it is something that should be skipped
- String regexExceptionType = "^(.*\\.)+.+(Exception|Error|Throwable).*";
- String regexSkip = ".*\\.\\..*";
-
- // get all of the individual lines for the string
- String[] lines = s.split("\r\n");
-
- // the character start of the current stack trace
- int charStackStart = 0;
-
- // the current character in the string - used for the start and the
- // offset
- int[] charPos = { 0 }; // array so pass by reference
-
- boolean inStackTrace = false;
- List<String> stackTrace = null;
- List<StackTrace> stackTraces = new ArrayList<StackTrace>();
-
- // go through each of the lines of the string
- for (int i = 0; i < lines.length; i++) {
-
- if (lines[i].matches(regexSkip)){
-
- // update the current character position
- charPos[0] += lines[i].length() + 2;
-
- }else if (lines[i].trim().matches(regexExceptionType) && !inStackTrace) {
-
- // we have matched the stack trace and we are not already in one
-
- // add the old stack trace to the list of stack traces
- if (stackTrace != null && stackTrace.size() > 1) {
- stackTraces.add(getStackTrace(stackTrace, charStackStart,
- charPos[0] - charStackStart, comment));
- }
-
- // prepare for a new stack trace
- stackTrace = new ArrayList<String>();
- inStackTrace = true;
-
- // the current line is the start of our stack trace
- stackTrace.add(lines[i]);
- charStackStart = charPos[0];
- charPos[0] += lines[i].length() + 2;
- } else if (inStackTrace) {
- // we are in a stack trace
-
- int[] pos = { i }; // array so pass by reference
-
- // get the next at clause of the stack trace
- String stack = getNextAt(lines, pos, charPos);
-
- // check if there was an at
- if (stack == null) {
-
- // there wasn't so we are done this stack trace
- inStackTrace = false;
- if (stackTrace != null && stackTrace.size() > 1) {
- stackTraces.add(getStackTrace(stackTrace,
- charStackStart, charPos[0] - charStackStart, comment));
- }
- stackTrace = null;
- } else {
-
- // we had one, so add it to this stack trace
- stackTrace.add(stack);
- }
-
- // update the position
- i = pos[0];
- } else {
- // update the current character position
- charPos[0] += lines[i].length() + 2;
- }
- }
-
- // make sure to add the stack trace if it was the last in the string
- if (stackTrace != null && stackTrace.size() > 1) {
- stackTraces.add(getStackTrace(stackTrace, charStackStart,
- charPos[0] - charStackStart, comment));
- }
-
- if (stackTraces.size() == 0)
- return null;
-
- // get the string values of the stack traces and return it
- return getTracesFromList(stackTraces);
- }
-
- /**
- * Get the next at clause from a potential stack trace -- looks ahead 4
- * lines
- *
- * @param lines
- * The array of all of the lines in the bug
- * @param i
- * The current position to start at
- * @param charPos
- * The current character position in the original string
- * @return The next at clause, or <code>null</code><br>
- * If an at line is matched, but the end isn't within the 4 lines,
- * only the first line is returned. Also, charPos is updated as well
- * as i
- */
- private static String getNextAt(String[] lines, int[] i, int[] charPos) {
- String regexAtString = "^at.*";
- String regexEndString = ".*:\\d+\\)$";
- int index = i[0];
- String l1, l2, l3, l4;
- l1 = l2 = l3 = l4 = null;
- String res = null;
-
- // get the first line to look at
- if (lines.length > index) {
- l1 = lines[index];
- } else {
- // if the first line doesn't exist, we are done and should
- // return
- return null;
- }
-
- // get the next 3 lines
- if (lines.length > index + 1) {
- l2 = lines[index + 1];
- }
- if (lines.length > index + 2) {
- l3 = lines[index + 2];
- }
- if (lines.length > index + 3) {
- l4 = lines[index + 3];
- }
-
- // make sure that the first line is the start of an at
- // if not, return null
- if (l1.trim().matches(regexAtString)) {
- charPos[0] += l1.length() + 2;
- res = l1;
- } else
- return null;
-
- // now determine where the end is if it wasn't on 1 line
- if (!res.trim().matches(regexEndString)) {
-
- if (l2 != null && l2.trim().matches(regexEndString)) {
-
- // it was on the second line
- // update the current position and the result string
- i[0] = index + 1;
- charPos[0] += l2.length() + 2;
- res += l2.trim();
- } else if (l3 != null && l3.trim().matches(regexEndString)) {
-
- // it was on the third line
- // update the current position and the result string
- i[0] = index + 2;
- charPos[0] += l2.length() + l3.length() + 4;
- res += l2.trim();
- res += l3.trim();
- } else if (l4 != null && l4.trim().matches(regexEndString)) {
-
- // it was on the fourth line
- // update the current position and the result string
- i[0] = index + 3;
- charPos[0] += l2.length() + l3.length() + l4.length() + 6;
- res += l2.trim();
- res += l3.trim();
- res += l4.trim();
- }
- }
-
- // return the result
- return res;
- }
-
- /**
- * Get the StackTrace
- *
- * @param l
- * the list of lines that contain the trace
- * @param start
- * the start of the stack trace
- * @param offset
- * the offset of the stack trace
- * @param comment
- * The comment that the stack trace came from
- * @return The StackTrace for the given data
- */
- private static StackTrace getStackTrace(List<String> l, int offset, int length, Object comment) {
- String s = "";
- for(String s2 : l) {
- s += s2 + "\r\n";
- }
-
- return new StackTrace(s, offset, length, comment);
- }
-
- /**
- * Convert a List StackTraces to a StackTrace[] <br>
- *
- * @param l
- * The List of StackTraces
- * @return StackTrace[] of the List
- */
- private static StackTrace[] getTracesFromList(List<StackTrace> l) {
-
- // make sure that there is something to convert, else return null
- if (l == null || l.size() == 0)
- return null;
-
- // convert the list of strings to an array of strings
- int i = 0;
- StackTrace[] s = new StackTrace[l.size()];
-
- for(StackTrace st : l) {
- s[i] = st;
- i++;
- }
-
- // return the string array
- return s;
- }
-
- /**
- * Escape all of the special regex characters from the string
- *
- * @param s
- * The string to escape the characters for
- * @return A string with all of the special characters escaped <br>
- * <code>
- * . => \.<br>
- * $ => \$<br>
- * ? => \?<br>
- * { => \{<br>
- * } => \}<br>
- * ( => \(<br>
- * ) => \)<br>
- * [ => \[<br>
- * ] => \]<br>
- * + => \+<br>
- * * => \*<br>
- * | => \|<br>
- * ^ => \^<br>
- * \ => \\<br>
- * / => \/<br>
- * </code>
- */
- public static String escapeForRegex(String s) {
- String sFixed = s;
-
- // replace all special regex characters
- sFixed = sFixed.replaceAll("\\\\", "\\\\\\\\");
- sFixed = sFixed.replaceAll("\\$", "\\\\\\$");
- sFixed = sFixed.replaceAll("\\.", "\\\\.");
- sFixed = sFixed.replaceAll("\\?", "\\\\?");
- sFixed = sFixed.replaceAll("\\{", "\\\\{");
- sFixed = sFixed.replaceAll("\\}", "\\\\}");
- sFixed = sFixed.replaceAll("\\(", "\\\\(");
- sFixed = sFixed.replaceAll("\\)", "\\\\)");
- sFixed = sFixed.replaceAll("\\[", "\\\\[");
- sFixed = sFixed.replaceAll("\\]", "\\\\]");
- sFixed = sFixed.replaceAll("\\+", "\\\\+");
- sFixed = sFixed.replaceAll("\\*", "\\\\*");
- sFixed = sFixed.replaceAll("\\|", "\\\\|");
- sFixed = sFixed.replaceAll("\\^", "\\\\^");
- sFixed = sFixed.replaceAll("\\/", "\\\\/");
-
- return sFixed;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java
deleted file mode 100644
index 1eb287c9c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Nov 19, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.BugzillaPreferences;
-import org.eclipse.mylar.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.core.model.InterestComparator;
-import org.eclipse.mylar.tasks.bugzilla.search.BugzillaMylarSearchOperation;
-
-
-/**
- * Utilities methods for the BugzillaMylarBridge
- *
- * @author Shawn Minto
- */
-public class Util {
-
- /**
- * List of all of the search operations that can be done <br> all words, any words, regex
- */
- private static final String[] patternOperationValues = { "allwordssubstr", "anywordssubstr", "regexp" };
- /**
- * Sugzilla preferences so that we can get the search params
- */
- private static IPreferenceStore prefs = BugzillaPlugin.getDefault().getPreferenceStore();
- /**
- * List of all of the resolutions that we can have <br> FIXED, INVALID, WONTFIX, LATER, REMIND, DUPLICATE, WORKSFORME, MOVED, ---
- */
- private static String[] resolutionValues = BugzillaPreferences.queryOptionsToArray(prefs.getString(IBugzillaConstants.RESOLUTION_VALUES));
- /**
- * List of all of the statuses that we can have <br> UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, CLOSED
- */
- private static String[] statusValues = BugzillaPreferences.queryOptionsToArray(prefs.getString(IBugzillaConstants.STATUS_VALUES));
-
- /**
- * Get only the landmarks that are IMember and sort them according to their
- * DOI value (highest to lowest)
- *
- * @param landmarks
- * The landmarks to check
- * @return List of IMember landmarks sorted by DOI value
- */
- public static List<IMember> getMemberLandmarks(List<IJavaElement> landmarks) {
- List<IMember> memberLandmarks = new ArrayList<IMember>();
-
- for(IJavaElement je : landmarks) {
-
- // keep only the IMember landmarks
- if (je instanceof IMember) {
- memberLandmarks.add((IMember)je);
- }
- }
-
- // sort the landmarks
- Collections.sort(memberLandmarks, new InterestComparator<IMember>());
-
- return memberLandmarks;
- }
-
- /**
- * Get the bugzilla url used for searching for exact matches
- *
- * @param je
- * The IMember to create the query string for
- * @return A url string for the search
- */
- public static String getExactSearchURL(IMember je) {
- StringBuffer sb = getQueryURLStart();
-
- String long_desc = "";
-
- // get the fully qualified name of the element
- long_desc += BugzillaMylarSearchOperation.getFullyQualifiedName(je);
-
- try{
- // encode the string to be used as a url
- sb.append(URLEncoder.encode(long_desc, Charset.defaultCharset().toString()));
- } catch (UnsupportedEncodingException e)
- {
- // should never get here since we are using the default encoding
- }
- sb.append(getQueryURLEnd());
-
- return sb.toString();
- }
-
- /**
- * Get the bugzilla url used for searching for inexact matches
- *
- * @param je
- * The IMember to create the query string for
- * @return A url string for the search
- */
- public static String getInexactSearchURL(IMember je) {
- StringBuffer sb = getQueryURLStart();
-
-
- String long_desc = "";
-
- // add the member, qualified with just its parents name
- if (!(je instanceof IType))
- long_desc += je.getParent().getElementName()+".";
- long_desc += je.getElementName();
-
- try{
- // encode the string to be used as a url
- sb.append(URLEncoder.encode(long_desc, Charset.defaultCharset().toString()));
- } catch (UnsupportedEncodingException e)
- {
- // should never get here since we are using the default encoding
- }
- sb.append(getQueryURLEnd());
-
- return sb.toString();
- }
-
- /**
- * Create the end of the bugzilla query URL with all of the status' and resolutions that we want
- * @return StringBuffer with the end of the query URL in it
- */
- public static StringBuffer getQueryURLEnd(){
-
- StringBuffer sb = new StringBuffer();
-
- // add the status and resolutions that we care about
- sb.append("&bug_status=" + statusValues[0]); // UNCONFIRMED
- sb.append("&bug_status=" + statusValues[1]); // NEW
- sb.append("&bug_status=" + statusValues[2]); // ASSIGNED
- sb.append("&bug_status=" + statusValues[3]); // REOPENED
- sb.append("&bug_status=" + statusValues[4]); // RESOLVED
- sb.append("&bug_status=" + statusValues[5]); // VERIFIED
- sb.append("&bug_status=" + statusValues[6]); // CLOSED
-
- sb.append("&resolution=" + resolutionValues[0]); // FIXED
- sb.append("&resolution=" + resolutionValues[3]); // LATER
- sb.append("&resolution=" + "---"); // ---
- return sb;
- }
-
- /**
- * Create the bugzilla query URL start.
- *
- * @return The start of the query url as a StringBuffer <br>
- * Example: https://bugs.eclipse.org/bugs/buglist.cgi?long_desc_type=allwordssubstr&long_desc=
- */
- public static StringBuffer getQueryURLStart() {
- StringBuffer sb = new StringBuffer(BugzillaPlugin.getDefault()
- .getServerName());
-
- if (sb.charAt(sb.length() - 1) != '/') {
- sb.append('/');
- }
- sb.append("buglist.cgi?");
-
- // use the username and password if we have it
- if (BugzillaPreferences.getUserName() != null
- && !BugzillaPreferences.getUserName().equals("")
- && BugzillaPreferences.getPassword() != null
- && !BugzillaPreferences.getPassword().equals("")) {
- try{
- sb.append("GoAheadAndLogIn=1&Bugzilla_login="
- + URLEncoder.encode(BugzillaPreferences.getUserName(), Charset.defaultCharset().toString())
- + "&Bugzilla_password="
- + URLEncoder.encode(BugzillaPreferences.getPassword(), Charset.defaultCharset().toString())
- + "&");
- } catch (UnsupportedEncodingException e)
- {
- // should never get here since we are using the default encoding
- }
- }
-
- // add the description search type
- sb.append("long_desc_type=");
- sb.append(patternOperationValues[0]); // search for all words
- sb.append("&long_desc=");
-
- return sb;
- }
-
- /**
- * Search the given string for another string
- * @param elementName The name of the element that we are looking for
- * @param comment The text to search for this element name
- * @return <code>true</code> if the element is found in the text else <code>false</code>
- */
- public static boolean hasElementName(String elementName, String comment) {
-
- // setup a regex for the element name
- String regexElement = ".*"+elementName+".*";
-
- // get all of the individual lines for the string
- String[] lines = comment.split("\n");
-
- // go through each of the lines of the string
- for (int i = 0; i < lines.length; i++) {
-
- if (lines[i].matches(regexElement)){
- return true;
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java
deleted file mode 100644
index ea144c0e8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 14, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla.search;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchEngine;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery;
-import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-
-/**
- * Bugzilla search operation for Mylar
- *
- * @author Shawn Minto
- */
-public class BugzillaCategorySearchOperation extends WorkspaceModifyOperation
- implements IBugzillaSearchOperation {
- /** The IMember we are doing the search for */
-
- public interface ICategorySearchListener {
- public void searchCompleted(BugzillaResultCollector collector);
- }
-
- /** The bugzilla collector for the search */
- private BugzillaResultCollector collector = null;
-
- /** The status of the search operation */
- private IStatus status;
-
- /** The LoginException that was thrown when trying to do the search */
- private LoginException loginException = null;
-
- private String url;
-
- /**
- * Constructor
- *
- * @param m
- * The member that we are doing the search for
- */
- public BugzillaCategorySearchOperation(String url) {
- this.url = url;
- }
-
- @Override
- public void execute(IProgressMonitor monitor) {
- collector = new BugzillaResultCollector();
- collector.setOperation(this);
- collector.setProgressMonitor(monitor);
- search(url, monitor);
- for(ICategorySearchListener listener: listeners)
- listener.searchCompleted(collector);
- }
-
- /**
- * Perform the actual search on the Bugzilla server
- * @param url The url to use for the search
- * @param searchCollector The collector to put the search results into
- * @param monitor The progress monitor to use for the search
- * @return The BugzillaResultCollector with the search results
- */
- private BugzillaResultCollector search(String url, IProgressMonitor monitor){
-
- // set the initial number of matches to 0
- int matches = 0;
- // setup the progress monitor and start the search
- collector.setProgressMonitor(monitor);
- BugzillaSearchEngine engine = new BugzillaSearchEngine(url);
- try {
-
- // perform the search
- status = engine.search(collector, matches);
-
- // check the status so that we don't keep searching if there
- // is a problem
- if (status.getCode() == IStatus.CANCEL) {
- MylarPlugin.log("search cancelled", this);
- return null;
- } else if (!status.isOK()) {
- MylarPlugin.log("search error", this);
- MylarPlugin.log(status);
- return null;
- }
- return collector;
- } catch (LoginException e) {
- //save this exception to throw later
- this.loginException = e;
- }
- return null;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getStatus()
- */
- public IStatus getStatus() throws LoginException {
- // if a LoginException was thrown while trying to search, throw this
- if (loginException == null)
- return status;
- else
- throw loginException;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public BugzillaSearchQuery getQuery() {
- return null;
- }
-
- public void setQuery(BugzillaSearchQuery newQuery) {}
-
- private List<ICategorySearchListener> listeners = new ArrayList<ICategorySearchListener>();
-
- public void addResultsListener(ICategorySearchListener listener){
- listeners.add(listener);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearch.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearch.java
deleted file mode 100644
index dea6339ee..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearch.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 13, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla.search;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.mylar.core.search.IActiveSearchListener;
-import org.eclipse.mylar.core.search.IMylarSearchOperation;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaMylarBridge;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaReportNode;
-import org.eclipse.mylar.tasks.bugzilla.Util;
-
-
-/**
- * Used to facilitate bugzilla searches based on IJavaElements
- *
- * @author Shawn Minto
- */
-public class BugzillaMylarSearch implements IMylarSearchOperation {
-
- // scope identifiers
- public static final int LOCAL_QUAL = 1; // local implies a bugzilla task, not just an offline report
- public static final int LOCAL_UNQUAL = 2;
- public static final int FULLY_QUAL = 3;
- public static final int UNQUAL = 4;
-
- private int scope;
-
- private IJavaElement element;
-
- private String handle = "";
-
- /**
- * Constructor
- * @param scope The scope of this search
- */
- public BugzillaMylarSearch(int scope, IJavaElement element) {
- this.scope = scope;
- this.element = element;
- }
-
- public IStatus run(IProgressMonitor monitor) {
- handle = element.getHandleIdentifier() + " " + scope;
- List<IJavaElement> landmarks = new ArrayList<IJavaElement>();
- landmarks.add(element);
-
- if (!BugzillaMylarBridge.doesJobExist(handle)) {
-
- // perform the bugzilla search
- // get only the useful landmarks (IMember)
- List<IMember> members = Util.getMemberLandmarks(landmarks);
-
- // go through all of the landmarks that we are given and perform a
- // search on them
- for(IMember m : members){
-
- // FIXME: decide whether to do leave the caching of searches in for now or not
- // check if we have the info cached
-// List<BugzillaReportNode> landmarkDoi = MylarTasksPlugin.getBridge()
-// .getFromLandmarksHash(m, scope);
-
-// if (landmarkDoi != null) {
-// //TODO decide when to queue up and do a refresh search
-// notifySearchCompleted(landmarkDoi);
-// continue;
-// }
-
- // create a search operation so that we can search
- BugzillaMylarSearchOperation op = new BugzillaMylarSearchOperation(
- this, m, scope);
-
- // create a new search job so that it can be scheduled and
- // run as a background thread
- Job searchJob = new BugzillaMylarSearchJob(
- "Querying Bugzilla Server - Mylar - "
- + op.getSearchMemberName(), op);
-
- // schedule the new search job
- searchJob.schedule();
-
- // save this searchJobs handle so that we can cancel it if need be
- BugzillaMylarBridge.addJob(handle, searchJob);
- }
- }
- return Status.OK_STATUS;
- }
-
- /** List of listeners wanting to know about the searches */
- private List<IActiveSearchListener> listeners = new ArrayList<IActiveSearchListener>();
-
- /**
- * Add a listener for when the bugzilla search is completed
- *
- * @param l
- * The listener to add
- */
- public void addListener(IActiveSearchListener l) {
- // add the listener to the list
- listeners.add(l);
- }
-
- /**
- * Remove a listener for when the bugzilla search is completed
- *
- * @param l
- * The listener to remove
- */
- public void removeListener(IActiveSearchListener l) {
- // remove the listener from the list
- listeners.remove(l);
- }
-
- /**
- * Notify all of the listeners that the bugzilla search is completed
- *
- * @param doiList
- * A list of BugzillaSearchHitDoiInfo
- * @param member
- * The IMember that the search was performed on
- */
- public void notifySearchCompleted(List<BugzillaReportNode> doiList) {
- // go through all of the listeners and call searchCompleted(colelctor,
- // member)
- BugzillaMylarBridge.removeSearchJob(handle);
- for (IActiveSearchListener listener : listeners) {
- listener.searchCompleted(doiList);
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java
deleted file mode 100644
index d6900c5c2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 6, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla.search;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaMylarBridge;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * The bugzilla search job used to search a bugzilla site
- *
- * @author Shawn Minto
- */
-public class BugzillaMylarSearchJob extends Job {
-
- /** The search operation used to perform the query */
- private BugzillaMylarSearchOperation operation;
-
- /**
- * Constructor
- *
- * @param name
- * Job name
- * @param operation
- * The operation to perform the search query
- */
- public BugzillaMylarSearchJob(String name,
- BugzillaMylarSearchOperation operation) {
- super(name);
- this.operation = operation;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- // create a new status
- final IStatus[] status = new IStatus[1];
-
- try {
- // execute the search operation
- operation.execute(monitor);
-
- // get the status of the search operation
- status[0] = operation.getStatus();
-
- // determine if there was an error, if it was cancelled, or if it is
- // ok
- if ( status[0].getCode() == IStatus.CANCEL) {
- // it was cancelled, so just return
- status[0] = Status.OK_STATUS;
-
- // make sure that we know this job is not running anymore
- BugzillaMylarBridge.removeSearchJob(operation.getSearchMember().getHandleIdentifier()+" "+operation.getScope());//runningJobs.remove(operation.getSearchMember());
- return status[0];
- } else if (!status[0].isOK()) {
- // there was an error, so display an error message
- PlatformUI.getWorkbench().getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- ErrorDialog.openError(null,
- "Bugzilla Search Error", null,
- status[0]);
- }
- });
- status[0] = Status.OK_STATUS;
-
- // make sure we know that this job is not running anymore
- BugzillaMylarBridge.removeSearchJob(operation.getSearchMember().getHandleIdentifier()+" "+operation.getScope());//runningJobs.remove(operation.getSearchMember());
- return status[0];
- }
- } catch (LoginException e) {
- // we had a problem while searching that seems like a login info
- // problem
- // thrown in BugzillaSearchOperation
- MessageDialog
- .openError(
- null,
- "Login Error",
- "Bugzilla could not log you in to get the information you requested since login name or password is incorrect.\nPlease check your settings in the bugzilla preferences. ");
- BugzillaPlugin.log(new Status(IStatus.ERROR,
- IBugzillaConstants.PLUGIN_ID, IStatus.OK, "", e));
- } finally {
- // make sure that we know that this job is not running anymore
- BugzillaMylarBridge.removeSearchJob(operation.getSearchMember().getHandleIdentifier()+" "+operation.getScope());//.runningJobs.remove(operation.getSearchMember());
- }
-
- return status[0];
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java
deleted file mode 100644
index 4ab4e16c5..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 14, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla.search;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.Comment;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchEngine;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery;
-import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaReportNode;
-import org.eclipse.mylar.tasks.bugzilla.StackTrace;
-import org.eclipse.mylar.tasks.bugzilla.Util;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-
-/**
- * Bugzilla search operation for Mylar
- *
- * @author Shawn Minto
- */
-public class BugzillaMylarSearchOperation extends WorkspaceModifyOperation
- implements IBugzillaSearchOperation {
- /** The IMember we are doing the search for */
- private IMember javaElement;
-
- /** The bugzilla collector for the search */
- private BugzillaResultCollector collector = null;
-
- /** The status of the search operation */
- private IStatus status;
-
- /** The LoginException that was thrown when trying to do the search */
- private LoginException loginException = null;
-
- /** The fully qualified name of the member we are searching for */
- private String name;
-
- /** The bugzilla search query */
- private BugzillaSearchQuery query;
-
- private BugzillaMylarSearch search;
-
- private int scope;
-
- /**
- * Constructor
- *
- * @param m
- * The member that we are doing the search for
- */
- public BugzillaMylarSearchOperation(BugzillaMylarSearch search, IMember m, int scope) {
- this.javaElement = m;
- this.search = search;
- this.scope = scope;
- name = getFullyQualifiedName(m);
- }
-
- /**
- * Get the fully qualified name of a IMember
- * TODO: move to a more central location so that others can use this, but don't want to add unecessary coupling
- *
- * @return String representing the fully qualified name
- */
- public static String getFullyQualifiedName(IJavaElement je) {
- if(!(je instanceof IMember)) return null;
-
- IMember m = (IMember)je;
- if (m.getDeclaringType() == null)
- return ((IType) m).getFullyQualifiedName();
- else
- return m.getDeclaringType().getFullyQualifiedName() + "."
- + m.getElementName();
- }
-
- @Override
- public void execute(IProgressMonitor monitor) {
-
- BugzillaResultCollector searchCollector = null;
-
- if(scope == BugzillaMylarSearch.FULLY_QUAL){
- searchCollector = searchQualified(monitor);
- }else if(scope == BugzillaMylarSearch.UNQUAL){
- searchCollector = searchUnqualified(monitor);
- }else if(scope == BugzillaMylarSearch.LOCAL_QUAL){
- searchCollector = searchLocalQual(monitor);
- }else if(scope == BugzillaMylarSearch.LOCAL_UNQUAL){
- searchCollector = searchLocalUnQual(monitor);
- }else{
- return;
- }
-
- if(searchCollector == null){
- search.notifySearchCompleted(
- new ArrayList<BugzillaReportNode>());
- return;
- }
-
- List<BugzillaSearchHit> l = searchCollector.getResults();
-
- // get the list of doi elements
- List<BugzillaReportNode> doiList = getDoiList(l);
-
- // we completed the search, so notify all of the listeners
- // that the search has been completed
- MylarTasksPlugin.getBridge()
- .addToLandmarksHash(doiList, javaElement, scope);
- search.notifySearchCompleted(
- doiList);
- // MIK: commmented out logging
-// MonitorPlugin.log(this, "There were " + doiList.size() + " items found");
- }
-
- /**
- * Search the local bugs for the member using the qualified name
- * @param monitor The progress monitor to search with
- * @return The BugzillaResultCollector with the results of the search
- */
- private BugzillaResultCollector searchLocalQual(IProgressMonitor monitor) {
-
- //get the fully qualified name for searching
- String elementName = getFullyQualifiedName(javaElement);
-
- // setup the search result collector
- collector = new BugzillaResultCollector();
- collector.setOperation(this);
- collector.setProgressMonitor(monitor);
-
- // get all of the root tasks and start the search
- List<ITask> tasks = MylarTasksPlugin.getTaskListManager().getTaskList().getRootTasks();
- searchLocal(tasks, collector, elementName, monitor);
- for (TaskCategory cat : MylarTasksPlugin.getTaskListManager().getTaskList().getTaskCategories()) {
- searchLocal(cat.getChildren(), collector, elementName, monitor);
- }
-
- // return the collector
- return collector;
- }
-
- /**
- * Search the local bugs for the member using the unqualified name
- * @param monitor The progress monitor to search with
- * @return The BugzillaResultCollector with the results of the search
- */
- private BugzillaResultCollector searchLocalUnQual(IProgressMonitor monitor) {
-
- // get the element name for searching
- String elementName = javaElement.getElementName();
-
- // setup the search result collector
- collector = new BugzillaResultCollector();
- collector.setOperation(this);
- collector.setProgressMonitor(monitor);
-
- // get all of the root tasks and start the search
- List<ITask> tasks = MylarTasksPlugin.getTaskListManager().getTaskList().getRootTasks();
- searchLocal(tasks, collector, elementName, monitor);
- for (TaskCategory cat : MylarTasksPlugin.getTaskListManager().getTaskList().getTaskCategories()) {
- searchLocal(cat.getChildren(), collector, elementName, monitor);
- }
- // return the collector
- return collector;
- }
-
- /**
- * Search the local bugs for the member
- * @param tasks The tasks to search
- * @param searchCollector The collector to add the results to
- * @param elementName The name of the element that we are looking for
- * @param monitor The progress monitor
- */
- private void searchLocal(List<ITask> tasks, BugzillaResultCollector searchCollector, String elementName, IProgressMonitor monitor) {
- if(tasks == null) return;
-
- // go through all of the tasks
- for(ITask task : tasks){
- monitor.worked(1);
-
- // check what kind of task it is
- if(task instanceof BugzillaTask){
-
- // we have a bugzilla task, so get the bug report
- BugzillaTask bugTask = (BugzillaTask)task;
- BugReport bug = bugTask.getBugReport();
-
- // parse the bug report for the element that we are searching for
- boolean isHit = search(elementName, bug);
-
- // determine if we have a hit or not
- if(isHit){
-
- // make a search hit from the bug and then add it to the collector
- BugzillaSearchHit hit = new BugzillaSearchHit(bug.getId(), bug.getDescription(), "","","","","","","", bug.getServer());
- try{
- searchCollector.accept(hit);
- }catch(CoreException e){
- MylarPlugin.log(e, "bug search failed");
- }
- }
- }
- }
- status = Status.OK_STATUS;
- }
-
- /**
- * Search the bug for the given element name
- * @param elementName The name of the element to search for
- * @param bug The bug to search in
- */
- private boolean search(String elementName, BugReport bug) {
-
- if (bug == null) return false; // MIK: added null check here
- String description = bug.getDescription();
- String summary = bug.getSummary();
- List<Comment> comments = bug.getComments();
-
- // search the description and the summary
- if(Util.hasElementName(elementName, summary))
- return true;
-
- if(Util.hasElementName(elementName, description))
- return true;
-
- Iterator<Comment> comItr = comments.iterator();
- while (comItr.hasNext()) {
- Comment comment = comItr.next();
- String commentText = comment.getText();
- // search the text for a reference to the element
- if(Util.hasElementName(elementName, commentText))
- return true;
- }
- return false;
- }
-
- /**
- * Perform the actual search on the Bugzilla server
- * @param url The url to use for the search
- * @param searchCollector The collector to put the search results into
- * @param monitor The progress monitor to use for the search
- * @return The BugzillaResultCollector with the search results
- */
- private BugzillaResultCollector search(String url, BugzillaResultCollector searchCollector, IProgressMonitor monitor){
-
- // set the initial number of matches to 0
- int matches = 0;
- // setup the progress monitor and start the search
- searchCollector.setProgressMonitor(monitor);
- BugzillaSearchEngine engine = new BugzillaSearchEngine(url);
- try {
-
- // perform the search
- status = engine.search(searchCollector, matches);
-
- // check the status so that we don't keep searching if there
- // is a problem
- if (status.getCode() == IStatus.CANCEL) {
- MylarPlugin.log("search cancelled", this);
- return null;
- } else if (!status.isOK()) {
- MylarPlugin.log("search error", this);
- MylarPlugin.log(status);
- return null;
- }
- return searchCollector;
- } catch (LoginException e) {
- //save this exception to throw later
- this.loginException = e;
- }
- return null;
- }
-
- /**
- * Perform a search for qualified instances of the member
- * @param monitor The progress monitor to use
- * @return The BugzillaResultCollector with the search results
- */
- private BugzillaResultCollector searchQualified(IProgressMonitor monitor)
- {
- // create a new collector for the results
- collector = new BugzillaResultCollector();
- collector.setOperation(this);
- collector.setProgressMonitor(monitor);
-
- // get the search url
- String url = Util.getExactSearchURL(javaElement);
-
- // log the url that we are searching with
- // MIK: commmented out logging
-// MonitorPlugin.log(this, url);
-
- return search(url, collector, monitor);
- }
-
- /**
- * Perform a search for unqualified instances of the member
- * @param monitor The progress monitor to use
- * @return The BugzillaResultCollector with the search results
- */
- private BugzillaResultCollector searchUnqualified(IProgressMonitor monitor)
- {
- // create a new collector for the results
- collector = new BugzillaResultCollector();
- collector.setOperation(this);
- collector.setProgressMonitor(monitor);
-
- // get the search url
- String url = Util.getInexactSearchURL(javaElement);
-
- // log the url that we are searching with
- // MIK: commmented out logging
-// MonitorPlugin.log(this, url);
-
- return search(url, collector, monitor);
- }
-
-// /**
-// * Remove all of the duplicates
-// * @param compare The List of BugzillaSearchHits to compare with
-// * @param base The List of BugzillaSearchHits to remove the duplicates from
-// */
-// private void removeDuplicates(List<BugzillaSearchHit> compare, List<BugzillaSearchHit> base){
-//
-// for(BugzillaSearchHit h1 : compare){
-// Iterator itr2 = base.iterator();
-// while(itr2.hasNext()){
-// BugzillaSearchHit h2 = (BugzillaSearchHit)itr2.next();
-// if(h2.getId() == h1.getId()){
-// // we found a duplicate so remove it
-// itr2.remove();
-// break;
-// }
-// }
-// }
-// }
-//
- /**
- * Perform a second pass parse to determine if there are any stack traces in
- * the bug - currently only used for the exact search results
- *
- * @param doiList -
- * the list of BugzillaSearchHitDOI elements to parse
- */
- public static void secondPassBugzillaParser(List<BugzillaReportNode> doiList) {
-
- // go through each of the items in the doiList
- for(BugzillaReportNode info : doiList) {
-
- // get the bug report so that we have all of the data
- // - descriptions, comments, etc
- BugReport b = null;
- try{
- b = info.getBug();
- }catch(Exception e){
- // don't care since null will be caught
- }
-
- // if the report could not be downloaded, try the next one
- if (b == null)
- continue;
-
- // see if the description has a stack trace in it
- StackTrace[] stackTrace = StackTrace.getStackTrace(b.getDescription(), b.getDescription());
- if (stackTrace != null) {
-
- // add the stack trace to the doi info
- info.setExact(true);
- info.addStackTraces(stackTrace);
- }
-
- // go through all of the comments for the bug
- Iterator<Comment> comItr = b.getComments().iterator();
- while (comItr.hasNext()) {
- Comment comment = comItr.next();
- String commentText = comment.getText();
-
- // see if the comment has a stack trace in it
- stackTrace = StackTrace.getStackTrace(commentText, comment);
- if (stackTrace != null) {
-
- // add the stack trace to the doi info
- info.setExact(true);
- info.addStackTraces(stackTrace);
- }
- }
- }
- }
-
- /**
- * Add the results returned to the Hash of landmarks
- *
- * @param results
- * The list of results
- * @param isExact
- * whether the search was exact or not
- */
- private List<BugzillaReportNode> getDoiList(List<BugzillaSearchHit> results) {
- List<BugzillaReportNode> doiList = new ArrayList<BugzillaReportNode>();
-
- boolean isExact = (scope==BugzillaMylarSearch.FULLY_QUAL || scope==BugzillaMylarSearch.LOCAL_QUAL)?true:false;
-
- BugzillaReportNode info = null;
- // go through all of the results and create a DoiInfo list
- for(BugzillaSearchHit hit : results){
-
- try {
- float value = 0;
- info = new BugzillaReportNode(
- value, hit, isExact);
-
- // only download the bug for the exact matches
- //downloading bugs kills the time - can we do this elsewhere? - different thread? persistant?
-// if(isExact){
-// // get the bug report for the doi info item
-// BugReport b = BugzillaRepository.getInstance().getBug(
-// hit.getId());
-// // add the bug to the doi info for future use
-// info.setBug(b);
-// }
-
- } catch (Exception e) {
- MylarPlugin.log(e, "search failed");
- }
- finally{
- doiList.add(info);
- }
- }
- return doiList;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getStatus()
- */
- public IStatus getStatus() throws LoginException {
- // if a LoginException was thrown while trying to search, throw this
- if (loginException == null)
- return status;
- else
- throw loginException;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /**
- * Get the member that we are performing the search for
- *
- * @return The member this search is being performed for
- */
- public IMember getSearchMember() {
- return javaElement;
- }
-
- /**
- * Get the name of the member that we are searching for
- *
- * @return The fully qualified name of the member
- */
- public String getSearchMemberName() {
- return name;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getQuery()
- */
- public BugzillaSearchQuery getQuery() {
- return query;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#setQuery(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery)
- */
- public void setQuery(BugzillaSearchQuery newQuery) {
- this.query = newQuery;
- }
-
- /**
- * Get the name of the element that we are searching for
- *
- * @return The name of the element
- */
- public String getName(){
- return name;
- }
-
- /**
- * Get the scope of the search operation
- * @return The scope - defined in BugzillaMylarSearch
- */
- public int getScope() {
- return scope;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java
deleted file mode 100644
index 8325771ec..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Oct 4, 2004
- */
-package org.eclipse.mylar.tasks.bugzilla.search;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit;
-import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation;
-import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector;
-
-
-/**
- * Collector for the bugzilla search results
- *
- * @author Shawn Minto
- */
-public class BugzillaResultCollector implements IBugzillaSearchResultCollector {
- /** A list of all of the search results found */
- private List<BugzillaSearchHit> results = new ArrayList<BugzillaSearchHit>();
-
- /** The progress monitor for the search operation */
- private IProgressMonitor monitor;
-
- /** The number of matches found */
- private int matchCount;
-
- /** The bugzilla search operation */
- private IBugzillaSearchOperation operation;
-
- /** The string to display to the user while querying */
- private static final String STARTING = "querying the server";
-
- /** The string to display to the user when the query is done */
- private static final String DONE = "done";
-
- /** The string to display when there is one match from the search */
- private static final String MATCH = "Bugzilla Mylar search - 1 match";
-
- /** The string to display when there is more than one match from the search */
- private static final String MATCHES = "Bugzilla Mylar search - {0} matches";
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#aboutToStart()
- */
- public void aboutToStart(int startMatchCount) throws CoreException {
- // initiailize the number of matches
- matchCount = startMatchCount;
-
- // set the progress monitor to say that we are querying the server
- monitor.setTaskName(STARTING);
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#accept(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit)
- */
- public void accept(BugzillaSearchHit hit) throws CoreException {
- // add the result to the list of results
- results.add(hit);
-
- // increment the match count
- matchCount++;
-
- if (getProgressMonitor() != null) {
- if (!getProgressMonitor().isCanceled()) {
- // if the operation is cancelled finish with whatever data was
- // already found
- getProgressMonitor().subTask(
- getFormattedMatchesString(matchCount));
- getProgressMonitor().worked(1);
- }
- }
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#done()
- */
- public void done() {
- if (getProgressMonitor() != null) {
- if (!monitor.isCanceled()) {
- // if the operation is cancelled, finish with the data that we
- // already have
- String matchesString = getFormattedMatchesString(matchCount);
- monitor.setTaskName(MessageFormat.format(DONE,
- new Object[] { matchesString }));
- }
- }
-
- monitor = null;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#getProgressMonitor()
- */
- public IProgressMonitor getProgressMonitor() {
- return monitor;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#setOperation(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchOperation)
- */
- public void setOperation(IBugzillaSearchOperation operation) {
- this.operation = operation;
- }
-
- /**
- * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#getOperation()
- */
- public IBugzillaSearchOperation getOperation() {
- return operation;
- }
-
- /**
- * Get the string specifying the number of matches found
- *
- * @param count
- * The number of matches found
- * @return The <code>String</code> specifying the number of matches found
- */
- private String getFormattedMatchesString(int count) {
- // if only 1 match, return the singular match string
- String name = "";
- if(operation instanceof BugzillaMylarSearchOperation)
- name = " - " + ((BugzillaMylarSearchOperation)operation).getName();
- if (count == 1)
- return MATCH + name;
-
- // format the matches string and return it
- Object[] messageFormatArgs = { new Integer(count) };
- return MessageFormat.format(MATCHES + name,
- messageFormatArgs);
- }
-
- /**
- * Get the list of results
- *
- * @return A List of BugzillaSearchHit
- */
- public List<BugzillaSearchHit> getResults() {
- return results;
- }
-
- /**
- * Get the number of matches from the operation
- *
- * @return Returns the matchCount.
- */
- public int getMatchCount() {
- return matchCount;
- }
-
- /**
- * Set the starting number of matches for the search operation
- *
- * @param matchCount
- * The matchCount to set.
- */
- public void setMatchCount(int matchCount) {
- this.matchCount = matchCount;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaNodeLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaNodeLabelProvider.java
deleted file mode 100644
index 01a2f5791..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaNodeLabelProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Apr 18, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla.ui;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.core.model.ITaskscapeNode;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaReportNode;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Mik Kersten
- */
-public class BugzillaNodeLabelProvider implements ILabelProvider {
-
- public Image getImage(Object element) {
- return MylarImages.getImage(MylarImages.BUG);
- }
-
- /**
- * TODO: slow?
- */
- public String getText(Object element) {
- ITaskscapeNode node = (ITaskscapeNode)element;
-
- // try to get from the cache before downloading
- Object report;
- BugzillaReportNode reportNode = MylarTasksPlugin.getReferenceProvider().getCached(node.getElementHandle());
- BugReport cachedReport = MylarTasksPlugin.getDefault().getStructureBridge().getCached(node.getElementHandle());
- if(reportNode != null && cachedReport == null){
- report = reportNode;
- } else{
- report = MylarTasksPlugin.getDefault().getStructureBridge().getObjectForHandle(node.getElementHandle());
- }
- return MylarTasksPlugin.getDefault().getStructureBridge().getName(report);
- }
-
- public void addListener(ILabelProviderListener listener) {
- // don't need to worry about listeners
- }
-
- public void dispose() {
- // don't care about dispose
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // don't need to worry about listeners
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaUiBridge.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaUiBridge.java
deleted file mode 100644
index 406566baa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/ui/BugzillaUiBridge.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Apr 6, 2005
- */
-package org.eclipse.mylar.tasks.bugzilla.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.mylar.bugzilla.ui.BugzillaOpenStructure;
-import org.eclipse.mylar.bugzilla.ui.ViewBugzillaAction;
-import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.bugzilla.ui.outline.BugzillaOutlinePage;
-import org.eclipse.mylar.core.model.ITaskscapeNode;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaReferencesProvider;
-import org.eclipse.mylar.tasks.ui.BugzillaTaskEditor;
-import org.eclipse.mylar.ui.IMylarUiBridge;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
-
-public class BugzillaUiBridge implements IMylarUiBridge {
-
- protected BugzillaNodeLabelProvider labelProvider = new BugzillaNodeLabelProvider();
-
- public void open(ITaskscapeNode node) {
- String handle = node.getElementHandle();
- String bugHandle = handle;
- String server =handle.substring(0, handle.indexOf(";"));
-
- handle = handle.substring(handle.indexOf(";") + 1);
- int next = handle.indexOf(";");
-
- int bugId;
- int commentNumer = -1;
- if(next == -1){
- bugId = Integer.parseInt(handle);
- }
- else{
- bugId = Integer.parseInt(handle.substring(0, handle.indexOf(";")));
- commentNumer = Integer.parseInt(handle.substring(handle.indexOf(";") + 1));
- bugHandle = bugHandle.substring(0, next);
- }
-
- List<BugzillaOpenStructure> l = new ArrayList<BugzillaOpenStructure>(1);
- l.add(new BugzillaOpenStructure(server, bugId, commentNumer));
-
- ITask task= MylarTasksPlugin.getTaskListManager().getTaskList().getTaskForId(bugHandle);
- if (task != null && task instanceof BugzillaTask) {
- BugzillaTask bugzillaTask = (BugzillaTask)task;
- bugzillaTask.openTask(commentNumer);
- } else {
- // open the bug in the editor
- ViewBugzillaAction viewBugs = new ViewBugzillaAction("Display bugs in editor", l);
- viewBugs.schedule();
- }
- }
-
- public ILabelProvider getLabelProvider() {
- return labelProvider;
- }
-
- public void close(ITaskscapeNode node) {
- IWorkbenchPage page = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage();
- if (page != null) {
- IEditorReference[] references = page.getEditorReferences();
- for (int i = 0; i < references.length; i++) {
- IEditorPart part = references[i].getEditor(false);
- if (part != null) {
- if (part instanceof AbstractBugEditor) {
- ((AbstractBugEditor)part).close();
- } else if(part instanceof BugzillaTaskEditor){
- ((BugzillaTaskEditor)part).close();
- }
- }
- }
- }
- }
-
- public boolean acceptsEditor(IEditorPart editorPart) {
- return editorPart instanceof AbstractBugEditor;
- }
-
- public List<TreeViewer> getTreeViewers(IEditorPart editor) {
- ArrayList<TreeViewer> outlines = new ArrayList<TreeViewer>(1);
- TreeViewer outline = getOutlineTreeViewer(editor);
- if (outline != null) {
- outlines.add(outline);
- return outlines;
- } else {
- return Collections.emptyList();
- }
- }
-
- protected TreeViewer getOutlineTreeViewer(IEditorPart editor) {
- if(editor instanceof AbstractBugEditor){
- AbstractBugEditor abe = (AbstractBugEditor)editor;
- BugzillaOutlinePage outline = abe.getOutline();
- if(outline != null) return outline.getOutlineTreeViewer();
- }
- return null;
- }
-
- public void refreshOutline(Object element, boolean updateLabels) {
- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- TreeViewer treeViewer = getOutlineTreeViewer(editorPart);
- if (treeViewer != null) {
- treeViewer.refresh(true);
-
- treeViewer.expandAll();
- }
- }
-
- public ImageDescriptor getIconForRelationship(String relationshipHandle) {
- return MylarImages.EDGE_REF_BUGZILLA;
-
- }
-
- public String getNameForRelationship(String relationshipHandle) {
- return BugzillaReferencesProvider.NAME;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java
deleted file mode 100644
index 66de9939e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on 31-Jan-2005
- */
-package org.eclipse.mylar.tasks.ui;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.IBugzillaAttributeListener;
-import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditor;
-import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditorInput;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * @author Eric Booth
- */
-public class BugzillaTaskEditor extends MultiPageEditorPart {
-
- /** The task that created this editor */
- protected BugzillaTask bugTask;
-
- /** This bug report can be modified by the user and saved offline. */
- protected BugReport offlineBug;
-
- private ExistingBugEditor bugzillaEditor;
-
- private BugzillaTaskEditorInput bugzillaEditorInput;
-
- private TaskSummaryEditor taskSummaryEditor = new TaskSummaryEditor();
-
- protected IContentOutlinePage outlinePage = null;
-
- private IBugzillaAttributeListener ATTRIBUTE_LISTENER = new IBugzillaAttributeListener() {
- public void attributeChanged(String attribute, String value) {
- if (attribute.equals("Priority")) {
- bugTask.setPriority(value);
- if (TaskListView.getDefault() != null) TaskListView.getDefault().notifyTaskDataChanged(bugTask);
- }
- }
- };
-
-
- public BugzillaTaskEditor() {
- super();
-
- // get the workbench page and add a listener so we can detect when it closes
- IWorkbench wb = MylarTasksPlugin.getDefault().getWorkbench();
- IWorkbenchWindow aw = wb.getActiveWorkbenchWindow();
- IWorkbenchPage ap = aw.getActivePage();
- BugzillaTaskEditorListener listener = new BugzillaTaskEditorListener();
- ap.addPartListener(listener);
-
- bugzillaEditor = new ExistingBugEditor();
- bugzillaEditor.addAttributeListener(ATTRIBUTE_LISTENER);
- taskSummaryEditor = new TaskSummaryEditor();
- }
-
- public AbstractBugEditor getBugzillaEditor(){
- return bugzillaEditor;
- }
-
- public TaskSummaryEditor getTaskEditor(){
- return taskSummaryEditor;
- }
-
-
- public void gotoMarker(IMarker marker) {
- // don't do anything
- }
-
- /**
- * Creates page 1 of the multi-page editor,
- * which allows you to change the font used in page 2.
- */
- private void createBugzillaSubmitPage() {
- bugzillaEditor.createPartControl(getContainer());
- Composite composite = bugzillaEditor.getEditorComposite();
- int index = addPage(composite);
- setPageText(index, "Bugzilla");
- }
-
-
- private void createSummaryPage() {
- try{
- int index = addPage(taskSummaryEditor, new TaskEditorInput(bugTask));
- setPageText(index, "Summary");
- }catch(Exception e){
- MylarPlugin.log(e, "summary failed");
- }
- }
-
- /**
- * Creates the pages of the multi-page editor.
- */
- @Override
- protected void createPages() {
- createBugzillaSubmitPage();
- createSummaryPage();
- }
-
- /**
- * Saves the multi-page editor's document.
- */
- @Override
- public void doSave(IProgressMonitor monitor) {
- getEditor(0).doSave(monitor);
- }
-
- /**
- * Saves the multi-page editor's document as another file.
- * Also updates the text for page 0's tab, and updates this multi-page editor's input
- * to correspond to the nested editor's.
- */
- @Override
- public void doSaveAs() {
- IEditorPart editor = getEditor(0);
- editor.doSaveAs();
- setPageText(0, editor.getTitle());
- setInput(editor.getEditorInput());
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
- if (!(editorInput instanceof BugzillaTaskEditorInput))
- throw new PartInitException("Invalid Input: Must be BugzillaTaskEditorInput");
- bugzillaEditorInput = (BugzillaTaskEditorInput) editorInput;
- bugTask = bugzillaEditorInput.getBugTask();
-
- offlineBug = bugzillaEditorInput.getOfflineBug();
- super.init(site, editorInput);
- super.setSite(site);
- super.setInput(editorInput);
-
- try {
- bugzillaEditor.init(this.getEditorSite(), this.getEditorInput());
- }
- catch (Exception e) {
- throw new PartInitException(e.getMessage());
- }
-
- // Set the title on the editor's tab
- this.setPartName("Bug #" + bugzillaEditorInput.getBugId());
- this.setTitleImage(MylarImages.getImage(MylarImages.TASK_BUGZILLA));
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * Calculates the contents of page 2 when the it is activated.
- */
- @Override
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- }
-
- /**
- * Sets the font related data to be applied to the text in page 2.
- */
- @Override
- public void setFocus() {
- // The default focus for this editor is the submit page
- bugzillaEditor.setFocus();
- }
-
- /**
- * @return Returns the bugTask.
- */
- public BugzillaTask getBugTask() {
- return bugTask;
- }
-
- /**
- * @return Returns the offlineBug.
- */
- public BugReport getOfflineBug() {
- return offlineBug;
- }
-
- /**
- * Updates the title of the editor to reflect dirty status.
- * If the bug report has been modified but not saved, then
- * an indicator will appear in the title.
- * @param isDirty
- * is true when the bug report has been modified but not saved
- */
- public void showDirtyStatus(boolean isDirty) {
- String prefix = (isDirty) ? "*" : "" ;
- setPartName(prefix + "Bug #" + bugzillaEditorInput.getBugId());
- }
-
- /**
- * Class to listen for editor events
- */
- private class BugzillaTaskEditorListener implements IPartListener
- {
-
- public void partActivated(IWorkbenchPart part) {
- // don't care about this event
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- // don't care about this event
- }
-
- public void partClosed(IWorkbenchPart part) {
-
- // if we are closing a bug editor
- if (part instanceof BugzillaTaskEditor) {
- BugzillaTaskEditor taskEditor = (BugzillaTaskEditor)part;
-
- // check if it needs to be saved
- if (taskEditor.bugzillaEditor.isDirty) {
- // ask the user whether they want to save it or not and perform the appropriate action
- taskEditor.bugzillaEditor.changeDirtyStatus(false);
- boolean response = MessageDialog.openQuestion(null, "Save Changes",
- "You have made some changes to the bug, do you want to save them?");
- if (response) {
- taskEditor.bugzillaEditor.saveBug();
- } else {
- ExistingBugEditorInput input = (ExistingBugEditorInput)taskEditor.bugzillaEditor.getEditorInput();
- bugTask.setPriority(input.getBug().getAttribute("Priority").getValue());
- }
- }
- }
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- // don't care about this event
- }
-
- public void partOpened(IWorkbenchPart part) {
- // don't care about this event
- }
- }
-
- public void makeNewPage(BugReport serverBug, String newCommentText) {
- if (serverBug == null) {
- MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Could not open bug.", "Bug #" + offlineBug.getId()
- + " could not be read from the server. Try refreshing the bug task.");
- return;
- }
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- return bugzillaEditor.getAdapter(adapter);
- }
-
- public void close() {
- Display display= getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- getSite().getPage().closeEditor(BugzillaTaskEditor.this, false);
- }
- });
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditorInput.java
deleted file mode 100644
index af9e7f5e9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditorInput.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on 1-Feb-2005
- */
-package org.eclipse.mylar.tasks.ui;
-
-import java.io.IOException;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditorInput;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.ui.IPersistableElement;
-
-
-/**
- * @author Eric Booth
- */
-public class BugzillaTaskEditorInput extends ExistingBugEditorInput {
-
-
- private String bugTitle;
-
- private BugReport offlineBug;
-
- private BugzillaTask bugTask;
-
- public BugzillaTaskEditorInput(BugzillaTask bugTask) throws LoginException, IOException {
- super(BugzillaTask.getBugId(bugTask.getHandle()));
- this.bugTask = bugTask;
- offlineBug = bugTask.getBugReport();
- bugId = BugzillaTask.getBugId(bugTask.getHandle());
- bugTitle = "";
- }
-
- protected void setBugTitle(String str) {
- // 03-20-03 Allows editor to store title (once it is known)
- bugTitle = str;
- }
-
- @Override
- public boolean exists() {
- return true;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- @Override
- public String getName() {
- return "Bug #" + bugId;
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- @Override
- public String getToolTipText() {
- return bugTitle;
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public int getBugId() {
- return bugId;
- }
-
- /**
- * Returns the online server bug for this input
- *
- * @see BugzillaRepository
- * @see BugReport
- */
-// public BugReport getServerBug() {
-// return serverBug;
-// }
-
- /**
- * Returns the offline bug for this input's Bugzilla task
- */
- public BugReport getOfflineBug() {
- return offlineBug;
- }
-
- /**
- * Gets the bug page input stream
- */
-// public InputStream getInputStream() throws IOException {
-// try {
-// return url.openStream();
-// }
-// catch (Exception e) {
-// throw new IOException(e.getMessage());
-// }
-//
-// }
-
- /**
- * Returns true if the argument is a bug report editor input on the same bug id.
- */
- @Override
- public boolean equals(Object o) {
- if (o instanceof BugzillaTaskEditorInput) {
- BugzillaTaskEditorInput input = (BugzillaTaskEditorInput) o;
- return getBugId() == input.getBugId();
- }
- return false;
- }
-
- /**
- * @return Returns the <code>BugzillaTask</code>
- */
- public BugzillaTask getBugTask() {
- return bugTask;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
index 7ab14f26b..2ddd6cd38 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
@@ -41,15 +41,13 @@ import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskActivityListener;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.RelatedLinks;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.mylar.tasks.util.RelativePathUtil;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.mylar.ui.MylarUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.FocusEvent;
@@ -99,6 +97,12 @@ import org.eclipse.ui.part.EditorPart;
* @author Ken Sueda
*/
public class TaskSummaryEditor extends EditorPart {
+
+ /**
+ * TODO: use workbench theme
+ */
+ public static final Color HYPERLINK = new Color(Display.getDefault(), 0, 0, 255);
+
private ITask task;
private TaskEditorInput editorInput;
private Composite editorComposite;
@@ -317,7 +321,7 @@ public class TaskSummaryEditor extends EditorPart {
TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
td.colspan = 2;
description.setLayoutData(td);
- if (task instanceof BugzillaTask) {
+ if (task.canEditDescription()) {
description.setEnabled(false);
} else {
description.addFocusListener(new FocusListener() {
@@ -673,7 +677,7 @@ public class TaskSummaryEditor extends EditorPart {
}
public Color getForeground(Object element) {
- return MylarUiPlugin.getDefault().getColorMap().HYPERLINK;
+ return HYPERLINK;
}
public Color getBackground(Object element) {
@@ -704,7 +708,7 @@ public class TaskSummaryEditor extends EditorPart {
return null;
}
public Color getForeground(Object element) {
- return MylarUiPlugin.getDefault().getColorMap().HYPERLINK;
+ return HYPERLINK;
}
public Color getBackground(Object element) {
@@ -790,7 +794,7 @@ public class TaskSummaryEditor extends EditorPart {
};
delete.setText("Delete");
delete.setToolTipText("Delete");
- delete.setImageDescriptor(MylarImages.REMOVE);
+ delete.setImageDescriptor(TaskListImages.REMOVE);
add = new Action() {
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java
index a0566e3a4..29cf2c923 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java
@@ -15,12 +15,10 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaHit;
-import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.ui.internal.Workbench;
/**
@@ -37,7 +35,7 @@ public class ClearContextAction extends Action {
setText("Clear Task Context");
setToolTipText("Clear Task Context");
setId(ID);
- setImageDescriptor(MylarImages.ERASE_TASKSCAPE);
+ setImageDescriptor(TaskListImages.ERASE_TASKSCAPE);
}
@Override
@@ -53,24 +51,26 @@ public class ClearContextAction extends Action {
MylarPlugin.getTaskscapeManager().taskDeleted(((ITask)selectedObject).getHandle(), ((Task)selectedObject).getPath());
this.view.getViewer().refresh();
- } else if (selectedObject != null && selectedObject instanceof BugzillaHit) {
- BugzillaTask task = ((BugzillaHit)selectedObject).getAssociatedTask();
- if(task != null){
- if (task.isActive()) {
- MessageDialog.openError(Workbench.getInstance()
- .getActiveWorkbenchWindow().getShell(), "Clear context failed",
- "Task must be deactivated before clearing task context.");
- return;
- }
- boolean deleteConfirmed = MessageDialog.openQuestion(
- Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Confirm clear context",
- "Clear context for the selected task?");
- if (!deleteConfirmed)
- return;
- MylarPlugin.getTaskscapeManager().taskDeleted(task.getHandle(), task.getPath());
- }
- this.view.getViewer().refresh();
- }
+ }
+ // XXX: refactored put this somewhere
+// else if (selectedObject != null && selectedObject instanceof BugzillaHit) {
+// BugzillaTask task = ((BugzillaHit)selectedObject).getAssociatedTask();
+// if(task != null){
+// if (task.isActive()) {
+// MessageDialog.openError(Workbench.getInstance()
+// .getActiveWorkbenchWindow().getShell(), "Clear context failed",
+// "Task must be deactivated before clearing task context.");
+// return;
+// }
+// boolean deleteConfirmed = MessageDialog.openQuestion(
+// Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+// "Confirm clear context",
+// "Clear context for the selected task?");
+// if (!deleteConfirmed)
+// return;
+// MylarPlugin.getTaskscapeManager().taskDeleted(task.getHandle(), task.getPath());
+// }
+// this.view.getViewer().refresh();
+// }
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaQueryCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaQueryCategoryAction.java
deleted file mode 100644
index e18fb2346..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaQueryCategoryAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.ui.actions;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.ui.views.BugzillaQueryDialog;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Mik Kersten and Ken Sueda
- */
-public class CreateBugzillaQueryCategoryAction extends Action {
-
- public static final String ID = "org.eclipse.mylar.tasks.actions.create.bug.query";
-
- private final TaskListView view;
-
- public CreateBugzillaQueryCategoryAction(TaskListView view) {
- this.view = view;
- setText("Add Bugzilla Query");
- setToolTipText("Add Bugzilla Query");
- setId(ID);
- setImageDescriptor(MylarImages.CATEGORY_QUERY_NEW);
- }
-
- @Override
- public void run() {
-
- // ask the user for the query string and a name
-// MylarPlugin.getDefault().actionObserved(this);
- BugzillaQueryDialog sqd = new BugzillaQueryDialog(Display.getCurrent().getActiveShell());
- if(sqd.open() == Dialog.OK){
- final BugzillaQueryCategory queryCategory = new BugzillaQueryCategory(sqd.getName(), sqd.getUrl());
-
- MylarTasksPlugin.getTaskListManager().getTaskList().addCategory(queryCategory);
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- queryCategory.refreshBugs();
- }
- };
-
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- try {
- service.run(true, true, op);
- } catch (Exception e) {
- MylarPlugin.log(e, "There was a problem executing the query refresh");
- }
- this.view.getViewer().refresh();
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaTaskAction.java
deleted file mode 100644
index c1c4fce1e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateBugzillaTaskAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-
-/**
- * @author Mik Kersten and Ken Sueda
- */
-public class CreateBugzillaTaskAction extends Action {
-
- public static final String ID = "org.eclipse.mylar.tasks.actions.create.bug";
-
- private final TaskListView view;
-
- public CreateBugzillaTaskAction(TaskListView view) {
- this.view = view;
- setText("Add Bugzilla Report");
- setToolTipText("Add Bugzilla Report");
- setId(ID);
- setImageDescriptor(MylarImages.TASK_BUGZILLA_NEW);
- }
-
- @Override
- public void run() {
-// MylarPlugin.getDefault().actionObserved(this);
- String bugIdString = this.view.getBugIdFromUser();
- int bugId = -1;
- try {
- if (bugIdString != null) {
- bugId = Integer.parseInt(bugIdString);
- } else {
- return;
- }
- } catch (NumberFormatException nfe) {
- this.view.showMessage("Please enter a valid report number");
- return;
- }
-
- // XXX we don't care about duplicates since we use a registrey
- // Check the existing tasks to see if the id is used already.
- // This is to prevent the creation of mutliple Bugzilla tasks
- // for the same Bugzilla report.
-// boolean doesIdExistAlready = false;
-// doesIdExistAlready = lookForId("Bugzilla-" + bugId);
-// if (doesIdExistAlready) {
-// showMessage("A Bugzilla task with ID Bugzilla-" + bugId + " already exists.");
-// return;
-// }
-
- ITask newTask = new BugzillaTask("Bugzilla-"+bugId, "<bugzilla info>");
- Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
- if (selectedObject instanceof TaskCategory){
- ((TaskCategory)selectedObject).addTask(newTask);
- } else {
- MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(newTask);
- }
- this.view.getViewer().refresh();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java
index 9720835dc..1e865d23c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java
@@ -12,10 +12,10 @@
package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
/**
* @author Mik Kersten and Ken Sueda
@@ -31,7 +31,7 @@ public class CreateCategoryAction extends Action {
setText("Add Category");
setToolTipText("Add Category");
setId(ID);
- setImageDescriptor(MylarImages.CATEGORY_NEW);
+ setImageDescriptor(TaskListImages.CATEGORY_NEW);
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java
index b696a13ce..9c2c9d318 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java
@@ -13,12 +13,11 @@ package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.mylar.ui.MylarUiPlugin;
/**
* @author Mik Kersten and Ken Sueda
@@ -34,7 +33,7 @@ public class CreateTaskAction extends Action {
setText("Add Task");
setToolTipText("Add Task");
setId(ID);
- setImageDescriptor(MylarImages.TASK_NEW);
+ setImageDescriptor(TaskListImages.TASK_NEW);
}
@Override
@@ -62,9 +61,9 @@ public class CreateTaskAction extends Action {
else {
MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(newTask);
}
- MylarUiPlugin.getDefault().setHighlighterMapping(
- newTask.getHandle(),
- MylarUiPlugin.getDefault().getDefaultHighlighter().getName());
+// MylarUiPlugin.getDefault().setHighlighterMapping(
+// newTask.getHandle(),
+// MylarUiPlugin.getDefault().getDefaultHighlighter().getName());
this.view.getViewer().refresh();
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java
index 4254cf0bc..71c21acf2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java
@@ -15,13 +15,11 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.internal.Workbench;
@@ -38,7 +36,7 @@ public class DeleteAction extends Action {
this.view = view;
setText("Delete");
setId(ID);
- setImageDescriptor(MylarImages.REMOVE);
+ setImageDescriptor(TaskListImages.REMOVE);
}
@Override
@@ -55,12 +53,7 @@ public class DeleteAction extends Action {
return;
}
- String message = "";
- if (selectedObject instanceof BugzillaTask) {
- message = "Remove this report from the task list, and discard any task context or local notes?";
- } else {
- message = "Delete the selected task and discard task context?";
- }
+ String message = task.getDeleteConfirmationMessage();
boolean deleteConfirmed = MessageDialog.openQuestion(
Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
"Confirm delete", message);
@@ -99,16 +92,17 @@ public class DeleteAction extends Action {
}
}
}
- MylarTasksPlugin.getTaskListManager().deleteCategory((TaskCategory) selectedObject);
- } else if (selectedObject instanceof BugzillaQueryCategory) {
- boolean deleteConfirmed = MessageDialog.openQuestion(
- Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
- "Confirm delete",
- "Delete the selected query and all contained tasks?");
- if (!deleteConfirmed)
- return;
- BugzillaQueryCategory cat = (BugzillaQueryCategory) selectedObject;
MylarTasksPlugin.getTaskListManager().deleteCategory(cat);
+ // XXX refactored
+// } else if (selectedObject instanceof BugzillaQueryCategory) {
+// boolean deleteConfirmed = MessageDialog.openQuestion(
+// Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+// "Confirm delete",
+// "Delete the selected query and all contained tasks?");
+// if (!deleteConfirmed)
+// return;
+// BugzillaQueryCategory cat = (BugzillaQueryCategory) selectedObject;
+// MylarTasksPlugin.getTaskListManager().deleteCategory(cat);
} else {
MessageDialog.openError(Workbench.getInstance()
.getActiveWorkbenchWindow().getShell(), "Delete failed",
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/FilterCompletedTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/FilterCompletedTasksAction.java
index 1872b725c..a63c707c7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/FilterCompletedTasksAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/FilterCompletedTasksAction.java
@@ -12,9 +12,9 @@
package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
/**
* @author Mik Kersten and Ken Sueda
@@ -30,7 +30,7 @@ public class FilterCompletedTasksAction extends Action {
setText("Filter Completed Tasks");
setToolTipText("Filter Completed Tasks");
setId(ID);
- setImageDescriptor(MylarImages.FILTER_COMPLETE);
+ setImageDescriptor(TaskListImages.FILTER_COMPLETE);
setChecked(MylarTasksPlugin.getDefault().isFilterCompleteMode());
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java
index 2ef8cdb61..ed00ec76e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java
@@ -13,9 +13,9 @@ package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
/**
* @author Mik Kersten and Ken Sueda
@@ -31,7 +31,7 @@ public class MarkTaskCompleteAction extends Action {
setText("Mark Complete");
setToolTipText("Mark Complete");
setId(ID);
- setImageDescriptor(MylarImages.TASK_COMPLETE);
+ setImageDescriptor(TaskListImages.TASK_COMPLETE);
}
@Override
public void run() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskIncompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskIncompleteAction.java
index d990812c7..759e27cd6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskIncompleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskIncompleteAction.java
@@ -13,9 +13,9 @@ package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
/**
* @author Mik Kersten and Ken Sueda
@@ -31,7 +31,7 @@ public class MarkTaskIncompleteAction extends Action {
setText("Mark Incomplete");
setToolTipText("Mark Incomplete");
setId(ID);
- setImageDescriptor(MylarImages.TASK_INCOMPLETE);
+ setImageDescriptor(TaskListImages.TASK_INCOMPLETE);
}
@Override
public void run() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MoveTaskToRootAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MoveTaskToRootAction.java
index cb49a7c8e..d3a0a3d3c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MoveTaskToRootAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MoveTaskToRootAction.java
@@ -12,11 +12,6 @@
package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
/**
@@ -35,23 +30,24 @@ public class MoveTaskToRootAction extends Action {
}
@Override
public void run() {
- ISelection selection = this.view.getViewer().getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- if (obj instanceof ITask) {
- ITask t = (ITask) obj;
- TaskCategory cat = t.getCategory();
- if (cat != null) {
- cat.removeTask(t);
- t.setCategory(null);
- t.setParent(null);
- MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(t);
- this.view.getViewer().refresh();
- } else if (t.getParent() != null) {
- t.getParent().removeSubTask(t);
- t.setParent(null);
- MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(t);
- this.view.getViewer().refresh();
- }
- }
+ throw new RuntimeException("unimplemented");
+// ISelection selection = this.view.getViewer().getSelection();
+// Object obj = ((IStructuredSelection)selection).getFirstElement();
+// if (obj instanceof ITask) {
+// ITask t = (ITask) obj;
+// TaskCategory cat = t.getCategory();
+// if (cat != null) {
+// cat.removeTask(t);
+// t.setCategory(null);
+// t.setParent(null);
+// MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(t);
+// this.view.getViewer().refresh();
+// } else if (t.getParent() != null) {
+// t.getParent().removeSubTask(t);
+// t.setParent(null);
+// MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask(t);
+// this.view.getViewer().refresh();
+// }
+// }
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java
index f345a097f..38bbf196f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java
@@ -13,22 +13,9 @@ package org.eclipse.mylar.tasks.ui.actions;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.bugzilla.ui.BugzillaOpenStructure;
-import org.eclipse.mylar.bugzilla.ui.ViewBugzillaAction;
-import org.eclipse.mylar.tasks.BugzillaHit;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.ui.views.BugzillaQueryDialog;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
@@ -54,54 +41,55 @@ public class OpenTaskEditorAction extends Action {
@Override
public void run() {
-// MylarPlugin.getDefault().actionObserved(this);
- ISelection selection = this.view.getViewer().getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- if (obj instanceof ITask) {
- if (obj instanceof BugzillaTask) {
- BugzillaTask t = (BugzillaTask) obj;
- MylarTasksPlugin.Report_Open_Mode mode = MylarTasksPlugin.getDefault().getReportMode();
- if (mode == MylarTasksPlugin.Report_Open_Mode.EDITOR) {
- t.openTaskInEditor();
- } else if (mode == MylarTasksPlugin.Report_Open_Mode.INTERNAL_BROWSER) {
- openUrl(t.getBugUrl());
- } else {
- // not supported
- }
- } else {
- ((ITask)obj).openTaskInEditor();
- }
- } else if (obj instanceof BugzillaQueryCategory){
-
- BugzillaQueryDialog sqd = new BugzillaQueryDialog(Display.getCurrent().getActiveShell());
- if(sqd.open() == Dialog.OK){
- BugzillaQueryCategory queryCategory = (BugzillaQueryCategory)obj;
- queryCategory.setDescription(sqd.getName());
- queryCategory.setUrl(sqd.getUrl());
-
- queryCategory.refreshBugs();
- this.view.getViewer().refresh();
- }
- } else if(obj instanceof BugzillaHit){
- BugzillaHit hit = (BugzillaHit)obj;
- MylarTasksPlugin.Report_Open_Mode mode = MylarTasksPlugin.getDefault().getReportMode();
- if (mode == MylarTasksPlugin.Report_Open_Mode.EDITOR) {
- if(hit.isTask()){
- hit.getAssociatedTask().openTaskInEditor();
- } else {
- BugzillaOpenStructure open = new BugzillaOpenStructure(((BugzillaHit)obj).getServerName(), ((BugzillaHit)obj).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 == MylarTasksPlugin.Report_Open_Mode.INTERNAL_BROWSER) {
- openUrl(hit.getBugUrl());
- } else {
- // not supported
- }
- }
- this.view.getViewer().refresh(obj);
+ throw new RuntimeException("unimplemented");
+ // XXX refactored
+// ISelection selection = this.view.getViewer().getSelection();
+// Object obj = ((IStructuredSelection)selection).getFirstElement();
+// if (obj instanceof ITask) {
+// if (obj instanceof BugzillaTask) {
+// BugzillaTask t = (BugzillaTask) obj;
+// MylarTasksPlugin.Report_Open_Mode mode = MylarTasksPlugin.getDefault().getReportMode();
+// if (mode == MylarTasksPlugin.Report_Open_Mode.EDITOR) {
+// t.openTaskInEditor();
+// } else if (mode == MylarTasksPlugin.Report_Open_Mode.INTERNAL_BROWSER) {
+// openUrl(t.getBugUrl());
+// } else {
+// // not supported
+// }
+// } else {
+// ((ITask)obj).openTaskInEditor();
+// }
+// } else if (obj instanceof BugzillaQueryCategory){
+//
+// BugzillaQueryDialog sqd = new BugzillaQueryDialog(Display.getCurrent().getActiveShell());
+// if(sqd.open() == Dialog.OK){
+// BugzillaQueryCategory queryCategory = (BugzillaQueryCategory)obj;
+// queryCategory.setDescription(sqd.getName());
+// queryCategory.setUrl(sqd.getUrl());
+//
+// queryCategory.refreshBugs();
+// this.view.getViewer().refresh();
+// }
+// } else if(obj instanceof BugzillaHit){
+// BugzillaHit hit = (BugzillaHit)obj;
+// MylarTasksPlugin.Report_Open_Mode mode = MylarTasksPlugin.getDefault().getReportMode();
+// if (mode == MylarTasksPlugin.Report_Open_Mode.EDITOR) {
+// if(hit.isTask()){
+// hit.getAssociatedTask().openTaskInEditor();
+// } else {
+// BugzillaOpenStructure open = new BugzillaOpenStructure(((BugzillaHit)obj).getServerName(), ((BugzillaHit)obj).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 == MylarTasksPlugin.Report_Open_Mode.INTERNAL_BROWSER) {
+// openUrl(hit.getBugUrl());
+// } else {
+// // not supported
+// }
+// }
+// this.view.getViewer().refresh(obj);
}
private void openUrl(String url) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaAction.java
deleted file mode 100644
index d1774762e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Ken Sueda
- */
-public class RefreshBugzillaAction extends Action {
-
- public static final String ID = "org.eclipse.mylar.tasks.actions.refresh.bugzilla";
-
- private final TaskListView view;
- public RefreshBugzillaAction(TaskListView view) {
- this.view = view;
- setText("Bugzilla Rrefresh");
- setToolTipText("Bugzilla Refresh");
- setId(ID);
- setImageDescriptor(MylarImages.TASK_BUG_REFRESH);
- }
- @Override
- public void run() {
- ISelection selection = this.view.getViewer().getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- final BugzillaQueryCategory cat = (BugzillaQueryCategory) obj;
- if (obj instanceof BugzillaQueryCategory) {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- cat.refreshBugs();
- RefreshBugzillaAction.this.view.getViewer().refresh();
- }
- });
- }
- };
- // Use the progess service to execute the runnable
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- try {
- service.run(true, false, op);
- } catch (InvocationTargetException e) {
- // Operation was canceled
- MylarPlugin.log(e, e.getMessage());
- } catch (InterruptedException e) {
- // Handle the wrapped exception
- MylarPlugin.log(e, e.getMessage());
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaReportsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaReportsAction.java
deleted file mode 100644
index cf2ff428c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/RefreshBugzillaReportsAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.bugzilla.core.BugReport;
-import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
-import org.eclipse.mylar.tasks.AbstractCategory;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.tasks.bugzilla.BugzillaStructureBridge;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Mik Kersten and Ken Sueda
- */
-public class RefreshBugzillaReportsAction extends Action {
-
- public static final String ID = "org.eclipse.mylar.tasks.actions.refresh.bugdb";
-
- private final TaskListView view;
-
- private boolean showProgress = true;
-
- public RefreshBugzillaReportsAction(TaskListView view) {
- this.view = view;
- setText("Refresh Bugzilla reports");
- setToolTipText("Refresh Bugzilla reports");
- setId(ID);
- setImageDescriptor(MylarImages.TASK_BUG_REFRESH);
- }
-
- public void setShowProgress(boolean show) {
- this.showProgress = show;
- }
-
- @Override
- public void run() {
-// MylarPlugin.getDefault().actionObserved(this);
- // TODO background?
- // perform the update in an operation so that we get a progress monitor
- // update the structure bridge cache with the reference provider cached
- // bugs
- if (showProgress) {
- runWithProgressBar();
- } else {
- refreshTasksAndQueries();
- }
- }
-
- private void runWithProgressBar() {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor)
- throws CoreException {
-
- refreshTasksAndQueries();
-
- // clear the caches
- Set<String> cachedHandles = new HashSet<String>();
- cachedHandles.addAll(MylarTasksPlugin.getDefault().getStructureBridge().getCachedHandles());
- cachedHandles.addAll(MylarTasksPlugin.getReferenceProvider().getCachedHandles());
- MylarTasksPlugin.getDefault().getStructureBridge().clearCache();
- MylarTasksPlugin.getReferenceProvider().clearCachedReports();
- BugzillaStructureBridge bridge = MylarTasksPlugin.getDefault().getStructureBridge();
- monitor.beginTask("Downloading Bugs", cachedHandles.size());
- for (String key : cachedHandles) {
- try {
- String[] parts = key.split(";");
- final int id = Integer.parseInt(parts[1]);
- BugReport bug = BugzillaRepository.getInstance().getCurrentBug(id);
- if (bug != null) {
- bridge.cache(key, bug);
- }
- } catch (Exception e) {
- }
-
- monitor.worked(1);
- }
- monitor.done();
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
- }
- };
-
- // Use the progess service to execute the runnable
- IProgressService service = PlatformUI.getWorkbench()
- .getProgressService();
- try {
- service.run(true, false, op);
- } catch (InvocationTargetException e) {
- // Operation was canceled
- } catch (InterruptedException e) {
- // Handle the wrapped exception
- }
- }
-
- private void refreshTasksAndQueries() {
- List<ITask> tasks = MylarTasksPlugin.getTaskListManager().getTaskList().getRootTasks();
-
- for (ITask task : tasks) {
- if (task instanceof BugzillaTask) {
- ((BugzillaTask) task).refresh();
- }
- }
- for (AbstractCategory cat : MylarTasksPlugin
- .getTaskListManager().getTaskList().getCategories()) {
- if (cat instanceof TaskCategory) {
- for (ITask task : ((TaskCategory) cat).getChildren()) {
- if (task instanceof BugzillaTask) {
- ((BugzillaTask) task).refresh();
- }
- }
- RefreshBugzillaReportsAction.this.view.refreshChildren(((TaskCategory) cat).getChildren());
- } else if (cat instanceof BugzillaQueryCategory) {
- final BugzillaQueryCategory bqc = (BugzillaQueryCategory) cat;
- PlatformUI.getWorkbench().getDisplay().syncExec(
- new Runnable() {
- public void run() {
- bqc.refreshBugs();
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
- }
- });
- }
- }
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/TaskActivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/TaskActivateAction.java
index 25d0ea42a..1983b0d3c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/TaskActivateAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/TaskActivateAction.java
@@ -30,7 +30,6 @@ public class TaskActivateAction extends Action {
}
public void run() {
-// MylarPlugin.getDefault().actionObserved(this);
MylarTasksPlugin.getTaskListManager().activateTask(task);
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
index d74bf6cf7..a01d1c907 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
@@ -14,21 +14,20 @@
package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
-import org.eclipse.mylar.core.ITaskscapeListener;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.mylar.ui.MylarUiPlugin;
+import org.eclipse.mylar.tasks.TaskListImages;
/**
* @author Mik Kersten
*/
+@Deprecated
public class ToggleIntersectionModeAction extends Action {
public ToggleIntersectionModeAction() {
super();
setText("Intersect Tasskscapes");
setToolTipText("Intersect Taskscapes");
- setImageDescriptor(MylarImages.MYLAR);
+// setImageDescriptor(TaskListImages.);
setActionDefinitionId("org.eclipse.mylar.ui.interest.intersection");
// setChecked(MylarUiPlugin.getDefault().isGlobalFilteringEnabled());
}
@@ -36,7 +35,8 @@ public class ToggleIntersectionModeAction extends Action {
@Override
public void run() {
setChecked(!isChecked());
- MylarUiPlugin.getDefault().setIntersectionMode(isChecked());
- MylarPlugin.getTaskscapeManager().notifyActivePresentationSettingsChange(ITaskscapeListener.UpdateKind.HIGHLIGHTER);
+ MylarPlugin.log("not implemented", this);
+// MylarUiPlugin.getDefault().setIntersectionMode(isChecked());
+// MylarPlugin.getTaskscapeManager().notifyActivePresentationSettingsChange(ITaskscapeListener.UpdateKind.HIGHLIGHTER);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java
deleted file mode 100644
index 54c56ca5c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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.tasks.ui.views;
-
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylar.bugzilla.ui.query.GetQueryDialog;
-import org.eclipse.mylar.bugzilla.ui.query.SaveQueryDialog;
-import org.eclipse.mylar.bugzilla.ui.search.BugzillaSearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * @author Shawn Minto
- */
-public class BugzillaQueryDialog extends Dialog {
-
- private String url;
- private String name;
- private BugzillaSearchOptionPage searchOptionPage;
-
- public BugzillaQueryDialog(Shell parentShell) {
- super(parentShell);
- searchOptionPage = new BugzillaSearchOptionPage();
-
- }
-
- public String getName() {
- return name;
- }
-
- public String getUrl() {
- return url;
- }
-
- @Override
- protected Control createContents(Composite parent) {
- searchOptionPage.createControl(parent);
- searchOptionPage.setVisible(true); // called to initialize the values
- return super.createContents(parent);
- }
-
- @Override
- protected void okPressed(){
- url = searchOptionPage.getSearchURL();
- if(url == null || url.equals("")){
- /*
- * Should never get here. Every implementation of the Java platform is required
- * to support the standard charset "UTF-8"
- */
- return;
- }
- InputDialog getNameDialog = new InputDialog(Display.getCurrent().getActiveShell(), "Bugzilla Query Category Name", "Please enter a name for the bugzilla query category","", new IInputValidator(){
-
- public String isValid(String newText) {
- if(newText != null && !newText.equals("")){
- return null;
- } else {
- return "You must enter a name for the category";
- }
- }
-
- });
- getNameDialog.setBlockOnOpen(true);
- if(getNameDialog.open() == InputDialog.OK){
- name = getNameDialog.getValue();
-
- super.okPressed();
- } else {
- super.cancelPressed();
- }
- }
-
- private class BugzillaSearchOptionPage extends BugzillaSearchPage{
-
- public BugzillaSearchOptionPage(){
- scontainer = new ISearchPageContainer(){
- public ISelection getSelection() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IRunnableContext getRunnableContext() {
- return null;
- }
-
- public void setPerformActionEnabled(boolean state) {
- Button ok = BugzillaQueryDialog.this.getButton(Dialog.OK);
- if(ok != null)
- ok.setEnabled(state);
- }
-
- public int getSelectedScope() {
- return 0;
- }
-
- public void setSelectedScope(int scope) {}
-
- public boolean hasValidScope() {
- return true;
- }
-
- public IWorkingSet[] getSelectedWorkingSets() {
- return null;
- }
-
- public void setSelectedWorkingSets(IWorkingSet[] workingSets) {}
- };
- }
-
- public String getSearchURL() {
- try{
- if(rememberedQuery){
- return getQueryURL(new StringBuffer(input.getQueryParameters(selIndex)));
- } else {
- return getQueryURL(getQueryParameters());
- }
- } catch (UnsupportedEncodingException e){
- /*
- * Do nothing. Every implementation of the Java platform is required
- * to support the standard charset "UTF-8"
- */
- }
- return "";
- }
-
- @Override
- protected Control createSaveQuery(Composite control) {
- GridLayout layout;
- GridData gd;
-
- Group group = new Group(control, SWT.NONE);
- layout = new GridLayout(3, false);
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- gd = new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan = 2;
- group.setLayoutData(gd);
-
- loadButton = new Button(group, SWT.PUSH | SWT.LEFT);
- loadButton.setText("Saved Queries...");
- loadButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- GetQueryDialog qd = new GetQueryDialog(getShell(),
- "Saved Queries", input){
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- Button okButton = super.getButton(IDialogConstants.OK_ID);
- if(okButton != null)
- okButton.setText("Select");
- }
- };
-
- if (qd.open() == InputDialog.OK) {
- selIndex = qd.getSelected();
- if (selIndex != -1) {
- rememberedQuery = true;
- }
- } else {
- rememberedQuery = false;
- }
- }
- });
- loadButton.setEnabled(true);
- loadButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- saveButton = new Button(group, SWT.PUSH | SWT.LEFT);
- saveButton.setText("Remember...");
- saveButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- SaveQueryDialog qd = new SaveQueryDialog(getShell(),
- "Remember Query");
- if (qd.open() == InputDialog.OK) {
- String qName = qd.getText();
- if (qName != null && qName.compareTo("") != 0) {
- try {
- input.add(getQueryParameters().toString(), qName, summaryPattern.getText());
- }
- catch (UnsupportedEncodingException e) {
- /*
- * Do nothing. Every implementation of the Java platform is required
- * to support the standard charset "UTF-8"
- */
- }
- }
- }
- }
- });
- saveButton.setEnabled(true);
- saveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- return group;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java
index a6af5e8d8..eba348ed3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java
@@ -18,15 +18,7 @@ import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.mylar.tasks.AbstractCategory;
-import org.eclipse.mylar.tasks.BugzillaHit;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
-import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.ui.MylarUiPlugin;
-import org.eclipse.mylar.ui.internal.UiUtil;
-import org.eclipse.mylar.ui.internal.views.Highlighter;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -59,44 +51,43 @@ public class TaskListLabelProvider extends LabelProvider implements ITableLabelP
}
public Font getFont(Object element) {
- if (element instanceof ITask) {
- ITask task = (ITask)element;
- if (task.isActive()) return UiUtil.BOLD;
-// if (task.isCompleted()) return UiUtil.ITALIC;
- for (ITask child : task.getChildren()) {
- if (child.isActive())
- return UiUtil.BOLD;
- }
- if (task instanceof BugzillaTask) {
- if (((BugzillaTask)task).getState() != BugzillaTask.BugTaskState.FREE) {
- return UiUtil.ITALIC;
- }
- }
- } else if (element instanceof TaskCategory) {
- TaskCategory cat = (TaskCategory) element;
- for (ITask child : cat.getChildren()) {
- if (child.isActive())
- return UiUtil.BOLD;
- }
- } else if (element instanceof BugzillaHit) {
- BugzillaHit hit = (BugzillaHit)element;
- BugzillaTask task = hit.getAssociatedTask();
- if(task != null){
- if (task.isActive()) return UiUtil.BOLD;
-// if (task.isCompleted()) return UiUtil.ITALIC;
- }
- } else if (element instanceof BugzillaQueryCategory) {
- BugzillaQueryCategory cat = (BugzillaQueryCategory) element;
- for (ITaskListElement child : cat.getHits()) {
- if (child instanceof BugzillaHit){
- BugzillaHit hit = (BugzillaHit) child;
- BugzillaTask task = hit.getAssociatedTask();
- if(task != null && task.isActive()){
- return UiUtil.BOLD;
- }
- }
- }
- }
+ // XXX refactored
+// if (element instanceof ITask) {
+// ITask task = (ITask)element;
+// if (task.isActive()) return UiUtil.BOLD;
+// for (ITask child : task.getChildren()) {
+// if (child.isActive())
+// return UiUtil.BOLD;
+// }
+// if (task instanceof BugzillaTask) {
+// if (((BugzillaTask)task).getState() != BugzillaTask.BugTaskState.FREE) {
+// return UiUtil.ITALIC;
+// }
+// }
+// } else if (element instanceof TaskCategory) {
+// TaskCategory cat = (TaskCategory) element;
+// for (ITask child : cat.getChildren()) {
+// if (child.isActive())
+// return UiUtil.BOLD;
+// }
+// } else if (element instanceof BugzillaHit) {
+// BugzillaHit hit = (BugzillaHit)element;
+// BugzillaTask task = hit.getAssociatedTask();
+// if(task != null){
+// if (task.isActive()) return UiUtil.BOLD;
+// }
+// } else if (element instanceof BugzillaQueryCategory) {
+// BugzillaQueryCategory cat = (BugzillaQueryCategory) element;
+// for (ITaskListElement child : cat.getHits()) {
+// if (child instanceof BugzillaHit){
+// BugzillaHit hit = (BugzillaHit) child;
+// BugzillaTask task = hit.getAssociatedTask();
+// if(task != null && task.isActive()){
+// return UiUtil.BOLD;
+// }
+// }
+// }
+// }
return null;
}
@@ -121,32 +112,34 @@ public class TaskListLabelProvider extends LabelProvider implements ITableLabelP
}
public Color getBackground(Object element) {
- if (element instanceof ITask) {
- ITask task = (ITask)element;
- Highlighter highlighter = MylarUiPlugin.getDefault().getHighlighterForTaskId("" + task.getHandle());
- if (highlighter != null) return highlighter.getHighlightColor();
- } else if (element instanceof BugzillaHit) {
- BugzillaHit hit = (BugzillaHit)element;
- BugzillaTask task = hit.getAssociatedTask();
- if(task != null){
- Highlighter highlighter = MylarUiPlugin.getDefault().getHighlighterForTaskId("" + task.getHandle());
- if (highlighter != null) return highlighter.getHighlightColor();
- }
- }else if (element instanceof AbstractCategory) {
- return backgroundColor;
- }
- return null;
+ // XXX refactored
+// if (element instanceof ITask) {
+// ITask task = (ITask)element;
+// Highlighter highlighter = MylarUiPlugin.getDefault().getHighlighterForTaskId("" + task.getHandle());
+// if (highlighter != null) return highlighter.getHighlightColor();
+// } else if (element instanceof BugzillaHit) {
+// BugzillaHit hit = (BugzillaHit)element;
+// BugzillaTask task = hit.getAssociatedTask();
+// if(task != null){
+// Highlighter highlighter = MylarUiPlugin.getDefault().getHighlighterForTaskId("" + task.getHandle());
+// if (highlighter != null) return highlighter.getHighlightColor();
+// }
+// }else if (element instanceof AbstractCategory) {
+// return backgroundColor;
+// }
+ return null;
}
public Color getForeground(Object element) {
- if (element instanceof ITask) {
- ITask task = (ITask)element;
- if (task.isCompleted()) return MylarUiPlugin.getDefault().getColorMap().GRAY_VERY_LIGHT;
- } else if (element instanceof BugzillaHit) {
- BugzillaHit hit = (BugzillaHit)element;
- BugzillaTask task = hit.getAssociatedTask();
- if (task != null && task.isCompleted()) return MylarUiPlugin.getDefault().getColorMap().GRAY_VERY_LIGHT;
- }
+ // XXX refactored
+// if (element instanceof ITask) {
+// ITask task = (ITask)element;
+// if (task.isCompleted()) return MylarUiPlugin.getDefault().getColorMap().GRAY_VERY_LIGHT;
+// } else if (element instanceof BugzillaHit) {
+// BugzillaHit hit = (BugzillaHit)element;
+// BugzillaTask task = hit.getAssociatedTask();
+// if (task != null && task.isCompleted()) return MylarUiPlugin.getDefault().getColorMap().GRAY_VERY_LIGHT;
+// }
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
index 6ed74c895..49e6d1627 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
@@ -14,13 +14,13 @@ package org.eclipse.mylar.tasks.ui.views;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import javax.security.auth.login.LoginException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -48,39 +48,26 @@ import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
-import org.eclipse.mylar.core.ITaskscapeListener;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.dt.MylarWebRef;
import org.eclipse.mylar.tasks.AbstractCategory;
-import org.eclipse.mylar.tasks.BugzillaHit;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.actions.ClearContextAction;
-import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaQueryCategoryAction;
-import org.eclipse.mylar.tasks.ui.actions.CreateBugzillaTaskAction;
import org.eclipse.mylar.tasks.ui.actions.CreateCategoryAction;
import org.eclipse.mylar.tasks.ui.actions.CreateTaskAction;
import org.eclipse.mylar.tasks.ui.actions.DeleteAction;
import org.eclipse.mylar.tasks.ui.actions.FilterCompletedTasksAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylar.tasks.ui.actions.MarkTaskIncompleteAction;
-import org.eclipse.mylar.tasks.ui.actions.MoveTaskToRootAction;
import org.eclipse.mylar.tasks.ui.actions.OpenTaskEditorAction;
-import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaAction;
-import org.eclipse.mylar.tasks.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylar.ui.MylarImages;
-import org.eclipse.mylar.ui.MylarUiPlugin;
-import org.eclipse.mylar.ui.internal.views.Highlighter;
-import org.eclipse.mylar.ui.internal.views.HighlighterImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceEvent;
@@ -123,15 +110,14 @@ public class TaskListView extends ViewPart {
private static TaskListView INSTANCE;
+ private List<IAction> contributedActions = new ArrayList<IAction>();
+
TreeViewer viewer;
private DrillDownAdapter drillDownAdapter;
- private RefreshBugzillaReportsAction refresh;
private CreateTaskAction createTask;
private CreateCategoryAction createCategory;
- private CreateBugzillaQueryCategoryAction createBugzillaQueryCategory;
- private CreateBugzillaTaskAction createBugzillaTask;
-// private RenameAction rename;
+
private DeleteAction delete;
private OpenTaskEditorAction doubleClickAction;
private ClearContextAction clearSelectedTaskscapeAction;
@@ -145,7 +131,6 @@ public class TaskListView extends ViewPart {
// private FilterIncompleteTasksAction filterInCompleteTask;
private PriorityDropDownAction filterOnPriority;
private Action moveTaskToRoot;
- private RefreshBugzillaAction refreshQuery;
private PriorityFilter priorityFilter = new PriorityFilter();
protected String[] columnNames = new String[] { "", ".", "!", "Description" };
@@ -165,7 +150,7 @@ public class TaskListView extends ViewPart {
super();
setText("Priority Filter");
setToolTipText("Filter priority lower than");
- setImageDescriptor(MylarImages.FILTER_PRIORITY);
+ setImageDescriptor(TaskListImages.FILTER_PRIORITY);
setMenuCreator(this);
}
@@ -293,16 +278,19 @@ public class TaskListView extends ViewPart {
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof ITask) {
return !((ITask)element).isCompleted();
- } else if (element instanceof BugzillaHit){
- BugzillaHit hit = (BugzillaHit)element;
- BugzillaTask task = hit.getAssociatedTask();
- if (task != null) {
- return !task.isCompleted();
- }
- return true;
- } else {
- return true;
- }
+ }
+ return false;
+ // XXX refactored
+// else if (element instanceof BugzillaHit){
+// BugzillaHit hit = (BugzillaHit)element;
+// BugzillaTask task = hit.getAssociatedTask();
+// if (task != null) {
+// return !task.isCompleted();
+// }
+// return true;
+// } else {
+// return true;
+// }
}
};
@@ -402,9 +390,11 @@ public class TaskListView extends ViewPart {
return ((TaskCategory)parent).getChildren().toArray();
} else if (parent instanceof Task) {
return ((Task)parent).getChildren().toArray();
- } else if (parent instanceof BugzillaQueryCategory) {
- return ((BugzillaQueryCategory) parent).getHits().toArray();
}
+ // XXX refactored
+// else if (parent instanceof BugzillaQueryCategory) {
+// return ((BugzillaQueryCategory) parent).getHits().toArray();
+// }
return new Object[0];
}
public boolean hasChildren(Object parent) {
@@ -414,10 +404,12 @@ public class TaskListView extends ViewPart {
} else if (parent instanceof Task) {
Task t = (Task) parent;
return t.getChildren() != null && t.getChildren().size() > 0;
- } else if (parent instanceof BugzillaQueryCategory) {
- BugzillaQueryCategory cat = (BugzillaQueryCategory)parent;
- return cat.getHits() != null && cat.getHits().size() > 0;
}
+ // XXX refactored
+// else if (parent instanceof BugzillaQueryCategory) {
+// BugzillaQueryCategory cat = (BugzillaQueryCategory)parent;
+// return cat.getHits() != null && cat.getHits().size() > 0;
+// }
return false;
}
}
@@ -435,8 +427,9 @@ public class TaskListView extends ViewPart {
switch (columnIndex) {
case 0: return true;
case 1: return false;
- case 2: return !(task instanceof BugzillaTask);
- case 3: return !(task instanceof BugzillaTask);
+ // XXX refactored
+ case 2: return true;//!(task instanceof BugzillaTask);
+ case 3: return true;//!(task instanceof BugzillaTask);
}
} else if (element instanceof AbstractCategory) {
switch (columnIndex) {
@@ -446,13 +439,15 @@ public class TaskListView extends ViewPart {
return false;
case 3: return true;
}
- } else if (element instanceof BugzillaHit){
- if (columnIndex == 0) {
- return true;
- }else {
- return false;
- }
- }
+ }
+ // XXX refactored
+// else if (element instanceof BugzillaHit){
+// if (columnIndex == 0) {
+// return true;
+// }else {
+// return false;
+// }
+// }
return false;
}
@@ -483,24 +478,26 @@ public class TaskListView extends ViewPart {
case 3:
return cat.getDescription(true);
}
- } else if (element instanceof BugzillaHit) {
- BugzillaHit hit = (BugzillaHit) element;
- ITask task = hit.getAssociatedTask();
- switch (columnIndex) {
- case 0:
- if(task == null){
- return new Boolean(true);
- } else {
- return new Boolean(task.isCompleted());
- }
- case 1:
- return "";
- case 2:
- String priorityString = hit.getPriority().substring(1);
- return new Integer(priorityString);
- case 3:
- return hit.getDescription(true);
- }
+ // XXX refactored
+// }
+// else if (element instanceof BugzillaHit) {
+// BugzillaHit hit = (BugzillaHit) element;
+// ITask task = hit.getAssociatedTask();
+// switch (columnIndex) {
+// case 0:
+// if(task == null){
+// return new Boolean(true);
+// } else {
+// return new Boolean(task.isCompleted());
+// }
+// case 1:
+// return "";
+// case 2:
+// String priorityString = hit.getPriority().substring(1);
+// return new Integer(priorityString);
+// case 3:
+// return hit.getDescription(true);
+// }
}
return "";
}
@@ -550,34 +547,36 @@ public class TaskListView extends ViewPart {
viewer.setSelection(null);
break;
}
- } else if (((TreeItem) element).getData() instanceof BugzillaHit) {
- BugzillaHit hit = (BugzillaHit)((TreeItem) element).getData();
- switch (columnIndex) {
- case 0:
- BugzillaTask task = hit.getAssociatedTask();
- if(task == null){
- task = new BugzillaTask(hit);
- hit.setAssociatedTask(task);
- MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry(task);
- // TODO move the task to a special folder
- }
- if (task.isActive()) {
- MylarTasksPlugin.getTaskListManager()
- .deactivateTask(task);
- } else {
- MylarTasksPlugin.getTaskListManager().activateTask(
- task);
- }
- viewer.setSelection(null);
- break;
- case 1:
- break;
- case 2:
- break;
- case 3:
- viewer.setSelection(null);
- break;
- }
+ // XXX refactored
+// }
+// else if (((TreeItem) element).getData() instanceof BugzillaHit) {
+// BugzillaHit hit = (BugzillaHit)((TreeItem) element).getData();
+// switch (columnIndex) {
+// case 0:
+// BugzillaTask task = hit.getAssociatedTask();
+// if(task == null){
+// task = new BugzillaTask(hit);
+// hit.setAssociatedTask(task);
+// MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry(task);
+// // TODO move the task to a special folder
+// }
+// if (task.isActive()) {
+// MylarTasksPlugin.getTaskListManager()
+// .deactivateTask(task);
+// } else {
+// MylarTasksPlugin.getTaskListManager().activateTask(
+// task);
+// }
+// viewer.setSelection(null);
+// break;
+// case 1:
+// break;
+// case 2:
+// break;
+// case 3:
+// viewer.setSelection(null);
+// break;
+// }
}
viewer.refresh();
} catch (Exception e) {
@@ -619,11 +618,12 @@ public class TaskListView extends ViewPart {
if (task1.isCompleted()) return 1;
if (task2.isCompleted()) return -1;
if (column == columnNames[1]) {
- if (task1 instanceof BugzillaTask && !(task2 instanceof BugzillaTask)) {
- return 1;
- } else {
- return -1;
- }
+ // XXX refactored
+// if (task1 instanceof BugzillaTask && !(task2 instanceof BugzillaTask)) {
+// return 1;
+// } else {
+// return -1;
+// }
} else if (column == columnNames[2]) {
return task1.getPriority().compareTo(task2.getPriority());
} else if (column == columnNames[3]) {
@@ -632,19 +632,21 @@ public class TaskListView extends ViewPart {
return 0;
}
}
- } else if(o1 instanceof BugzillaHit && o2 instanceof BugzillaHit){
- BugzillaHit task1 = (BugzillaHit) o1;
- BugzillaHit task2 = (BugzillaHit) o2;
-
- if (column == columnNames[1]) {
- return 0;
- } else if (column == columnNames[2]) {
- return task1.getPriority().compareTo(task2.getPriority());
- } else if (column == columnNames[3]) {
- return task1.getDescription(false).compareTo(task2.getDescription(false));
- } else {
- return 0;
- }
+// }
+ // XXX refactored
+// else if(o1 instanceof BugzillaHit && o2 instanceof BugzillaHit){
+// BugzillaHit task1 = (BugzillaHit) o1;
+// BugzillaHit task2 = (BugzillaHit) o2;
+//
+// if (column == columnNames[1]) {
+// return 0;
+// } else if (column == columnNames[2]) {
+// return task1.getPriority().compareTo(task2.getPriority());
+// } else if (column == columnNames[3]) {
+// return task1.getDescription(false).compareTo(task2.getDescription(false));
+// } else {
+// return 0;
+// }
} else{
return 0;
}
@@ -703,11 +705,13 @@ public class TaskListView extends ViewPart {
viewer.addFilter(priorityFilter);
if (MylarTasksPlugin.getDefault().isFilterInCompleteMode()) viewer.addFilter(inCompleteFilter);
if (MylarTasksPlugin.getDefault().isFilterCompleteMode()) viewer.addFilter(completeFilter);
- if (MylarTasksPlugin.getDefault().refreshOnStartUpEnabled()) {
- refresh.setShowProgress(false);
- refresh.run();
- refresh.setShowProgress(true);
- }
+
+ // XXX refactored
+// if (MylarTasksPlugin.getDefault().refreshOnStartUpEnabled()) {
+// refresh.setShowProgress(false);
+// refresh.run();
+// refresh.setShowProgress(true);
+// }
viewer.refresh();
}
@@ -801,13 +805,15 @@ public class TaskListView extends ViewPart {
} else {
event.data = "null";
}
- } else if (selection.getFirstElement() instanceof BugzillaHit) {
- if (!selection.isEmpty()) {
- event.data = "" + ((BugzillaHit) selection.getFirstElement()).getHandle();
- } else {
- event.data = "null";
- }
- }
+ }
+ // XXX refactored
+// else if (selection.getFirstElement() instanceof BugzillaHit) {
+// if (!selection.isEmpty()) {
+// event.data = "" + ((BugzillaHit) selection.getFirstElement()).getHandle();
+// } else {
+// event.data = "null";
+// }
+// }
}
public void dragFinished(DragSourceEvent event) {
@@ -846,25 +852,27 @@ public class TaskListView extends ViewPart {
viewer.setSelection(null);
viewer.refresh();
return true;
- } else if (selectedObject instanceof BugzillaHit) {
- BugzillaHit bh = (BugzillaHit) selectedObject;
- if (getCurrentTarget() instanceof TaskCategory) {
- TaskCategory cat = (TaskCategory) getCurrentTarget();
- if (bh.getAssociatedTask() != null) {
- bh.getAssociatedTask().setCategory(cat);
- cat.addTask(bh.getAssociatedTask());
- } else {
- BugzillaTask bt = new BugzillaTask(bh);
- bh.setAssociatedTask(bt);
- bt.setCategory(cat);
- cat.addTask(bt);
- MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry(bt);
- }
- viewer.setSelection(null);
- viewer.refresh();
- return true;
- }
}
+ // XXX refactored
+// else if (selectedObject instanceof BugzillaHit) {
+// BugzillaHit bh = (BugzillaHit) selectedObject;
+// if (getCurrentTarget() instanceof TaskCategory) {
+// TaskCategory cat = (TaskCategory) getCurrentTarget();
+// if (bh.getAssociatedTask() != null) {
+// bh.getAssociatedTask().setCategory(cat);
+// cat.addTask(bh.getAssociatedTask());
+// } else {
+// BugzillaTask bt = new BugzillaTask(bh);
+// bh.setAssociatedTask(bt);
+// bt.setCategory(cat);
+// cat.addTask(bt);
+// MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry(bt);
+// }
+// viewer.setSelection(null);
+// viewer.refresh();
+// return true;
+// }
+// }
return false;
}
@@ -879,13 +887,15 @@ public class TaskListView extends ViewPart {
} else {
return false;
}
- } else if (selectedObject instanceof BugzillaHit) {
- if (getCurrentTarget() != null && getCurrentTarget() instanceof TaskCategory) {
- return true;
- } else {
- return false;
- }
- }
+ }
+ // XXX refactored
+// else if (selectedObject instanceof BugzillaHit) {
+// if (getCurrentTarget() != null && getCurrentTarget() instanceof TaskCategory) {
+// return true;
+// } else {
+// return false;
+// }
+// }
return TextTransfer.getInstance().isSupportedType(transferType);
}
@@ -931,104 +941,108 @@ public class TaskListView extends ViewPart {
manager.add(incompleteTask);
// manager.add(new Separator());
manager.add(createTask);
- manager.add(createBugzillaTask);
+// manager.add(createBugzillaTask);
// manager.add(rename);
manager.add(delete);
manager.add(clearSelectedTaskscapeAction);
- manager.add(moveTaskToRoot);
- manager.add(refreshQuery);
+// manager.add(moveTaskToRoot);
+// manager.add(refreshQuery);
manager.add(new Separator());
MenuManager subMenuManager = new MenuManager("Choose Highlighter");
final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
- for (Iterator<Highlighter> it = MylarUiPlugin.getDefault().getHighlighters().iterator(); it.hasNext();) {
- final Highlighter highlighter = it.next();
- if (selectedObject instanceof Task){
- Action action = new Action() {
-
- @Override
- public void run() {
- Task task = (Task)selectedObject;
- MylarUiPlugin.getDefault().setHighlighterMapping(task.getHandle(), highlighter.getName());
- TaskListView.this.viewer.refresh();
- MylarPlugin.getTaskscapeManager().notifyPostPresentationSettingsChange(ITaskscapeListener.UpdateKind.HIGHLIGHTER);
-// taskscapeComponent.getTableViewer().refresh();
- }
- };
- if (highlighter.isGradient()) {
- action.setImageDescriptor(new HighlighterImageDescriptor(highlighter.getBase(), highlighter.getLandmarkColor()));
- } else {
- action.setImageDescriptor(new HighlighterImageDescriptor(highlighter.getLandmarkColor(), highlighter.getLandmarkColor()));
- }
- action.setText(highlighter.toString());
- subMenuManager.add(action);
- } else {
-// showMessage("Select task before choosing highlighter");
- }
- }
+
+ // XXX refactored
+// for (Iterator<Highlighter> it = MylarUiPlugin.getDefault().getHighlighters().iterator(); it.hasNext();) {
+// final Highlighter highlighter = it.next();
+// if (selectedObject instanceof Task){
+// Action action = new Action() {
+//
+// @Override
+// public void run() {
+// Task task = (Task)selectedObject;
+// MylarUiPlugin.getDefault().setHighlighterMapping(task.getHandle(), highlighter.getName());
+// TaskListView.this.viewer.refresh();
+// MylarPlugin.getTaskscapeManager().notifyPostPresentationSettingsChange(ITaskscapeListener.UpdateKind.HIGHLIGHTER);
+//// taskscapeComponent.getTableViewer().refresh();
+// }
+// };
+// if (highlighter.isGradient()) {
+// action.setImageDescriptor(new HighlighterImageDescriptor(highlighter.getBase(), highlighter.getLandmarkColor()));
+// } else {
+// action.setImageDescriptor(new HighlighterImageDescriptor(highlighter.getLandmarkColor(), highlighter.getLandmarkColor()));
+// }
+// action.setText(highlighter.toString());
+// subMenuManager.add(action);
+// } else {
+//// showMessage("Select task before choosing highlighter");
+// }
+// }
manager.add(subMenuManager);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
updateActionEnablement(selectedObject);
}
private void updateActionEnablement(Object sel){
- if(sel != null && sel instanceof ITaskListElement){
- if(sel instanceof BugzillaHit){
- BugzillaTask task = ((BugzillaHit)sel).getAssociatedTask();
- if(task == null){
- clearSelectedTaskscapeAction.setEnabled(false);
- } else {
- clearSelectedTaskscapeAction.setEnabled(true);
- }
- completeTask.setEnabled(false);
- incompleteTask.setEnabled(false);
- moveTaskToRoot.setEnabled(false);
- delete.setEnabled(false);
- refreshQuery.setEnabled(false);
- } else if(sel instanceof BugzillaTask){
- clearSelectedTaskscapeAction.setEnabled(true);
- completeTask.setEnabled(false);
- incompleteTask.setEnabled(false);
- moveTaskToRoot.setEnabled(true);
- delete.setEnabled(true);
- refreshQuery.setEnabled(false);
- } else if(sel instanceof AbstractCategory){
- clearSelectedTaskscapeAction.setEnabled(false);
- completeTask.setEnabled(false);
- incompleteTask.setEnabled(false);
- moveTaskToRoot.setEnabled(false);
- delete.setEnabled(true);
- if (sel instanceof BugzillaQueryCategory) {
- refreshQuery.setEnabled(true);
- } else {
- refreshQuery.setEnabled(false);
- }
- //delete.setEnabled(true);
- } else {
- clearSelectedTaskscapeAction.setEnabled(true);
- completeTask.setEnabled(true);
- incompleteTask.setEnabled(true);
- moveTaskToRoot.setEnabled(true);
- delete.setEnabled(true);
- refreshQuery.setEnabled(false);
- }
- }else {
- clearSelectedTaskscapeAction.setEnabled(false);
- completeTask.setEnabled(false);
- incompleteTask.setEnabled(false);
- moveTaskToRoot.setEnabled(false);
- delete.setEnabled(false);
- refreshQuery.setEnabled(false);
- }
+ // XXX refactored
+ throw new RuntimeException("unimplemented");
+// if(sel != null && sel instanceof ITaskListElement){
+// if(sel instanceof BugzillaHit){
+// BugzillaTask task = ((BugzillaHit)sel).getAssociatedTask();
+// if(task == null){
+// clearSelectedTaskscapeAction.setEnabled(false);
+// } else {
+// clearSelectedTaskscapeAction.setEnabled(true);
+// }
+// completeTask.setEnabled(false);
+// incompleteTask.setEnabled(false);
+// moveTaskToRoot.setEnabled(false);
+// delete.setEnabled(false);
+// refreshQuery.setEnabled(false);
+// } else if(sel instanceof BugzillaTask){
+// clearSelectedTaskscapeAction.setEnabled(true);
+// completeTask.setEnabled(false);
+// incompleteTask.setEnabled(false);
+// moveTaskToRoot.setEnabled(true);
+// delete.setEnabled(true);
+// refreshQuery.setEnabled(false);
+// } else if(sel instanceof AbstractCategory){
+// clearSelectedTaskscapeAction.setEnabled(false);
+// completeTask.setEnabled(false);
+// incompleteTask.setEnabled(false);
+// moveTaskToRoot.setEnabled(false);
+// delete.setEnabled(true);
+// if (sel instanceof BugzillaQueryCategory) {
+// refreshQuery.setEnabled(true);
+// } else {
+// refreshQuery.setEnabled(false);
+// }
+// //delete.setEnabled(true);
+// } else {
+// clearSelectedTaskscapeAction.setEnabled(true);
+// completeTask.setEnabled(true);
+// incompleteTask.setEnabled(true);
+// moveTaskToRoot.setEnabled(true);
+// delete.setEnabled(true);
+// refreshQuery.setEnabled(false);
+// }
+// } else {
+// clearSelectedTaskscapeAction.setEnabled(false);
+// completeTask.setEnabled(false);
+// incompleteTask.setEnabled(false);
+// moveTaskToRoot.setEnabled(false);
+// delete.setEnabled(false);
+// refreshQuery.setEnabled(false);
+// }
}
private void fillLocalToolBar(IToolBarManager manager) {
manager.add(createTask);
manager.add(createCategory);
manager.add(new Separator());
- manager.add(createBugzillaTask);
- manager.add(createBugzillaQueryCategory);
- manager.add(refresh);
- manager.add(new Separator());
+// manager.add(createBugzillaTask);
+// manager.add(createBugzillaQueryCategory);
+// manager.add(refresh);
+// manager.add(new Separator());
manager.add(filterCompleteTask);
// manager.add(filterInCompleteTask);
manager.add(filterOnPriority);
@@ -1039,22 +1053,19 @@ public class TaskListView extends ViewPart {
*
*/
private void makeActions() {
- refresh = new RefreshBugzillaReportsAction(this);
- createTask = new CreateTaskAction(this);
+ createTask = new CreateTaskAction(this);
createCategory = new CreateCategoryAction(this);
- createBugzillaQueryCategory = new CreateBugzillaQueryCategoryAction(this);
- createBugzillaTask = new CreateBugzillaTaskAction(this);
+
delete = new DeleteAction(this);
completeTask = new MarkTaskCompleteAction(this);
incompleteTask = new MarkTaskIncompleteAction(this);
// rename = new RenameAction();
clearSelectedTaskscapeAction = new ClearContextAction(this);
- moveTaskToRoot = new MoveTaskToRootAction(this);
+// moveTaskToRoot = new MoveTaskToRootAction(this);
doubleClickAction = new OpenTaskEditorAction(this);
filterCompleteTask = new FilterCompletedTasksAction(this);
// filterInCompleteTask = new FilterIncompleteTasksAction();
filterOnPriority = new PriorityDropDownAction();
- refreshQuery = new RefreshBugzillaAction(this);
}
/**
@@ -1086,9 +1097,11 @@ public class TaskListView extends ViewPart {
public void closeTaskEditors(ITask task, IWorkbenchPage page) throws LoginException, IOException{
IEditorInput input = null;
- if (task instanceof BugzillaTask) {
- input = new BugzillaTaskEditorInput((BugzillaTask)task);
- } else if (task instanceof Task) {
+ // XXX refactored
+// if (task instanceof BugzillaTask) {
+// input = new BugzillaTaskEditorInput((BugzillaTask)task);
+// } else
+ if (task instanceof Task) {
input = new TaskEditorInput((Task) task);
}
IEditorPart editor = page.findEditor(input);
@@ -1101,9 +1114,10 @@ public class TaskListView extends ViewPart {
public void refreshChildren(List<ITask> children) {
if (children != null) {
for (ITask child : children) {
- if (child instanceof BugzillaTask) {
- ((BugzillaTask)child).refresh();
- }
+ // XXX refactored
+// if (child instanceof BugzillaTask) {
+// ((BugzillaTask)child).refresh();
+// }
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java
new file mode 100644
index 000000000..9170dcace
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 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.tasks.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.tasks.AbstractCategory;
+import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.Task;
+import org.eclipse.mylar.tasks.TaskCategory;
+import org.eclipse.mylar.tasks.TaskList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author Mik Kersten and Ken Sueda
+ */
+public class DefaultTaskListExternalizer implements ITaskListExternalizer {
+
+ public static final String LABEL = "Label";
+ public static final String HANDLE = "Handle";
+ public static final String TAG_CATEGORY = "Category";
+ public static final String TAG_TASK = "Task";
+ public static final String TAG_TASK_CATEGORY = "Task" + TAG_CATEGORY;
+
+ public static final String LINK = "Link";
+ public static final String ESTIMATED = "Estimated";
+ public static final String ELAPSED = "Elapsed";
+ public static final String NOTES = "Notes";
+ public static final String BUGZILLA = "Bugzilla";
+ public static final String ACTIVE = "Active";
+ public static final String COMPLETE = "Complete";
+ public static final String PRIORITY = "Priority";
+ public static final String PATH = "Path";
+ public static final String FALSE = "false";
+ public static final String TRUE = "true";
+ public static final String NAME = "Name";
+
+ private List<ITaskListExternalizer> externalizers = new ArrayList<ITaskListExternalizer>();
+
+ void setExternalizers(List<ITaskListExternalizer> externalizers) {
+ this.externalizers = externalizers;
+ }
+
+ public boolean canCreateElementFor(AbstractCategory category) {
+ return category instanceof TaskCategory;
+ }
+
+ public Element createCategoryElement(AbstractCategory category, Document doc, Element parent) {
+ Element node = doc.createElement(getCategoryTagName());
+ node.setAttribute(NAME, category.getDescription(false));
+
+ for (ITask t : ((TaskCategory)category).getChildren()) {
+ try {
+ createTaskElement(t, doc, node);
+ } catch (Exception e) {
+ MylarPlugin.log(e, e.getMessage());
+ }
+
+ }
+ parent.appendChild(node);
+ return node;
+ }
+
+ public boolean canCreateElementFor(ITask task) {
+ return true;
+ }
+
+ public Element createTaskElement(ITask task, Document doc, Element parent) {
+ Element node = doc.createElement(getTaskTagName());
+ node.setAttribute(PATH, task.getPath());
+ node.setAttribute(LABEL, task.getLabel());
+ node.setAttribute(HANDLE, task.getHandle());
+ node.setAttribute(PRIORITY, task.getPriority());
+
+ if (task.isCompleted()) {
+ node.setAttribute(COMPLETE, TRUE);
+ } else {
+ node.setAttribute(COMPLETE, FALSE);
+ }
+ if (task.isActive()) {
+ node.setAttribute(ACTIVE, TRUE);
+ } else {
+ node.setAttribute(ACTIVE, FALSE);
+ }
+ node.setAttribute(BUGZILLA, FALSE); // TODO: this is not great
+
+ node.setAttribute(NOTES, task.getNotes());
+ node.setAttribute(ELAPSED, task.getElapsedTime());
+ node.setAttribute(ESTIMATED, task.getEstimatedTime());
+ List<String> rl = task.getRelatedLinks().getLinks();
+ int i = 0;
+ for (String link : rl) {
+ node.setAttribute(LINK+i, link);
+ i++;
+ }
+
+ for (ITask t : task.getChildren()) {
+ createTaskElement(t, doc, node);
+ }
+ parent.appendChild(node);
+ return node;
+ }
+
+ public boolean canReadCategory(Node node) {
+ return node.getNodeName().equals(getCategoryTagName());
+ }
+
+ public void readCategory(Node node, TaskList tlist) {
+ Element element = (Element) node;
+ TaskCategory category = new TaskCategory(element.getAttribute("Name"));
+ tlist.addCategory(category);
+ NodeList list = node.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node child = list.item(i);
+ boolean read = false;
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canReadTask(child)) {
+ category.addTask(externalizer.readTask(child, tlist, category, null));
+ read = true;
+ }
+ }
+ if (!read) category.addTask(readTask(child, tlist, category, null));
+ }
+ }
+
+ public boolean canReadTask(Node node) {
+ return node.getNodeName().equals(getTaskTagName());
+ }
+
+ public ITask readTask(Node node, TaskList tlist, AbstractCategory category, ITask parent) {
+ Element element = (Element) node;
+ String handle = element.getAttribute(HANDLE);
+ String label = element.getAttribute(LABEL);
+ Task task = new Task(handle, label);
+ readTaskInfo(task, tlist, element, category, parent);
+ return task;
+ }
+
+ protected void readTaskInfo(ITask task, TaskList tlist, Element element, AbstractCategory category, ITask parent) {
+ task.setPriority(element.getAttribute(PRIORITY));
+ task.setPath(element.getAttribute(PATH));
+
+ if (element.getAttribute(ACTIVE).compareTo(TRUE) == 0) {
+ task.setActive(true);
+ tlist.setActive(task, true);
+ } else {
+ task.setActive(false);
+ }
+ if (element.getAttribute(COMPLETE).compareTo(TRUE) == 0) {
+ task.setCompleted(true);
+ } else {
+ task.setCompleted(false);
+ }
+ if (element.hasAttribute(NOTES)) {
+ task.setNotes(element.getAttribute(NOTES));
+ } else {
+ task.setNotes("");
+ }
+ if (element.hasAttribute(ELAPSED)) {
+ task.setElapsedTime(element.getAttribute(ELAPSED));
+ } else {
+ task.setElapsedTime("");
+ }
+ if (element.hasAttribute(ESTIMATED)) {
+ task.setEstimatedTime(element.getAttribute(ESTIMATED));
+ } else {
+ task.setEstimatedTime("");
+ }
+ int i = 0;
+ while (element.hasAttribute(LINK+i)) {
+ task.getRelatedLinks().add(element.getAttribute(LINK+i));
+ i++;
+ }
+ if (category != null) {
+ task.setCategory((TaskCategory) category);
+ } else {
+ task.setCategory(null);
+ }
+ task.setParent(parent);
+ NodeList list = element.getChildNodes();
+ for (int j = 0; j < list.getLength(); j++) {
+ Node child = list.item(j);
+ task.addSubTask(readTask(child, tlist, null, task));
+ }
+ }
+
+ public String getCategoryTagName() {
+ return TAG_TASK_CATEGORY;
+ }
+
+ public String getTaskTagName() {
+ return TAG_TASK;
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/ITaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/ITaskListExternalizer.java
new file mode 100644
index 000000000..04e42fe5d
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/ITaskListExternalizer.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 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.tasks.util;
+
+import org.eclipse.mylar.tasks.AbstractCategory;
+import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.TaskList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Mik Kersten and Ken Sueda
+ *
+ * TODO: consider merging tasks and categories
+ */
+public interface ITaskListExternalizer {
+
+ public abstract String getCategoryTagName();
+
+ public abstract String getTaskTagName();
+
+ public abstract boolean canCreateElementFor(AbstractCategory category);
+
+ /**
+ * @return the element that was created, null if failed
+ */
+ public abstract Element createCategoryElement(AbstractCategory category, Document doc, Element parent);
+
+ public abstract boolean canCreateElementFor(ITask task);
+
+ /**
+ * @return the element that was created, null if failed
+ */
+ public abstract Element createTaskElement(ITask task, Document doc, Element parent);
+
+ public abstract boolean canReadCategory(Node node);
+
+ public abstract void readCategory(Node node, TaskList tlist);
+
+ public abstract boolean canReadTask(Node node);
+
+ public abstract ITask readTask(Node node, TaskList tlist, AbstractCategory category, ITask parent);
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java
new file mode 100644
index 000000000..78de68836
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java
@@ -0,0 +1,591 @@
+
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 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.tasks.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.tasks.AbstractCategory;
+import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.MylarTasksPlugin;
+import org.eclipse.mylar.tasks.TaskList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Mik Kersten and Ken Sueda
+ */
+public class TaskListExternalizer {
+
+ private List<ITaskListExternalizer> externalizers = new ArrayList<ITaskListExternalizer>();
+ private ITaskListExternalizer defaultExternalizer = new DefaultTaskListExternalizer();
+
+ private String readVersion = "";
+
+ public void addExternalizer(ITaskListExternalizer externalizer) {
+ externalizers.add(externalizer);
+// System.err.println(">>>>>>>>> " + MylarTasksPlugin.getTaskListManager().getTaskListFile());
+// readTaskList(MylarTasksPlugin.getTaskListManager().getTaskList(), MylarTasksPlugin.getTaskListManager().getTaskListFile());
+ }
+
+ public void removeExternalizer(ITaskListExternalizer externalizer) {
+ externalizers.remove(externalizer);
+ }
+
+ public void writeTaskList(TaskList tlist, File outFile) {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db;
+ Document doc = null;
+
+ try {
+ db = dbf.newDocumentBuilder();
+ doc = db.newDocument();
+ } catch (ParserConfigurationException e) {
+ MylarPlugin.log(e, "could not create document");
+ e.printStackTrace();
+ }
+
+ Element root = doc.createElement("TaskList");
+ root.setAttribute("Version", "1.0.1");
+
+ // XXX refactored
+// writeBugzillaRegistry(tlist.getBugzillaTaskRegistry(), doc, root);
+
+ // iterate through each subtask and externalize those
+ //
+ for (AbstractCategory category : tlist.getCategories()) {
+ Element element = null;
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canCreateElementFor(category)) element = externalizer.createCategoryElement(category, doc, root);
+ }
+ if (element == null) defaultExternalizer.createCategoryElement(category, doc, root);
+//
+// if (cat instanceof TaskCategory) {
+// writeTaskCategory((TaskCategory)cat, doc, root);
+// } else if (cat instanceof BugzillaQueryCategory) {
+// writeQueryCategory((BugzillaQueryCategory)cat, doc, root);
+// }
+ }
+ for (ITask task : tlist.getRootTasks()) {
+ try {
+ Element element = null;
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canCreateElementFor(task)) element = externalizer.createTaskElement(task, doc, root);
+ }
+ if (element == null) defaultExternalizer.createTaskElement(task, doc, root);
+ }catch (Exception e) {
+ MylarPlugin.log(e, e.getMessage());
+ }
+ }
+ doc.appendChild(root);
+ writeDOMtoFile(doc, outFile);
+ return;
+ }
+
+ // XXX refactored
+// private static void writeBugzillaRegistry(Map<String, BugzillaTask> bugzillaTaskRegistry, Document doc, Element parent) {
+// Element node = doc.createElement("BugzillaTaskRegistry");
+//
+// for (BugzillaTask t : bugzillaTaskRegistry.values()) {
+// try {
+// writeTask(t, doc, node);
+// } catch (Exception e) {
+// MylarPlugin.log(e, e.getMessage());
+// }
+//
+// }
+// parent.appendChild(node);
+// }
+
+ /**
+ * Writes an XML file from a DOM.
+ *
+ * doc - the document to write
+ * file - the file to be written to
+ */
+ private void writeDOMtoFile(Document doc, File file) {
+ try {
+ // A file output stream is an output stream for writing data to a File
+ //
+ OutputStream outputStream = new FileOutputStream(file);
+ writeDOMtoStream(doc, outputStream);
+ outputStream.flush();
+ outputStream.close();
+ } catch (Exception fnfe) {
+ MylarPlugin.log(fnfe, "Tasklist could not be found");
+ }
+ }
+
+ /**
+ * Writes the provided XML document out to the specified output stream.
+ *
+ * doc - the document to be written
+ * outputStream - the stream to which the document is to be written
+ */
+ private void writeDOMtoStream(Document doc, OutputStream outputStream) {
+ // Prepare the DOM document for writing
+ // DOMSource - Acts as a holder for a transformation Source tree in the
+ // form of a Document Object Model (DOM) tree
+ //
+ Source source = new DOMSource(doc);
+
+ // StreamResult - Acts as an holder for a XML transformation result
+ // Prepare the output stream
+ //
+ Result result = new StreamResult(outputStream);
+
+ // An instance of this class can be obtained with the
+ // TransformerFactory.newTransformer method. This instance may
+ // then be used to process XML from a variety of sources and write
+ // the transformation output to a variety of sinks
+ //
+
+ Transformer xformer = null;
+ try {
+ xformer = TransformerFactory.newInstance().newTransformer();
+ //Transform the XML Source to a Result
+ //
+ xformer.transform(source, result);
+ } catch (TransformerConfigurationException e) {
+ e.printStackTrace();
+ } catch (TransformerFactoryConfigurationError e) {
+ e.printStackTrace();
+ } catch (TransformerException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+// private void writeTask(ITask task, Document doc, Element parent) {
+//
+// }
+
+ public void readTaskList(TaskList tlist, File inFile) {
+ try {
+ // parse file
+ //
+ Document doc = openAsDOM(inFile);
+
+ // read root node to get version number
+ //
+ Element root = doc.getDocumentElement();
+ readVersion = root.getAttribute("Version");
+
+ if (readVersion.equals("1.0.0")) {
+ MylarPlugin.log("version: " + readVersion + " not supported", this);
+// NodeList list = root.getChildNodes();
+// for (int i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// readTasksToNewFormat(child, tlist);
+// //tlist.addRootTask(readTaskAndSubTasks(child, null, tlist));
+// }
+ } else {
+ NodeList list = root.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node child = list.item(i);
+ boolean wasRead = false;
+ if (child.getNodeName().endsWith(DefaultTaskListExternalizer.TAG_CATEGORY)) {
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canReadCategory(child)) {
+ externalizer.readCategory(child, tlist);
+ wasRead = true;
+ break;
+ }
+ }
+ if (!wasRead) defaultExternalizer.readCategory(child, tlist);
+ } else {
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canReadTask(child)) {
+ tlist.addRootTask(externalizer.readTask(child, tlist, null, null));
+ wasRead = true;
+ break;
+ }
+ }
+ if (!wasRead) tlist.addRootTask(defaultExternalizer.readTask(child, tlist, null, null));
+ }
+
+// if (child.getNodeName().equals("Category") ||
+// child.getNodeName().equals("TaskCategory")) {
+// readTaskCategory(child, tlist);
+//// } else if (child.getNodeName().equals("BugzillaTaskRegistry")) {
+//// readBugzillaRegistry(child, tlist);
+// } else if (child.getNodeName().equals("QueryCategory")) {
+// readQueryCategory(child, tlist);
+// } else {
+// tlist.addRootTask(readTask(child, tlist, null, null));
+// }
+ }
+ }
+ } catch (Exception e) {
+ String name = inFile.getAbsolutePath();
+ name = name.substring(0, name.lastIndexOf('.')) + "-save.xml";
+ inFile.renameTo(new File(name));
+ MylarPlugin.log(e, "Could not read task list");
+ }
+ }
+
+ // XXX refactored
+// private void readBugzillaRegistry(Node node, TaskList tlist) {
+// NodeList list = node.getChildNodes();
+// for (int i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// ITask task = readTask(child, tlist, null, null);
+// if(task instanceof BugzillaTask){
+// tlist.addToBugzillaTaskRegistry((BugzillaTask)task);
+// }
+// }
+// }
+
+ /**
+ * Opens the specified XML file and parses it into a DOM Document.
+ *
+ * Filename - the name of the file to open
+ * Return - the Document built from the XML file
+ * Throws - XMLException if the file cannot be parsed as XML
+ * - IOException if the file cannot be opened
+ */
+ private Document openAsDOM(File inputFile) throws IOException {
+
+ // A factory API that enables applications to obtain a parser
+ // that produces DOM object trees from XML documents
+ //
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
+ // Using DocumentBuilder, obtain a Document from XML file.
+ //
+ DocumentBuilder builder = null;
+ Document document = null;
+ try {
+ // create new instance of DocumentBuilder
+ //
+ builder = factory.newDocumentBuilder();
+ } catch (ParserConfigurationException pce) {
+ inputFile.renameTo(new File(inputFile.getName() + "save.xml"));
+ MylarPlugin.log(pce, "Failed to load XML file");
+ }
+ try {
+ // Parse the content of the given file as an XML document
+ // and return a new DOM Document object. Also throws IOException
+ document = builder.parse(inputFile);
+ } catch (SAXException se) {
+ inputFile.renameTo(new File(inputFile.getName() + "save.xml"));
+ MylarPlugin.log(se, "Failed to parse XML file");
+ }
+ return document;
+ }
+
+// private static ITask readTaskAndSubTasks(Node node, ITask root, TaskList tlist) {
+// //extract node and create new sub task
+// //
+// Element e = (Element) node;
+// ITask t;
+// String handle = "";
+// if (e.hasAttribute("ID")) {
+// handle = e.getAttribute("ID");
+// } else {
+// handle = e.getAttribute("Handle");
+// }
+//
+// String label = e.getAttribute("Label");
+// String priority = e.getAttribute("Priority");
+//
+// if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
+// t = new BugzillaTask(handle, label, true);
+// BugzillaTask bt = (BugzillaTask) t;
+// bt.setState(BugTaskState.FREE);
+// bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
+// .longValue()));
+// if (e.getAttribute("Dirty").compareTo("true") == 0) {
+// bt.setDirty(true);
+// } else {
+// bt.setDirty(false);
+// }
+// if (bt.readBugReport() == false) {
+// MylarPlugin.log("Failed to read bug report", null);
+// }
+// } else {
+// t = new Task(handle, label);
+// }
+// t.setPriority(priority);
+// t.setPath(e.getAttribute("Path"));
+//
+// if (e.getAttribute("Active").compareTo("true") == 0) {
+// t.setActive(true);
+// tlist.setActive(t, true);
+// } else {
+// t.setActive(false);
+// }
+//
+// if (e.getAttribute("Complete").compareTo("true") == 0) {
+// t.setCompleted(true);
+// } else {
+// t.setCompleted(false);
+// }
+// if (e.getAttribute("IsCategory").compareTo("true") == 0) {
+// t.setIsCategory(true);
+// } else {
+// t.setIsCategory(false);
+// }
+//
+// if (e.hasAttribute("Notes")) {
+// t.setNotes(e.getAttribute("Notes"));
+// } else {
+// t.setNotes("");
+// }
+// if (e.hasAttribute("Elapsed")) {
+// t.setElapsedTime(e.getAttribute("Elapsed"));
+// } else {
+// t.setElapsedTime("");
+// }
+// if (e.hasAttribute("Estimated")) {
+// t.setEstimatedTime(e.getAttribute("Estimated"));
+// } else {
+// t.setEstimatedTime("");
+// }
+//
+// int i = 0;
+// while (e.hasAttribute("link"+i)) {
+// t.getRelatedLinks().add(e.getAttribute("link"+i));
+// i++;
+// }
+//
+// if (!readVersion.equals("1.0.0")) {
+// // for newer revisions
+// }
+//
+// i = 0;
+// NodeList list = e.getChildNodes();
+// for (i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// t.addSubTask(readTaskAndSubTasks(child, t, tlist));
+// }
+// if (root != null) {
+// t.setParent(root);
+// }
+// return t;
+// }
+
+// private void readTaskCategory(Node node, TaskList tlist) {
+// Element e = (Element) node;
+// TaskCategory cat = new TaskCategory(e.getAttribute("Name"));
+// tlist.addCategory(cat);
+// NodeList list = node.getChildNodes();
+// for (int i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// cat.addTask(readTask(child, tlist, cat, null));
+// }
+// }
+
+
+// private ITask readTask(Node node, TaskList tlist, TaskCategory cat, ITask parent) {
+// Element e = (Element) node;
+// ITask t;
+// String handle = e.getAttribute("Handle");
+// String label = e.getAttribute("Label");
+// String priority = e.getAttribute("Priority");
+//
+//
+// } else {
+// t = new Task(handle, label);
+// }
+// t.setPriority(priority);
+// t.setPath(e.getAttribute("Path"));
+//
+// if (e.getAttribute("Active").compareTo("true") == 0) {
+// t.setActive(true);
+// tlist.setActive(t, true);
+// } else {
+// t.setActive(false);
+// }
+// if (e.getAttribute("Complete").compareTo("true") == 0) {
+// t.setCompleted(true);
+// } else {
+// t.setCompleted(false);
+// }
+// if (e.hasAttribute("Notes")) {
+// t.setNotes(e.getAttribute("Notes"));
+// } else {
+// t.setNotes("");
+// }
+// if (e.hasAttribute("Elapsed")) {
+// t.setElapsedTime(e.getAttribute("Elapsed"));
+// } else {
+// t.setElapsedTime("");
+// }
+// if (e.hasAttribute("Estimated")) {
+// t.setEstimatedTime(e.getAttribute("Estimated"));
+// } else {
+// t.setEstimatedTime("");
+// }
+//
+// int i = 0;
+// while (e.hasAttribute("link"+i)) {
+// t.getRelatedLinks().add(e.getAttribute("link"+i));
+// i++;
+// }
+// t.setCategory(cat);
+// t.setParent(parent);
+// NodeList list = e.getChildNodes();
+// for (i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// t.addSubTask(readTask(child, tlist, null, t));
+// }
+// return t;
+// }
+
+// private void readTasksToNewFormat(Node node, TaskList tlist) {
+// Element e = (Element) node;
+// ITask t;
+// String handle = e.getAttribute("Handle");
+// String label = e.getAttribute("Label");
+//
+// if (e.getAttribute("IsCategory").compareTo("true") == 0) {
+// TaskCategory c = new TaskCategory(label);
+// NodeList list = e.getChildNodes();
+// for (int i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// readSubTasksToNewFormat(child, tlist, c);
+// }
+// tlist.addCategory(c);
+// } else {
+// String priority = e.getAttribute("Priority");
+// if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
+// t = new BugzillaTask(handle, label, true);
+// BugzillaTask bt = (BugzillaTask) t;
+// bt.setState(BugTaskState.FREE);
+// bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
+// .longValue()));
+// if (e.getAttribute("Dirty").compareTo("true") == 0) {
+// bt.setDirty(true);
+// } else {
+// bt.setDirty(false);
+// }
+// if (bt.readBugReport() == false) {
+// MylarPlugin.log("Failed to read bug report", null);
+// }
+// } else {
+// t = new Task(handle, label);
+// }
+// t.setPriority(priority);
+// t.setPath(e.getAttribute("Path"));
+// t.setNotes(e.getAttribute("Notes"));
+// t.setElapsedTime(e.getAttribute("Elapsed"));
+// t.setEstimatedTime(e.getAttribute("Estimated"));
+//
+// if (e.getAttribute("Active").compareTo("true") == 0) {
+// t.setActive(true);
+// tlist.setActive(t, true);
+// } else {
+// t.setActive(false);
+// }
+// if (e.getAttribute("Complete").compareTo("true") == 0) {
+// t.setCompleted(true);
+// } else {
+// t.setCompleted(false);
+// }
+//
+// int i = 0;
+// while (e.hasAttribute("link" + i)) {
+// t.getRelatedLinks().add(e.getAttribute("link" + i));
+// i++;
+// }
+// tlist.addRootTask(t);
+// i = 0;
+// NodeList list = e.getChildNodes();
+// for (i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// readSubTasksToNewFormat(child, tlist, null);
+// }
+// }
+// }
+// private void readSubTasksToNewFormat(Node node, TaskList tlist, TaskCategory cat) {
+// Element e = (Element) node;
+// ITask t;
+// String handle = e.getAttribute("Handle");
+// String label = e.getAttribute("Label");
+// String priority = e.getAttribute("Priority");
+// if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
+// t = new BugzillaTask(handle, label, true);
+// BugzillaTask bt = (BugzillaTask) t;
+// bt.setState(BugTaskState.FREE);
+// bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
+// .longValue()));
+// if (e.getAttribute("Dirty").compareTo("true") == 0) {
+// bt.setDirty(true);
+// } else {
+// bt.setDirty(false);
+// }
+// if (bt.readBugReport() == false) {
+// MylarPlugin.log("Failed to read bug report", null);
+// }
+// } else {
+// t = new Task(handle, label);
+// }
+// t.setPriority(priority);
+// t.setPath(e.getAttribute("Path"));
+// t.setNotes(e.getAttribute("Notes"));
+// t.setElapsedTime(e.getAttribute("Elapsed"));
+// t.setEstimatedTime(e.getAttribute("Estimated"));
+//
+// if (e.getAttribute("Active").compareTo("true") == 0) {
+// t.setActive(true);
+// tlist.setActive(t, true);
+// } else {
+// t.setActive(false);
+// }
+// if (e.getAttribute("Complete").compareTo("true") == 0) {
+// t.setCompleted(true);
+// } else {
+// t.setCompleted(false);
+// }
+//
+// int i = 0;
+// while (e.hasAttribute("link" + i)) {
+// t.getRelatedLinks().add(e.getAttribute("link" + i));
+// i++;
+// }
+// if (cat == null) {
+// tlist.addRootTask(t);
+// } else {
+// cat.addTask(t);
+// t.setCategory(cat);
+// }
+//
+// i = 0;
+// NodeList list = e.getChildNodes();
+// for (i = 0; i < list.getLength(); i++) {
+// Node child = list.item(i);
+// readSubTasksToNewFormat(child, tlist, cat);
+// }
+// }
+}
+
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java
deleted file mode 100644
index 541532f5c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java
+++ /dev/null
@@ -1,712 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 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
- *******************************************************************************/
-/*
- * Created on Jan 17, 2005
- */
-package org.eclipse.mylar.tasks.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.AbstractCategory;
-import org.eclipse.mylar.tasks.BugzillaQueryCategory;
-import org.eclipse.mylar.tasks.BugzillaTask;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.Task;
-import org.eclipse.mylar.tasks.TaskCategory;
-import org.eclipse.mylar.tasks.TaskList;
-import org.eclipse.mylar.tasks.BugzillaTask.BugTaskState;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-
-/**
- * @author Ken Sueda
- */
-public class XmlUtil {
-
- private static String readVersion = "";
-
- /**
- *
- * @param tlist
- * @param outFile
- */
- public static void writeTaskList(TaskList tlist, File outFile) {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db;
- Document doc = null;
-
- try {
- db = dbf.newDocumentBuilder();
- doc = db.newDocument();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- }
-
- Element root = doc.createElement("TaskList");
- root.setAttribute("Version", "1.0.1");
-
- writeBugzillaRegistry(tlist.getBugzillaTaskRegistry(), doc, root);
-
- // iterate through each subtask and externalize those
- //
- for (AbstractCategory cat : tlist.getCategories()) {
- if (cat instanceof TaskCategory) {
- writeTaskCategory((TaskCategory)cat, doc, root);
- } else if (cat instanceof BugzillaQueryCategory) {
- writeQueryCategory((BugzillaQueryCategory)cat, doc, root);
- }
- }
- for (ITask task : tlist.getRootTasks()) {
- try {
- writeTask(task, doc, root);
- }catch (Exception e) {
- MylarPlugin.log(e, e.getMessage());
- }
- }
- doc.appendChild(root);
- writeDOMtoFile(doc, outFile);
- return;
- }
-
- private static void writeBugzillaRegistry(Map<String, BugzillaTask> bugzillaTaskRegistry, Document doc, Element parent) {
- Element node = doc.createElement("BugzillaTaskRegistry");
-
- for (BugzillaTask t : bugzillaTaskRegistry.values()) {
- try {
- writeTask(t, doc, node);
- } catch (Exception e) {
- MylarPlugin.log(e, e.getMessage());
- }
-
- }
- parent.appendChild(node);
- }
-
- /**
- * Writes an XML file from a DOM.
- *
- * doc - the document to write
- * file - the file to be written to
- */
- private static void writeDOMtoFile(Document doc, File file) {
- try {
- // A file output stream is an output stream for writing data to a File
- //
- OutputStream outputStream = new FileOutputStream(file);
- writeDOMtoStream(doc, outputStream);
- outputStream.flush();
- outputStream.close();
- } catch (Exception fnfe) {
- MylarPlugin.log(fnfe, "Tasklist could not be found");
- }
- }
-
- /**
- * Writes the provided XML document out to the specified output stream.
- *
- * doc - the document to be written
- * outputStream - the stream to which the document is to be written
- */
- private static void writeDOMtoStream(Document doc, OutputStream outputStream) {
- // Prepare the DOM document for writing
- // DOMSource - Acts as a holder for a transformation Source tree in the
- // form of a Document Object Model (DOM) tree
- //
- Source source = new DOMSource(doc);
-
- // StreamResult - Acts as an holder for a XML transformation result
- // Prepare the output stream
- //
- Result result = new StreamResult(outputStream);
-
- // An instance of this class can be obtained with the
- // TransformerFactory.newTransformer method. This instance may
- // then be used to process XML from a variety of sources and write
- // the transformation output to a variety of sinks
- //
-
- Transformer xformer = null;
- try {
- xformer = TransformerFactory.newInstance().newTransformer();
- //Transform the XML Source to a Result
- //
- xformer.transform(source, result);
- } catch (TransformerConfigurationException e) {
- e.printStackTrace();
- } catch (TransformerFactoryConfigurationError e) {
- e.printStackTrace();
- } catch (TransformerException e1) {
- e1.printStackTrace();
- }
- }
-
-// /**
-// * Method deprecated until subtasks are introduced again.
-// * @param t
-// * @param doc
-// * @param root
-// */
-// private static void writeTaskAndSubTasks(ITask t, Document doc, Element root) {
-//
-// // create node and set attributes
-// //
-// Element node = doc.createElement("Task");
-// node.setAttribute("Path", t.getPath());
-// node.setAttribute("Label", t.getLabel());
-// node.setAttribute("Handle", t.getHandle());
-// node.setAttribute("Priority", t.getPriority());
-//
-// if (t.isCategory()) {
-// node.setAttribute("IsCategory", "true");
-// } else {
-// node.setAttribute("IsCategory", "false");
-// }
-// if (t.isCompleted()) {
-// node.setAttribute("Complete", "true");
-// } else {
-// node.setAttribute("Complete", "false");
-// }
-// if (t.isActive()) {
-// node.setAttribute("Active", "true");
-// } else {
-// node.setAttribute("Active", "false");
-// }
-// if (t instanceof BugzillaTask) {
-// BugzillaTask bt = (BugzillaTask) t;
-// node.setAttribute("Bugzilla", "true");
-// node.setAttribute("LastDate", new Long(bt.getLastRefreshTime()
-// .getTime()).toString());
-// if (bt.isDirty()) {
-// node.setAttribute("Dirty", "true");
-// } else {
-// node.setAttribute("Dirty", "false");
-// }
-// bt.saveBugReport(false);
-// } else {
-// node.setAttribute("Bugzilla", "false");
-// }
-// node.setAttribute("Notes", t.getNotes());
-// node.setAttribute("Elapsed", t.getElapsedTime());
-// node.setAttribute("Estimated", t.getEstimatedTime());
-// List<String> rl = t.getRelatedLinks().getLinks();
-// int i = 0;
-// for (String link : rl) {
-// node.setAttribute("link"+i, link);
-// i++;
-// }
-//
-// List<ITask> children = t.getChildren();
-//
-// i = 0;
-// for (i = 0; i < children.size(); i++) {
-// writeTaskAndSubTasks(children.get(i), doc, node);
-// }
-//
-// // append new node to root node
-// //
-// root.appendChild(node);
-// return;
-// }
-
- private static void writeTaskCategory(TaskCategory cat, Document doc, Element parent) {
- Element node = doc.createElement("TaskCategory");
- node.setAttribute("Name", cat.getDescription(false));
-
- for (ITask t : cat.getChildren()) {
- try {
- writeTask(t, doc, node);
- } catch (Exception e) {
- MylarPlugin.log(e, e.getMessage());
- }
-
- }
- parent.appendChild(node);
- }
-
- private static void writeQueryCategory(BugzillaQueryCategory cat, Document doc, Element parent) {
- Element node = doc.createElement("QueryCategory");
- node.setAttribute("Description", cat.getDescription(false));
- node.setAttribute("URL", cat.getUrl());
- parent.appendChild(node);
- }
-
- private static void writeTask(ITask task, Document doc, Element parent) {
- Element node = doc.createElement("Task");
- node.setAttribute("Path", task.getPath());
- node.setAttribute("Label", task.getLabel());
- node.setAttribute("Handle", task.getHandle());
- node.setAttribute("Priority", task.getPriority());
-
- if (task.isCompleted()) {
- node.setAttribute("Complete", "true");
- } else {
- node.setAttribute("Complete", "false");
- }
- if (task.isActive()) {
- node.setAttribute("Active", "true");
- } else {
- node.setAttribute("Active", "false");
- }
- if (task instanceof BugzillaTask) {
- BugzillaTask bt = (BugzillaTask) task;
- node.setAttribute("Bugzilla", "true");
- if (bt.getLastRefresh() != null) {
- node.setAttribute("LastDate", new Long(bt.getLastRefreshTime()
- .getTime()).toString());
- } else {
- node.setAttribute("LastDate", new Long(new Date().getTime()).toString());
- }
-
- if (bt.isDirty()) {
- node.setAttribute("Dirty", "true");
- } else {
- node.setAttribute("Dirty", "false");
- }
- bt.saveBugReport(false);
- } else {
- node.setAttribute("Bugzilla", "false");
- }
- node.setAttribute("Notes", task.getNotes());
- node.setAttribute("Elapsed", task.getElapsedTime());
- node.setAttribute("Estimated", task.getEstimatedTime());
- List<String> rl = task.getRelatedLinks().getLinks();
- int i = 0;
- for (String link : rl) {
- node.setAttribute("link"+i, link);
- i++;
- }
-
- for (ITask t : task.getChildren()) {
- writeTask(t, doc, node);
- }
- parent.appendChild(node);
- return;
- }
-
- public static void readTaskList(TaskList tlist, File inFile) {
- try {
- // parse file
- //
- Document doc = openAsDOM(inFile);
-
- // read root node to get version number
- //
- Element root = doc.getDocumentElement();
- readVersion = root.getAttribute("Version");
-
- if (readVersion.equals("1.0.0")) {
- NodeList list = root.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- readTasksToNewFormat(child, tlist);
- //tlist.addRootTask(readTaskAndSubTasks(child, null, tlist));
- }
- } else {
- NodeList list = root.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- if (child.getNodeName().equals("Category") ||
- child.getNodeName().equals("TaskCategory")) {
- readTaskCategory(child, tlist);
- } else if (child.getNodeName().equals("BugzillaTaskRegistry")) {
- readBugzillaRegistry(child, tlist);
- } else if (child.getNodeName().equals("QueryCategory")) {
- readQueryCategory(child, tlist);
- } else {
- tlist.addRootTask(readTask(child, tlist, null, null));
- }
- }
- }
- } catch (Exception e) {
- String name = inFile.getAbsolutePath();
- name = name.substring(0, name.lastIndexOf('.')) + "-save.xml";
- inFile.renameTo(new File(name));
- MylarPlugin.log(e, "XmlUtil");
- }
- }
-
- private static void readBugzillaRegistry(Node node, TaskList tlist) {
- NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- ITask task = readTask(child, tlist, null, null);
- if(task instanceof BugzillaTask){
- tlist.addToBugzillaTaskRegistry((BugzillaTask)task);
- }
- }
- }
-
- /**
- * Opens the specified XML file and parses it into a DOM Document.
- *
- * Filename - the name of the file to open
- * Return - the Document built from the XML file
- * Throws - XMLException if the file cannot be parsed as XML
- * - IOException if the file cannot be opened
- */
- private static Document openAsDOM(File inputFile) throws IOException {
-
- // A factory API that enables applications to obtain a parser
- // that produces DOM object trees from XML documents
- //
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
- // Using DocumentBuilder, obtain a Document from XML file.
- //
- DocumentBuilder builder = null;
- Document document = null;
- try {
- // create new instance of DocumentBuilder
- //
- builder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- inputFile.renameTo(new File(inputFile.getName() + "save.xml"));
- MylarPlugin.log(pce, "Failed to load XML file");
- }
- try {
- // Parse the content of the given file as an XML document
- // and return a new DOM Document object. Also throws IOException
- document = builder.parse(inputFile);
- } catch (SAXException se) {
- inputFile.renameTo(new File(inputFile.getName() + "save.xml"));
- MylarPlugin.log(se, "Failed to parse XML file");
- }
- return document;
- }
-
-// private static ITask readTaskAndSubTasks(Node node, ITask root, TaskList tlist) {
-// //extract node and create new sub task
-// //
-// Element e = (Element) node;
-// ITask t;
-// String handle = "";
-// if (e.hasAttribute("ID")) {
-// handle = e.getAttribute("ID");
-// } else {
-// handle = e.getAttribute("Handle");
-// }
-//
-// String label = e.getAttribute("Label");
-// String priority = e.getAttribute("Priority");
-//
-// if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
-// t = new BugzillaTask(handle, label, true);
-// BugzillaTask bt = (BugzillaTask) t;
-// bt.setState(BugTaskState.FREE);
-// bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
-// .longValue()));
-// if (e.getAttribute("Dirty").compareTo("true") == 0) {
-// bt.setDirty(true);
-// } else {
-// bt.setDirty(false);
-// }
-// if (bt.readBugReport() == false) {
-// MylarPlugin.log("Failed to read bug report", null);
-// }
-// } else {
-// t = new Task(handle, label);
-// }
-// t.setPriority(priority);
-// t.setPath(e.getAttribute("Path"));
-//
-// if (e.getAttribute("Active").compareTo("true") == 0) {
-// t.setActive(true);
-// tlist.setActive(t, true);
-// } else {
-// t.setActive(false);
-// }
-//
-// if (e.getAttribute("Complete").compareTo("true") == 0) {
-// t.setCompleted(true);
-// } else {
-// t.setCompleted(false);
-// }
-// if (e.getAttribute("IsCategory").compareTo("true") == 0) {
-// t.setIsCategory(true);
-// } else {
-// t.setIsCategory(false);
-// }
-//
-// if (e.hasAttribute("Notes")) {
-// t.setNotes(e.getAttribute("Notes"));
-// } else {
-// t.setNotes("");
-// }
-// if (e.hasAttribute("Elapsed")) {
-// t.setElapsedTime(e.getAttribute("Elapsed"));
-// } else {
-// t.setElapsedTime("");
-// }
-// if (e.hasAttribute("Estimated")) {
-// t.setEstimatedTime(e.getAttribute("Estimated"));
-// } else {
-// t.setEstimatedTime("");
-// }
-//
-// int i = 0;
-// while (e.hasAttribute("link"+i)) {
-// t.getRelatedLinks().add(e.getAttribute("link"+i));
-// i++;
-// }
-//
-// if (!readVersion.equals("1.0.0")) {
-// // for newer revisions
-// }
-//
-// i = 0;
-// NodeList list = e.getChildNodes();
-// for (i = 0; i < list.getLength(); i++) {
-// Node child = list.item(i);
-// t.addSubTask(readTaskAndSubTasks(child, t, tlist));
-// }
-// if (root != null) {
-// t.setParent(root);
-// }
-// return t;
-// }
-
- private static void readTaskCategory(Node node, TaskList tlist) {
- Element e = (Element) node;
- TaskCategory cat = new TaskCategory(e.getAttribute("Name"));
- tlist.addCategory(cat);
- NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- cat.addTask(readTask(child, tlist, cat, null));
- }
- }
-
- private static void readQueryCategory(Node node, TaskList tlist) {
- Element e = (Element) node;
- BugzillaQueryCategory cat = new BugzillaQueryCategory(e.getAttribute("Description"), e.getAttribute("URL"));
- tlist.addCategory(cat);
- }
-
- private static ITask readTask(Node node, TaskList tlist, TaskCategory cat, ITask parent) {
- Element e = (Element) node;
- ITask t;
- String handle = e.getAttribute("Handle");
- String label = e.getAttribute("Label");
- String priority = e.getAttribute("Priority");
-
- if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
- t = new BugzillaTask(handle, label, true);
- BugzillaTask bt = (BugzillaTask) t;
- bt.setState(BugTaskState.FREE);
- bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
- .longValue()));
- if (e.getAttribute("Dirty").compareTo("true") == 0) {
- bt.setDirty(true);
- } else {
- bt.setDirty(false);
- }
- if (bt.readBugReport() == false) {
- MylarPlugin.log("Failed to read bug report", null);
- }
- } else {
- t = new Task(handle, label);
- }
- t.setPriority(priority);
- t.setPath(e.getAttribute("Path"));
-
- if (e.getAttribute("Active").compareTo("true") == 0) {
- t.setActive(true);
- tlist.setActive(t, true);
- } else {
- t.setActive(false);
- }
- if (e.getAttribute("Complete").compareTo("true") == 0) {
- t.setCompleted(true);
- } else {
- t.setCompleted(false);
- }
- if (e.hasAttribute("Notes")) {
- t.setNotes(e.getAttribute("Notes"));
- } else {
- t.setNotes("");
- }
- if (e.hasAttribute("Elapsed")) {
- t.setElapsedTime(e.getAttribute("Elapsed"));
- } else {
- t.setElapsedTime("");
- }
- if (e.hasAttribute("Estimated")) {
- t.setEstimatedTime(e.getAttribute("Estimated"));
- } else {
- t.setEstimatedTime("");
- }
-
- int i = 0;
- while (e.hasAttribute("link"+i)) {
- t.getRelatedLinks().add(e.getAttribute("link"+i));
- i++;
- }
- t.setCategory(cat);
- t.setParent(parent);
- NodeList list = e.getChildNodes();
- for (i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- t.addSubTask(readTask(child, tlist, null, t));
- }
- return t;
- }
-
- private static void readTasksToNewFormat(Node node, TaskList tlist) {
- Element e = (Element) node;
- ITask t;
- String handle = e.getAttribute("Handle");
- String label = e.getAttribute("Label");
-
- if (e.getAttribute("IsCategory").compareTo("true") == 0) {
- TaskCategory c = new TaskCategory(label);
- NodeList list = e.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- readSubTasksToNewFormat(child, tlist, c);
- }
- tlist.addCategory(c);
- } else {
- String priority = e.getAttribute("Priority");
- if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
- t = new BugzillaTask(handle, label, true);
- BugzillaTask bt = (BugzillaTask) t;
- bt.setState(BugTaskState.FREE);
- bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
- .longValue()));
- if (e.getAttribute("Dirty").compareTo("true") == 0) {
- bt.setDirty(true);
- } else {
- bt.setDirty(false);
- }
- if (bt.readBugReport() == false) {
- MylarPlugin.log("Failed to read bug report", null);
- }
- } else {
- t = new Task(handle, label);
- }
- t.setPriority(priority);
- t.setPath(e.getAttribute("Path"));
- t.setNotes(e.getAttribute("Notes"));
- t.setElapsedTime(e.getAttribute("Elapsed"));
- t.setEstimatedTime(e.getAttribute("Estimated"));
-
- if (e.getAttribute("Active").compareTo("true") == 0) {
- t.setActive(true);
- tlist.setActive(t, true);
- } else {
- t.setActive(false);
- }
- if (e.getAttribute("Complete").compareTo("true") == 0) {
- t.setCompleted(true);
- } else {
- t.setCompleted(false);
- }
-
- int i = 0;
- while (e.hasAttribute("link" + i)) {
- t.getRelatedLinks().add(e.getAttribute("link" + i));
- i++;
- }
- tlist.addRootTask(t);
- i = 0;
- NodeList list = e.getChildNodes();
- for (i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- readSubTasksToNewFormat(child, tlist, null);
- }
- }
- }
- private static void readSubTasksToNewFormat(Node node, TaskList tlist, TaskCategory cat) {
- Element e = (Element) node;
- ITask t;
- String handle = e.getAttribute("Handle");
- String label = e.getAttribute("Label");
- String priority = e.getAttribute("Priority");
- if (e.getAttribute("Bugzilla").compareTo("true") == 0) {
- t = new BugzillaTask(handle, label, true);
- BugzillaTask bt = (BugzillaTask) t;
- bt.setState(BugTaskState.FREE);
- bt.setLastRefresh(new Date(new Long(e.getAttribute("LastDate"))
- .longValue()));
- if (e.getAttribute("Dirty").compareTo("true") == 0) {
- bt.setDirty(true);
- } else {
- bt.setDirty(false);
- }
- if (bt.readBugReport() == false) {
- MylarPlugin.log("Failed to read bug report", null);
- }
- } else {
- t = new Task(handle, label);
- }
- t.setPriority(priority);
- t.setPath(e.getAttribute("Path"));
- t.setNotes(e.getAttribute("Notes"));
- t.setElapsedTime(e.getAttribute("Elapsed"));
- t.setEstimatedTime(e.getAttribute("Estimated"));
-
- if (e.getAttribute("Active").compareTo("true") == 0) {
- t.setActive(true);
- tlist.setActive(t, true);
- } else {
- t.setActive(false);
- }
- if (e.getAttribute("Complete").compareTo("true") == 0) {
- t.setCompleted(true);
- } else {
- t.setCompleted(false);
- }
-
- int i = 0;
- while (e.hasAttribute("link" + i)) {
- t.getRelatedLinks().add(e.getAttribute("link" + i));
- i++;
- }
- if (cat == null) {
- tlist.addRootTask(t);
- } else {
- cat.addTask(t);
- t.setCategory(cat);
- }
-
- i = 0;
- NodeList list = e.getChildNodes();
- for (i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- readSubTasksToNewFormat(child, tlist, cat);
- }
- }
-}
-

Back to the top