Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-07-13 18:51:57 -0400
committersminto2005-07-13 18:51:57 -0400
commit792f9199babba524f290b6e9545531d9e5ecdec1 (patch)
tree806da4db862a4d36cdf49066c3310ff9a2d0ce38 /org.eclipse.mylyn.tasks.ui
parentfc8c2c1e3760f3c060d0174d37958e6037f7dd07 (diff)
downloadorg.eclipse.mylyn.tasks-792f9199babba524f290b6e9545531d9e5ecdec1.tar.gz
org.eclipse.mylyn.tasks-792f9199babba524f290b6e9545531d9e5ecdec1.tar.xz
org.eclipse.mylyn.tasks-792f9199babba524f290b6e9545531d9e5ecdec1.zip
fixed Bug# 103594 make query categories work again
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/AbstractCategory.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITask.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskInfo.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java22
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListElement.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListExternalizer.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/ITaskListExternalizer.java)12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java21
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/Task.java46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListManager.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/DefaultTaskListExternalizer.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java)9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/RelativePathUtil.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/RelativePathUtil.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskCategory.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java)38
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskList.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java)27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java)48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateCategoryAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/CreateTaskAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java103
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java70
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java338
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskTest.java137
24 files changed, 367 insertions, 603 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index cfa825a52..bb99be6ec 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -22,8 +22,8 @@ Eclipse-AutoStart: true
Bundle-Vendor: University of British Columbia
Bundle-ClassPath: mylar-tasklist.jar
Export-Package: org.eclipse.mylar.tasks,
+ org.eclipse.mylar.tasks.internal,
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
+ org.eclipse.mylar.tasks.ui.views
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/AbstractCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/AbstractCategory.java
index f8b994464..7a7508dad 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/AbstractCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/AbstractCategory.java
@@ -11,12 +11,14 @@
package org.eclipse.mylar.tasks;
+import java.util.List;
+
import org.eclipse.swt.graphics.Image;
/**
* @author Ken Sueda
*/
-public class AbstractCategory implements ITaskListElement {
+public abstract class AbstractCategory implements ITaskListElement {
private String priority = "";
protected String description = "";
@@ -57,4 +59,6 @@ public class AbstractCategory implements ITaskListElement {
public Image getStatusIcon() {
return null;
}
+
+ public abstract List<?> getChildren();
}
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 7a19b201c..6e6561ba6 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
@@ -16,12 +16,14 @@ package org.eclipse.mylar.tasks;
import java.io.Serializable;
import java.util.List;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
+
/**
* @author Mik Kersten
*
* TODO: make IDs be handles
*/
-public interface ITask extends Serializable {
+public interface ITask extends Serializable, ITaskListElement {
@Override
public abstract String toString();
@@ -75,12 +77,7 @@ public interface ITask extends Serializable {
public abstract void addSubTask(ITask t);
public abstract void removeSubTask(ITask t);
-
- /**
- * Opens this task in an editor
- */
- public abstract void openTaskInEditor();
-
+
public abstract String getToolTipText();
public abstract String getPriority();
@@ -90,14 +87,12 @@ public interface ITask extends Serializable {
public abstract String getDeleteConfirmationMessage();
public abstract void setPriority(String priority);
- @Deprecated
- public abstract boolean isCategory();
- @Deprecated
- public abstract void setIsCategory(boolean b);
public abstract void setCategory(TaskCategory cat);
public abstract TaskCategory getCategory();
public abstract String getElapsedTimeForDisplay();
+
+ public abstract boolean participatesInTaskHandles();
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskInfo.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskInfo.java
index e8fbc8de8..652184ac7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskInfo.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskInfo.java
@@ -8,9 +8,7 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-/*
- * Created on Jan 12, 2005
- */
+
package org.eclipse.mylar.tasks;
/**
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java
index d921dad33..44a5f3c62 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java
@@ -14,7 +14,9 @@ package org.eclipse.mylar.tasks;
import java.util.List;
import org.eclipse.jface.action.IAction;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
+import org.eclipse.ui.IWorkbenchPage;
/**
* @author Mik Kersten
@@ -26,4 +28,24 @@ public interface ITaskListActionContributor {
public abstract List<IAction> getToolbarActions(TaskListView view);
public abstract List<IAction> getPopupActions(TaskListView view);
+
+ public abstract void taskActivated(ITask task);
+
+ public abstract void taskDeactivated(ITask task);
+
+ public abstract void itemDeleted(ITaskListElement element);
+
+ public abstract void taskCompleted(ITask task);
+
+ public abstract void itemOpened(ITaskListElement element);
+
+ public void taskClosed(ITask element, IWorkbenchPage page);
+
+ public abstract boolean acceptsItem(ITaskListElement element);
+
+ public abstract void dropItem(ITaskListElement element, TaskCategory category);
+
+ public abstract ITask taskAdded(ITask newTask);
+
+ public abstract void restoreState(TaskListView taskListView);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListElement.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListElement.java
index b8b0a5927..973e07616 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListElement.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListElement.java
@@ -10,13 +10,23 @@
*******************************************************************************/
package org.eclipse.mylar.tasks;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
/**
* @author Ken Sueda
*/
public interface ITaskListElement {
+ // TODO: remove hard-coded fonts and colors
+ 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 Color GRAY_VERY_LIGHT = new Color(Display.getDefault(), 200, 200, 200); // TODO: use theme?
+
+
public abstract Image getIcon();
public abstract Image getStatusIcon();
@@ -26,4 +36,21 @@ public interface ITaskListElement {
public abstract String getDescription(boolean label);
public abstract String getHandle();
+
+ /**
+ * Used for wrapping bugzilla hits
+ */
+ public ITask getCorrespondingActivatableTask();
+
+ public abstract boolean hasCorrespondingActivatableTask();
+
+ public abstract boolean isDirectlyModifiable();
+
+ public abstract boolean isActivatable();
+
+ public abstract boolean isDragAndDropEnabled();
+
+ public abstract Color getForeground();
+
+ public abstract Font getFont();
}
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/ITaskListExternalizer.java
index 04e42fe5d..8bafc5a22 100644
--- 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/ITaskListExternalizer.java
@@ -9,11 +9,9 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasks.util;
+package org.eclipse.mylar.tasks;
-import org.eclipse.mylar.tasks.AbstractCategory;
-import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.TaskList;
+import org.eclipse.mylar.tasks.internal.TaskList;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -25,6 +23,12 @@ import org.w3c.dom.Node;
*/
public interface ITaskListExternalizer {
+ /**
+ * Note that registries get read as a normal category, but get
+ * written out first.
+ */
+ public abstract void createRegistry(Document doc, Node parent);
+
public abstract String getCategoryTagName();
public abstract String getTaskTagName();
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 e74def544..9af78859b 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,8 +19,8 @@ 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.internal.TaskListExternalizer;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.util.TaskListExternalizer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
@@ -164,19 +164,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
super();
plugin = this;
}
-
-// /**
-// * 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 {
initializeDefaultPreferences(getPrefs());
@@ -313,11 +301,6 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
return externalizer;
}
- public void addActionContributor() {
- // TODO Auto-generated method stub
-
- }
-
public ITaskListActionContributor getContributor() {
return contributor;
}
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 a2a0a0d26..017eb7e35 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
@@ -18,8 +18,11 @@ import java.util.Date;
import java.util.List;
import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchPage;
@@ -30,7 +33,7 @@ import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten
*/
-public class Task implements ITask, ITaskListElement {
+public class Task implements ITask {
private static final long serialVersionUID = 3545518391537382197L;
private boolean active = false;
@@ -385,4 +388,45 @@ public class Task implements ITask, ITaskListElement {
public String getDeleteConfirmationMessage() {
return "Delete the selected task and discard task context?";
}
+
+ public boolean isDirectlyModifiable() {
+ return true;
+ }
+
+ public ITask getCorrespondingActivatableTask() {
+ return this;
+ }
+
+ public boolean hasCorrespondingActivatableTask() {
+ return true;
+ }
+
+ public boolean isActivatable() {
+ return true;
+ }
+
+ public boolean isDragAndDropEnabled() {
+ return true;
+ }
+
+ public boolean participatesInTaskHandles() {
+ return true;
+ }
+
+ public Color getForeground() {
+ if (isCompleted()){
+ return GRAY_VERY_LIGHT;
+ } else {
+ return null;
+ }
+ }
+
+ public Font getFont(){
+ if (isActive()) return BOLD;
+ for (ITask child : getChildren()) {
+ if (child.isActive())
+ return BOLD;
+ }
+ return null;
+ }
}
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 738a97255..f59713b5d 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
@@ -18,7 +18,9 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.util.RelativePathUtil;
+import org.eclipse.mylar.tasks.internal.RelativePathUtil;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
+import org.eclipse.mylar.tasks.internal.TaskList;
/**
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/internal/DefaultTaskListExternalizer.java
index 10b4a4702..bffe0233c 100644
--- 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/internal/DefaultTaskListExternalizer.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasks.util;
+package org.eclipse.mylar.tasks.internal;
import java.util.ArrayList;
import java.util.List;
@@ -17,9 +17,8 @@ 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.ITaskListExternalizer;
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;
@@ -210,4 +209,8 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
public String getTaskTagName() {
return TAG_TASK;
}
+
+ public void createRegistry(Document doc, Node parent) {
+ // nothing to do
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/RelativePathUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/RelativePathUtil.java
index b6105b6ed..50e320a79 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/RelativePathUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/RelativePathUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasks.util;
+package org.eclipse.mylar.tasks.internal;
public class RelativePathUtil {
public static String findRelativePath(String baseDirectory, String filePath) {
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/internal/TaskCategory.java
index a21d259fc..7c75640eb 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/internal/TaskCategory.java
@@ -11,12 +11,17 @@
/*
* Created on Dec 26, 2004
*/
-package org.eclipse.mylar.tasks;
+package org.eclipse.mylar.tasks.internal;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.mylar.tasks.AbstractCategory;
+import org.eclipse.mylar.tasks.ITask;
+import org.eclipse.mylar.tasks.TaskListImages;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -70,4 +75,35 @@ public class TaskCategory extends AbstractCategory implements Serializable {
return false;
}
}
+
+ public ITask getCorrespondingActivatableTask() {
+ return null;
+ }
+ public boolean hasCorrespondingActivatableTask() {
+ return false;
+ }
+
+ public boolean isDirectlyModifiable() {
+ return true;
+ }
+
+ public boolean isActivatable() {
+ return false;
+ }
+
+ public boolean isDragAndDropEnabled() {
+ return false;
+ }
+
+ public Color getForeground() {
+ return null;
+ }
+
+ public Font getFont() {
+ for (ITask child : getChildren()) {
+ if (child.isActive())
+ return BOLD;
+ }
+ return null;
+ }
}
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/internal/TaskList.java
index 18f66cf40..785360280 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/internal/TaskList.java
@@ -11,12 +11,15 @@
/*
* Created on Dec 22, 2004
*/
-package org.eclipse.mylar.tasks;
+package org.eclipse.mylar.tasks.internal;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.mylar.tasks.AbstractCategory;
+import org.eclipse.mylar.tasks.ITask;
+
/**
* @author Mik Kersten
@@ -30,18 +33,7 @@ public class TaskList implements Serializable {
private transient List<ITask> activeTasks = new ArrayList<ITask>();
public void addRootTask(ITask task) {
- // 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) {
@@ -58,10 +50,6 @@ public class TaskList implements Serializable {
}
public void deleteTask(ITask task) {
- // XXX refactored
-// if (task instanceof BugzillaTask) {
-// ((BugzillaTask)task).removeReport();
-// }
boolean deleted = deleteTaskHelper(rootTasks, task);
if (!deleted) {
for (TaskCategory cat : getTaskCategories()) {
@@ -140,12 +128,9 @@ public class TaskList implements Serializable {
int ihandle = 0;
int max = 0;
for (ITask t : tasks) {
- // XXX refactored
-// if (t instanceof BugzillaTask) {
-// ihandle = 0;
-// } else {
+ if(t.participatesInTaskHandles()){
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/util/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java
index ef6d2314d..f07da2bf1 100644
--- 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/internal/TaskListExternalizer.java
@@ -9,7 +9,7 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasks.util;
+package org.eclipse.mylar.tasks.internal;
import java.io.File;
import java.io.FileOutputStream;
@@ -34,8 +34,9 @@ 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.ITaskListExternalizer;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
-import org.eclipse.mylar.tasks.TaskList;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -57,6 +58,10 @@ public class TaskListExternalizer {
defaultExternalizer.setExternalizers(externalizers);
MylarTasksPlugin.getTaskListManager().getTaskList().clear();
readTaskList(MylarTasksPlugin.getTaskListManager().getTaskList(), MylarTasksPlugin.getTaskListManager().getTaskListFile());
+ if(MylarTasksPlugin.getDefault().getContributor() != null){
+ MylarTasksPlugin.getDefault().getContributor().restoreState(TaskListView.getDefault());
+ TaskListView.getDefault().getViewer().refresh();
+ }
}
public void removeExternalizer(ITaskListExternalizer externalizer) {
@@ -79,7 +84,9 @@ public class TaskListExternalizer {
Element root = doc.createElement("TaskList");
root.setAttribute("Version", "1.0.1");
- // XXX refactored
+ for (ITaskListExternalizer externalizer : externalizers) {
+ externalizer.createRegistry(doc, root);
+ }
// writeBugzillaRegistry(tlist.getBugzillaTaskRegistry(), doc, root);
// iterate through each subtask and externalize those
@@ -113,21 +120,6 @@ public class TaskListExternalizer {
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.
*
@@ -226,7 +218,13 @@ public class TaskListExternalizer {
} else {
for (ITaskListExternalizer externalizer : externalizers) {
if (externalizer.canReadTask(child)) {
- tlist.addRootTask(externalizer.readTask(child, tlist, null, null));
+ // TODO add the tasks properly
+ ITask newTask = externalizer.readTask(child, tlist, null, null);
+ if(MylarTasksPlugin.getDefault().getContributor().acceptsItem(newTask)){
+ newTask = MylarTasksPlugin.getDefault().getContributor().taskAdded(newTask);
+ }
+ tlist.addRootTask(newTask);
+
wasRead = true;
break;
}
@@ -254,18 +252,6 @@ public class TaskListExternalizer {
}
}
- // 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.
*
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 2ddd6cd38..cf3ae0013 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
@@ -46,8 +46,8 @@ 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.internal.RelativePathUtil;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.mylar.tasks.util.RelativePathUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.FocusEvent;
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 1e865d23c..67cbcc74d 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
@@ -14,7 +14,7 @@ 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.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
/**
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 9c2c9d318..829d7483b 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
@@ -16,7 +16,7 @@ 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.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
/**
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 71c21acf2..f32af1e81 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
@@ -16,9 +16,10 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.core.MylarPlugin;
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.TaskCategory;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.internal.Workbench;
@@ -41,10 +42,14 @@ public class DeleteAction extends Action {
@Override
public void run() {
+
// MylarPlugin.getDefault().actionObserved(this);
Object selectedObject = ((IStructuredSelection) this.view.getViewer()
.getSelection()).getFirstElement();
- if (selectedObject instanceof ITask) {
+ if(selectedObject instanceof ITaskListElement &&
+ MylarTasksPlugin.getDefault().getContributor().acceptsItem((ITaskListElement)selectedObject)){
+ MylarTasksPlugin.getDefault().getContributor().itemDeleted((ITaskListElement)selectedObject);
+ }else if (selectedObject instanceof ITask) {
ITask task = (ITask) selectedObject;
if (task.isActive()) {
MessageDialog.openError(Workbench.getInstance()
@@ -93,16 +98,6 @@ public class DeleteAction extends Action {
}
}
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/MarkTaskCompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/MarkTaskCompleteAction.java
index ed00ec76e..69af53c3b 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,8 +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.ITask;
+import org.eclipse.mylar.tasks.ITaskListElement;
+import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
/**
@@ -37,7 +40,10 @@ public class MarkTaskCompleteAction extends Action {
public void run() {
// MylarPlugin.getDefault().actionObserved(this);
Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
- if (selectedObject instanceof Task){
+ if(selectedObject instanceof ITask &&
+ MylarTasksPlugin.getDefault().getContributor().acceptsItem((ITaskListElement)selectedObject)){
+ MylarTasksPlugin.getDefault().getContributor().taskCompleted((ITask)selectedObject);
+ }else if (selectedObject instanceof Task){
((Task)selectedObject).setCompleted(true);
}
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 38bbf196f..42b00c81f 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
@@ -11,16 +11,13 @@
package org.eclipse.mylar.tasks.ui.actions;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.mylar.tasks.ITaskListElement;
+import org.eclipse.mylar.tasks.MylarTasksPlugin;
+import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
/**
* @author Mik Kersten and Ken Sueda
@@ -41,82 +38,18 @@ public class OpenTaskEditorAction extends Action {
@Override
public void run() {
- 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) {
- try {
- IWebBrowser b = null;
- int flags = 0;
- if (WorkbenchBrowserSupport.getInstance()
- .isInternalWebBrowserAvailable()) {
- flags = WorkbenchBrowserSupport.AS_EDITOR
- | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
-
- } else {
- flags = WorkbenchBrowserSupport.AS_EXTERNAL
- | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
- }
- b = WorkbenchBrowserSupport.getInstance().createBrowser(
- flags, "org.eclipse.mylar.tasks", "Task",
- "tasktooltip");
- b.openURL(new URL(url));
- } catch (PartInitException e) {
- MessageDialog.openError( Display.getDefault().getActiveShell(),
- "Browser init error", "Browser could not be initiated");
- } catch (MalformedURLException e) {
- MessageDialog.openError( Display.getDefault().getActiveShell(),
- "URL not found", "URL Could not be opened");
- }
+ ISelection selection = this.view.getViewer().getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof ITaskListElement) {
+ ITaskListElement element = (ITaskListElement)obj;
+ if(MylarTasksPlugin.getDefault().getContributor().acceptsItem(element)){
+ MylarTasksPlugin.getDefault().getContributor().itemOpened(element);
+ } else{
+ if(element instanceof Task){
+ ((Task)element).openTaskInEditor();
+ }
+ }
+ }
+ this.view.getViewer().refresh(obj);
}
} \ No newline at end of file
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 eba348ed3..56d3d94eb 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,6 +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.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -29,7 +30,7 @@ import org.eclipse.swt.graphics.Image;
public class TaskListLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider, IFontProvider {
private Color backgroundColor = null;
-
+
public String getColumnText(Object obj, int columnIndex) {
if (obj instanceof ITaskListElement) {
ITaskListElement element = (ITaskListElement) obj;
@@ -51,43 +52,10 @@ public class TaskListLabelProvider extends LabelProvider implements ITableLabelP
}
public Font getFont(Object element) {
- // 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;
-// }
-// }
-// }
-// }
+ if (element instanceof ITaskListElement) {
+ ITaskListElement task = (ITaskListElement)element;
+ return task.getFont();
+ }
return null;
}
@@ -112,34 +80,30 @@ public class TaskListLabelProvider extends LabelProvider implements ITableLabelP
}
public Color getBackground(Object element) {
- // XXX refactored
-// if (element instanceof ITask) {
+ // XXX refactored highlighters
+ 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) {
+// }
+// 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;
-// }
+ } else if (element instanceof AbstractCategory) {
+ return backgroundColor;
+ }
return null;
}
public Color getForeground(Object element) {
- // 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;
-// }
+ if (element instanceof ITaskListElement) {
+ ITaskListElement task = (ITaskListElement)element;
+ return task.getForeground();
+ }
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 cc5283faf..f71e958d9 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
@@ -55,8 +55,8 @@ import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
-import org.eclipse.mylar.tasks.TaskCategory;
import org.eclipse.mylar.tasks.TaskListImages;
+import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.actions.ClearContextAction;
import org.eclipse.mylar.tasks.ui.actions.CreateCategoryAction;
@@ -276,21 +276,17 @@ public class TaskListView extends ViewPart {
private ViewerFilter completeFilter = new ViewerFilter(){
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof ITask) {
- return !((ITask)element).isCompleted();
+ if (element instanceof ITaskListElement) {
+ if(((ITaskListElement)element).hasCorrespondingActivatableTask()){
+ ITask task = ((ITaskListElement)element).getCorrespondingActivatableTask();
+ if(task != null){
+ return !task.isCompleted();
+ } 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;
-// }
}
};
@@ -386,30 +382,21 @@ public class TaskListView extends ViewPart {
return null;
}
public Object [] getChildren(Object parent) {
- if (parent instanceof TaskCategory) {
- return ((TaskCategory)parent).getChildren().toArray();
+ if (parent instanceof AbstractCategory) {
+ return ((AbstractCategory)parent).getChildren().toArray();
} else if (parent instanceof Task) {
return ((Task)parent).getChildren().toArray();
}
- // XXX refactored
-// else if (parent instanceof BugzillaQueryCategory) {
-// return ((BugzillaQueryCategory) parent).getHits().toArray();
-// }
return new Object[0];
}
public boolean hasChildren(Object parent) {
- if (parent instanceof TaskCategory) {
- TaskCategory cat = (TaskCategory)parent;
+ if (parent instanceof AbstractCategory) {
+ AbstractCategory cat = (AbstractCategory)parent;
return cat.getChildren() != null && cat.getChildren().size() > 0;
} else if (parent instanceof Task) {
Task t = (Task) parent;
return t.getChildren() != null && t.getChildren().size() > 0;
}
- // XXX refactored
-// else if (parent instanceof BugzillaQueryCategory) {
-// BugzillaQueryCategory cat = (BugzillaQueryCategory)parent;
-// return cat.getHits() != null && cat.getHits().size() > 0;
-// }
return false;
}
}
@@ -423,13 +410,12 @@ public class TaskListView extends ViewPart {
public boolean canModify(Object element, String property) {
int columnIndex = Arrays.asList(columnNames).indexOf(property);
if (element instanceof ITask) {
- ITask task = (ITask) element;
+ ITask task = (ITask)element;
switch (columnIndex) {
case 0: return true;
case 1: return false;
- // XXX refactored
- case 2: return true;//!(task instanceof BugzillaTask);
- case 3: return true;//!(task instanceof BugzillaTask);
+ case 2: return task.isDirectlyModifiable();
+ case 3: return task.isDirectlyModifiable();
}
} else if (element instanceof AbstractCategory) {
switch (columnIndex) {
@@ -437,68 +423,60 @@ public class TaskListView extends ViewPart {
case 1:
case 2:
return false;
- case 3: return true;
+ case 3: return ((AbstractCategory)element).isDirectlyModifiable();
}
+ } else if(element instanceof ITaskListElement){
+ ITaskListElement taskListElement = (ITaskListElement)element;
+ switch (columnIndex) {
+ case 0: return taskListElement.isActivatable();
+ case 1: return false;
+ case 2: return taskListElement.isDirectlyModifiable();
+ case 3: return taskListElement.isDirectlyModifiable();
+ }
}
- // XXX refactored
-// else if (element instanceof BugzillaHit){
-// if (columnIndex == 0) {
-// return true;
-// }else {
-// return false;
-// }
-// }
return false;
}
public Object getValue(Object element, String property) {
- int columnIndex = Arrays.asList(columnNames).indexOf(property);
- if (element instanceof ITask) {
- ITask task = (ITask) element;
- switch (columnIndex) {
- case 0:
- return new Boolean(true); // return tyep doesn't matter
- case 1:
- return "";
- case 2:
- String priorityString = task.getPriority().substring(1);
- return new Integer(priorityString);
- case 3:
- return task.getLabel();
- }
- } else if (element instanceof AbstractCategory) {
- AbstractCategory cat = (AbstractCategory) element;
- switch (columnIndex) {
- case 0:
- return new Boolean(false);
- case 1:
- return "";
- case 2:
- return "";
- case 3:
- return cat.getDescription(true);
+ try{
+ int columnIndex = Arrays.asList(columnNames).indexOf(property);
+ if (element instanceof ITaskListElement) {
+ final ITaskListElement taskListElement = (ITaskListElement)element;
+ ITask task = null;
+ if(taskListElement.hasCorrespondingActivatableTask()){
+ task = taskListElement.getCorrespondingActivatableTask();
+ }
+ switch (columnIndex) {
+ case 0:
+ if(task == null){
+ return new Boolean(true);
+ } else {
+ return new Boolean(task.isCompleted());
+ }
+ case 1:
+ return "";
+ case 2:
+ String priorityString = taskListElement.getPriority().substring(1);
+ return new Integer(priorityString);
+ case 3:
+ return taskListElement.getDescription(true);
+ }
+ } else if (element instanceof AbstractCategory) {
+ AbstractCategory cat = (AbstractCategory) element;
+ switch (columnIndex) {
+ case 0:
+ return new Boolean(false);
+ case 1:
+ return "";
+ case 2:
+ return "";
+ case 3:
+ return cat.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);
-// }
- }
+ } catch (Exception e){
+ MylarPlugin.log(e, e.getMessage());
+ }
return "";
}
@@ -506,78 +484,59 @@ public class TaskListView extends ViewPart {
int columnIndex = -1;
try {
columnIndex = Arrays.asList(columnNames).indexOf(property);
- if (((TreeItem) element).getData() instanceof ITask) {
-
- final ITask task = (ITask) ((TreeItem) element).getData();
+ if (((TreeItem) element).getData() instanceof AbstractCategory) {
+ AbstractCategory cat = (AbstractCategory)((TreeItem) element).getData();
switch (columnIndex) {
- case 0:
- if (task.isActive()) {
- new TaskDeactivateAction(task, INSTANCE).run();
- } else {
- new TaskActivateAction(task).run();
- }
+ case 0:
viewer.setSelection(null);
break;
case 1:
break;
case 2:
- Integer intVal = (Integer) value;
- task.setPriority("P" + (intVal + 1));
- viewer.setSelection(null);
break;
case 3:
- task.setLabel(((String) value).trim());
- MylarTasksPlugin.getTaskListManager()
- .taskPropertyChanged(task, columnNames[3]);
+ cat.setDescription(((String) value).trim());
viewer.setSelection(null);
break;
}
- } else if (((TreeItem) element).getData() instanceof AbstractCategory) {
- AbstractCategory cat = (AbstractCategory)((TreeItem) element).getData();
+ } else if (((TreeItem) element).getData() instanceof ITaskListElement) {
+
+ final ITaskListElement taskListElement = (ITaskListElement) ((TreeItem) element).getData();
+ ITask task = null;
+ if(taskListElement.hasCorrespondingActivatableTask()){
+ task = taskListElement.getCorrespondingActivatableTask();
+ }
switch (columnIndex) {
- case 0:
- viewer.setSelection(null);
+ case 0:
+ task = taskListElement.getCorrespondingActivatableTask();
+ if (task != null) {
+ if (task.isActive()) {
+ new TaskDeactivateAction(task, INSTANCE).run();
+ } else {
+ new TaskActivateAction(task).run();
+ }
+ viewer.setSelection(null);
+ }
break;
case 1:
break;
case 2:
+ if (task.isDirectlyModifiable()) {
+ Integer intVal = (Integer) value;
+ task.setPriority("P" + (intVal + 1));
+ viewer.setSelection(null);
+ }
break;
- case 3:
- cat.setDescription(((String) value).trim());
- viewer.setSelection(null);
+ case 3:
+ if (task.isDirectlyModifiable()) {
+ task.setLabel(((String) value).trim());
+ MylarTasksPlugin.getTaskListManager()
+ .taskPropertyChanged(task, columnNames[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) {
MylarPlugin.log(e, e.getMessage());
@@ -618,7 +577,7 @@ public class TaskListView extends ViewPart {
if (task1.isCompleted()) return 1;
if (task2.isCompleted()) return -1;
if (column == columnNames[1]) {
- // XXX refactored
+ // XXX refactored compare
// if (task1 instanceof BugzillaTask && !(task2 instanceof BugzillaTask)) {
// return 1;
// } else {
@@ -633,7 +592,7 @@ public class TaskListView extends ViewPart {
}
}
// }
- // XXX refactored
+ // XXX refactored compare
// else if(o1 instanceof BugzillaHit && o2 instanceof BugzillaHit){
// BugzillaHit task1 = (BugzillaHit) o1;
// BugzillaHit task2 = (BugzillaHit) o2;
@@ -706,12 +665,6 @@ public class TaskListView extends ViewPart {
if (MylarTasksPlugin.getDefault().isFilterInCompleteMode()) viewer.addFilter(inCompleteFilter);
if (MylarTasksPlugin.getDefault().isFilterCompleteMode()) viewer.addFilter(completeFilter);
- // XXX refactored
-// if (MylarTasksPlugin.getDefault().refreshOnStartUpEnabled()) {
-// refresh.setShowProgress(false);
-// refresh.run();
-// refresh.setShowProgress(true);
-// }
viewer.refresh();
}
@@ -799,21 +752,15 @@ public class TaskListView extends ViewPart {
public void dragSetData(DragSourceEvent event) {
StructuredSelection selection = (StructuredSelection) viewer.getSelection();
- if (selection.getFirstElement() instanceof ITask) {
- if (!selection.isEmpty()) {
- event.data = "" + ((ITask) selection.getFirstElement()).getHandle();
+ if (selection.getFirstElement() instanceof ITaskListElement) {
+ ITaskListElement element = (ITaskListElement)selection.getFirstElement();
+
+ if (!selection.isEmpty() && element.isDragAndDropEnabled()) {
+ event.data = "" + element.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) {
@@ -852,27 +799,15 @@ public class TaskListView extends ViewPart {
viewer.setSelection(null);
viewer.refresh();
return true;
+ } else if(selectedObject instanceof ITaskListElement &&
+ MylarTasksPlugin.getDefault().getContributor().acceptsItem((ITaskListElement)selectedObject) &&
+ getCurrentTarget() instanceof TaskCategory){
+
+ MylarTasksPlugin.getDefault().getContributor().dropItem((ITaskListElement)selectedObject, (TaskCategory)getCurrentTarget());
+ 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;
}
@@ -881,21 +816,13 @@ public class TaskListView extends ViewPart {
TransferData transferType) {
Object selectedObject = ((IStructuredSelection) ((TreeViewer) getViewer())
.getSelection()).getFirstElement();
- if (selectedObject instanceof ITask) {
+ if (selectedObject instanceof ITaskListElement && ((ITaskListElement)selectedObject).isDragAndDropEnabled()) {
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);
}
@@ -953,7 +880,7 @@ public class TaskListView extends ViewPart {
MenuManager subMenuManager = new MenuManager("Choose Highlighter");
final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
- // XXX refactored
+ // XXX refactored highlighters
// for (Iterator<Highlighter> it = MylarUiPlugin.getDefault().getHighlighters().iterator(); it.hasNext();) {
// final Highlighter highlighter = it.next();
// if (selectedObject instanceof Task){
@@ -985,8 +912,8 @@ public class TaskListView extends ViewPart {
}
private void updateActionEnablement(Object sel) {
+// XXX use enables for part of contribution
// if(sel != null && sel instanceof ITaskListElement){
-// // TODO: use enables for part of contribution
// if(sel instanceof BugzillaHit){
// BugzillaTask task = ((BugzillaHit)sel).getAssociatedTask();
// if(task == null){
@@ -1098,32 +1025,19 @@ public class TaskListView extends ViewPart {
}
public void closeTaskEditors(ITask task, IWorkbenchPage page) throws LoginException, IOException{
- IEditorInput input = null;
- // 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);
+ if(MylarTasksPlugin.getDefault().getContributor().acceptsItem(task)){
+ MylarTasksPlugin.getDefault().getContributor().taskClosed(task, page);
+ } else if (task instanceof Task) {
+ IEditorInput input = new TaskEditorInput((Task) task);
- if (editor != null) {
- page.closeEditor(editor, false);
- }
- }
+ IEditorPart editor = page.findEditor(input);
- public void refreshChildren(List<ITask> children) {
- if (children != null) {
- for (ITask child : children) {
- // XXX refactored
-// if (child instanceof BugzillaTask) {
-// ((BugzillaTask)child).refresh();
-// }
+ if (editor != null) {
+ page.closeEditor(editor, false);
}
- }
+ }
}
-
+
private void hookDoubleClickAction() {
viewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskTest.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskTest.java
deleted file mode 100644
index 7fe36b5e1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskTest.java
+++ /dev/null
@@ -1,137 +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 24, 2005
- */
-package org.eclipse.mylar.tasks.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Shawn Minto
- */
-public class TaskTest {
- private int id = -1;
-
- private String name = "";
-
- private List<String> categories = new ArrayList<String>();
-
- private List<TaskTest> taskList = new ArrayList<TaskTest>();
-
- @Override
- public String toString() {
- return "Task";
- }
-
- public boolean isEqual(TaskTest otherTask) {
-
- boolean result = true;
- result = result && (this.id == otherTask.id);
- int compare = (this.name.compareTo(otherTask.name));
- if (compare != 0)
- result = false;
-
- if (this.categories.size() == otherTask.categories.size()) {
- for (int i = 0; i < this.categories.size(); i++) {
- compare = this.categories.get(i).compareTo(
- otherTask.categories.get(i));
- if (compare != 0) {
- result = false;
- break;
- }
- }
- } else {
- result = false;
- }
- if (this.taskList.size() == otherTask.taskList.size()) {
- for (int i = 0; i < this.taskList.size(); i++) {
- result = result
- && (this.taskList.get(i).isEqual(otherTask.taskList
- .get(i)));
- }
- } else {
- result = false;
- }
- return result;
- }
-
- public static void printTask(TaskTest t, String tab) {
- System.out.println(tab + "TaskID: " + t.id);
- System.out.println(tab + "Name: " + t.name);
- System.out.println(tab + "Categories: ");
- for (int i = 0; i < t.categories.size(); i++) {
- System.out.println(tab + "\t " + t.categories.get(i));
- }
- for (int i = 0; i < t.taskList.size(); i++) {
- printTask(t.taskList.get(i), tab + "\t");
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- // public List<String> getCategories() {
- // return categories;
- // }
- // public void setCategories(List<String> categories) {
- // this.categories = categories;
- // }
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public void addCategory(String category) {
- this.categories.add(category);
- }
-
- /**
- * @return Returns the categories.
- */
- public List<String> getCategories() {
- return categories;
- }
-
- /**
- * @param categories The categories to set.
- */
- public void setCategories(List<String> categories) {
- this.categories = categories;
- }
-
- /**
- * @return Returns the taskList.
- */
- public List<TaskTest> getTaskList() {
- return taskList;
- }
-
- /**
- * @param taskList The taskList to set.
- */
- public void setTaskList(List<TaskTest> taskList) {
- this.taskList = taskList;
- }
-
- public void addSubTask(TaskTest sub) {
- this.taskList.add(sub);
- }
-}

Back to the top