Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-07-20 18:11:57 +0000
committersminto2005-07-20 18:11:57 +0000
commitbaca6f8aa8ed80dadb92780ebcfa78298ce18bca (patch)
tree61f63c0bc9dd40d4d1de26df6f1321ee7c2bd1cc /org.eclipse.mylyn.tasks.ui
parentecf292179e351767b769b55486300acee935084c (diff)
downloadorg.eclipse.mylyn.tasks-baca6f8aa8ed80dadb92780ebcfa78298ce18bca.tar.gz
org.eclipse.mylyn.tasks-baca6f8aa8ed80dadb92780ebcfa78298ce18bca.tar.xz
org.eclipse.mylyn.tasks-baca6f8aa8ed80dadb92780ebcfa78298ce18bca.zip
Bug #103588: use extension points in place of ITaskListActionContributor
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/schema/taskListContributor.exsd72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskHandler.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListDynamicSubMenuContributor.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListListener.java47
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListener.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java50
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExtensionReader.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java49
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/DeleteAction.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/OpenTaskEditorAction.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java15
12 files changed, 279 insertions, 122 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/schema/taskListContributor.exsd b/org.eclipse.mylyn.tasks.ui/schema/taskListContributor.exsd
index 28817cd27..e286c806e 100644
--- a/org.eclipse.mylyn.tasks.ui/schema/taskListContributor.exsd
+++ b/org.eclipse.mylyn.tasks.ui/schema/taskListContributor.exsd
@@ -13,7 +13,9 @@
<element name="extension">
<complexType>
<sequence>
- <element ref="taskListContributor" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="taskHandler" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="taskListener" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="dynamicPopupMenu" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@@ -42,7 +44,7 @@
</complexType>
</element>
- <element name="taskListContributor">
+ <element name="taskHandler">
<complexType>
<attribute name="externalizerClass" type="string" use="required">
<annotation>
@@ -54,7 +56,71 @@
</appInfo>
</annotation>
</attribute>
- <attribute name="actionContributorClass" type="string" use="required">
+ <attribute name="taskHandlerClass" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="taskListener">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="dynamicPopupMenu">
+ <complexType>
+ <attribute name="class" type="string" use="required">
<annotation>
<documentation>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskHandler.java
new file mode 100644
index 000000000..bf613e5e0
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskHandler.java
@@ -0,0 +1,25 @@
+package org.eclipse.mylar.tasks;
+
+import org.eclipse.mylar.tasks.internal.TaskCategory;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
+import org.eclipse.ui.IWorkbenchPage;
+
+public interface ITaskHandler {
+
+ public abstract void itemDeleted(ITaskListElement element);
+
+ public abstract void taskCompleted(ITask task);
+
+ public abstract void itemOpened(ITaskListElement element);
+
+ public abstract 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);
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListDynamicSubMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListDynamicSubMenuContributor.java
new file mode 100644
index 000000000..6913de861
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListDynamicSubMenuContributor.java
@@ -0,0 +1,11 @@
+package org.eclipse.mylar.tasks;
+
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
+
+public interface ITaskListDynamicSubMenuContributor {
+
+ public abstract MenuManager getSubMenuManager(TaskListView view,
+ ITaskListElement selection);
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListListener.java
deleted file mode 100644
index c1d26d2c8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListListener.java
+++ /dev/null
@@ -1,47 +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.jface.action.MenuManager;
-import org.eclipse.mylar.tasks.internal.TaskCategory;
-import org.eclipse.mylar.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Mik Kersten
- *
- * TODO: this should use extension points
- */
-public interface ITaskListListener {
-
- public abstract MenuManager getSubMenuManager(TaskListView view, ITaskListElement selection);
-
- 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 abstract 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/ITaskListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListener.java
new file mode 100644
index 000000000..2a46cccaa
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListener.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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;
+
+
+/**
+ * @author Mik Kersten
+ *
+ */
+public interface ITaskListener {
+
+ public abstract void taskActivated(ITask task);
+
+ public abstract void taskDeactivated(ITask task);
+}
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 3fb22141a..9ccf6f6e4 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
@@ -42,12 +42,17 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
private static MylarTasksPlugin plugin;
private static TaskListManager taskListManager;
private TaskListExternalizer externalizer;
- private List<ITaskListListener> contributors = new ArrayList<ITaskListListener>(); // TODO: use extension points
-
- public static final String TASK_CONTRIBUTER_ID = "org.eclipse.mylar.tasks.taskListContributor";
- public static final String EXTERNALIZER_CLASS_ID = "externalizerClass";
- public static final String ACTION_CONTRIBUTER_CLASS_ID = "actionContributorClass";
+ private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO: use extension points
+ public static final String TASK_CONTRIBUTER_EXTENSION_POINT_ID = "org.eclipse.mylar.tasks.taskListContributor";
+ public static final String TASK_HANDLER_ELEMENT = "taskHandler";
+ public static final String EXTERNALIZER_CLASS_ID = "externalizerClass";
+ public static final String ACTION_CONTRIBUTER_CLASS_ID = "taskHandlerClass";
+ public static final String TASK_LISTENER_ELEMENT = "taskListener";
+ public static final String TASK_LISTENER_CLASS_ID = "class";
+ public static final String DYNAMIC_POPUP_ELEMENT = "dynamicPopupMenu";
+ public static final String DYNAMIC_POPUP_CLASS_ID = "class";
+
public static final String REPORT_OPEN_EDITOR = "org.eclipse.mylar.tasks.report.open.editor";
public static final String REPORT_OPEN_INTERNAL = "org.eclipse.mylar.tasks.report.open.internal";
public static final String REPORT_OPEN_EXTERNAL = "org.eclipse.mylar.tasks.report.open.external";
@@ -297,22 +302,41 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
return externalizer;
}
- public List<ITaskListListener> getContributors() {
- return contributors;
+ public List<ITaskHandler> getTaskHandlers() {
+ return taskHandlers;
}
- public ITaskListListener getContributorForElement(ITaskListElement element){
- for(ITaskListListener contributer: contributors){
- if(contributer.acceptsItem(element)) return contributer;
+ public ITaskHandler getTaskHandlerForElement(ITaskListElement element){
+ for(ITaskHandler taskHandler: taskHandlers){
+ if(taskHandler.acceptsItem(element)) return taskHandler;
}
return null;
}
- public void addContributor(ITaskListListener contributor) {
- contributors.add(contributor);
-// if (TaskListView.getDefault() != null) TaskListView.getDefault().resetToolbarsAndPopups();
+ public void addTaskHandler(ITaskHandler taskHandler) {
+ taskHandlers.add(taskHandler);
+ }
+
+ private List<ITaskListDynamicSubMenuContributor> menuContributors = new ArrayList<ITaskListDynamicSubMenuContributor>();
+
+ public List<ITaskListDynamicSubMenuContributor> getDynamicMenuContributers() {
+ return menuContributors;
+ }
+
+ public void addDynamicPopupContributor(ITaskListDynamicSubMenuContributor contributor) {
+ menuContributors.add(contributor);
}
+ private List<ITaskListener> taskListListeners = new ArrayList<ITaskListener>();
+
+ public List<ITaskListener> getTaskListListeners() {
+ return taskListListeners;
+ }
+
+ public void addTaskListListener(ITaskListener taskListListner) {
+ taskListListeners.add(taskListListner);
+ }
+
private void createFileBackup() {
String path = MylarPlugin.getDefault().getUserDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
File taskListFile = new File(path);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExtensionReader.java
new file mode 100644
index 000000000..6876660a4
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExtensionReader.java
@@ -0,0 +1,92 @@
+package org.eclipse.mylar.tasks.internal;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.tasks.ITaskHandler;
+import org.eclipse.mylar.tasks.ITaskListDynamicSubMenuContributor;
+import org.eclipse.mylar.tasks.ITaskListExternalizer;
+import org.eclipse.mylar.tasks.ITaskListener;
+import org.eclipse.mylar.tasks.MylarTasksPlugin;
+
+public class TaskListExtensionReader {
+ private static boolean extensionsRead = false;
+ private static TaskListExtensionReader thisReader = new TaskListExtensionReader();
+
+ // read the extensions and load the required plugins
+ public static void initExtensions(List<ITaskListExternalizer> externalizers, DefaultTaskListExternalizer defaultExternalizer) {
+ // code from "contributing to eclipse" with modifications for deprecated code
+ if(!extensionsRead){
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(MylarTasksPlugin.TASK_CONTRIBUTER_EXTENSION_POINT_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for(int i = 0; i < extensions.length; i++){
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ for(int j = 0; j < elements.length; j++){
+ if(elements[j].getName().compareTo(MylarTasksPlugin.TASK_HANDLER_ELEMENT) == 0){
+ readTaskHandler(elements[j], externalizers);
+ } else if(elements[j].getName().compareTo(MylarTasksPlugin.TASK_LISTENER_ELEMENT) == 0){
+ readTaskListener(elements[j]);
+ } else if(elements[j].getName().compareTo(MylarTasksPlugin.DYNAMIC_POPUP_ELEMENT) == 0){
+ readDynamicPopupContributor(elements[j]);
+ }
+ }
+ }
+ defaultExternalizer.setExternalizers(externalizers);
+ extensionsRead = true;
+ }
+ }
+
+ private static void readTaskListener(IConfigurationElement element) {
+ try{
+ Object taskListener = element.createExecutableExtension(MylarTasksPlugin.TASK_LISTENER_CLASS_ID);
+ if (taskListener instanceof ITaskListener) {
+ MylarTasksPlugin.getDefault().addTaskListListener((ITaskListener) taskListener);
+ } else {
+ MylarPlugin.log("Could not load tasklist listener: " + taskListener.getClass().getCanonicalName() + " must implement " + ITaskListener.class.getCanonicalName(), thisReader);
+ }
+ } catch (CoreException e){
+ MylarPlugin.log(e, "Could not load tasklist listener extension");
+ }
+ }
+
+ private static void readDynamicPopupContributor(IConfigurationElement element) {
+ try{
+ Object dynamicPopupContributor = element.createExecutableExtension(MylarTasksPlugin.DYNAMIC_POPUP_CLASS_ID);
+ if (dynamicPopupContributor instanceof ITaskListDynamicSubMenuContributor) {
+ MylarTasksPlugin.getDefault().addDynamicPopupContributor((ITaskListDynamicSubMenuContributor) dynamicPopupContributor);
+ } else {
+ MylarPlugin.log("Could not load dyanmic popup menu: " + dynamicPopupContributor.getClass().getCanonicalName() + " must implement " + ITaskListDynamicSubMenuContributor.class.getCanonicalName(), thisReader);
+ }
+ } catch (CoreException e){
+ MylarPlugin.log(e, "Could not load dynamic popup extension");
+ }
+ }
+
+ private static void readTaskHandler(IConfigurationElement element, List<ITaskListExternalizer> externalizers) {
+ try{
+ Object externalizer = element.createExecutableExtension(MylarTasksPlugin.EXTERNALIZER_CLASS_ID);
+ if (externalizer instanceof ITaskListExternalizer) {
+ externalizers.add((ITaskListExternalizer) externalizer);
+ } else {
+ MylarPlugin.log("Could not load externalizer: " + externalizer.getClass().getCanonicalName() + " must implement " + ITaskListExternalizer.class.getCanonicalName(), thisReader);
+ }
+
+ Object taskHandler = element.createExecutableExtension(MylarTasksPlugin.ACTION_CONTRIBUTER_CLASS_ID);
+ if (taskHandler instanceof ITaskHandler) {
+ MylarTasksPlugin.getDefault().addTaskHandler((ITaskHandler) taskHandler);
+
+ }else {
+ MylarPlugin.log("Could not load contributor: " + taskHandler.getClass().getCanonicalName() + " must implement " + ITaskHandler.class.getCanonicalName(), thisReader);
+ }
+ } catch (CoreException e){
+ MylarPlugin.log(e, "Could not load task handler extension");
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java
index cfee7ddec..84b39d302 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java
@@ -32,16 +32,10 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListListener;
+import org.eclipse.mylar.tasks.ITaskHandler;
import org.eclipse.mylar.tasks.ITaskListExternalizer;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.w3c.dom.Document;
@@ -60,42 +54,9 @@ public class TaskListExternalizer {
private String readVersion = "";
private boolean hasCaughtException = false;
-
- private boolean externalizersInitialized = false;
- // read the extensions and load the required plugins
public void initExtensions() {
- // code from "contributing to eclipse" with modifications for deprecated code
- if(!externalizersInitialized){
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint = registry.getExtensionPoint(MylarTasksPlugin.TASK_CONTRIBUTER_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
- for(int i = 0; i < extensions.length; i++){
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for(int j = 0; j < elements.length; j++){
- try{
- Object externalizer = elements[j].createExecutableExtension(MylarTasksPlugin.EXTERNALIZER_CLASS_ID);
- if (externalizer instanceof ITaskListExternalizer) {
- externalizers.add((ITaskListExternalizer) externalizer);
- } else {
- MylarPlugin.log("Could not load externalizer: " + externalizer.getClass().getCanonicalName() + " must implement " + ITaskListExternalizer.class.getCanonicalName(), this);
- }
-
- Object contributor = elements[j].createExecutableExtension(MylarTasksPlugin.ACTION_CONTRIBUTER_CLASS_ID);
- if (contributor instanceof ITaskListListener) {
- MylarTasksPlugin.getDefault().addContributor((ITaskListListener) contributor);
-
- }else {
- MylarPlugin.log("Could not load contributor: " + contributor.getClass().getCanonicalName() + " must implement " + ITaskListListener.class.getCanonicalName(), this);
- }
- } catch (CoreException e){
- MylarPlugin.log(e, "Could not load extensions");
- }
- }
- }
- defaultExternalizer.setExternalizers(externalizers);
- externalizersInitialized = true;
- }
+ TaskListExtensionReader.initExtensions(externalizers, defaultExternalizer);
}
// public void addExternalizer(ITaskListExternalizer externalizer) {
@@ -280,9 +241,9 @@ public class TaskListExternalizer {
if (externalizer.canReadTask(child)) {
// TODO add the tasks properly
ITask newTask = externalizer.readTask(child, tlist, null, null);
- ITaskListListener contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
- if(contributor != null){
- newTask = contributor.taskAdded(newTask);
+ ITaskHandler taskHandler = MylarTasksPlugin.getDefault().getTaskHandlerForElement(newTask);
+ if(taskHandler != null){
+ newTask = taskHandler.taskAdded(newTask);
}
tlist.addRootTask(newTask);
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 3e9fa5bc5..46fed4d76 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
@@ -47,8 +47,8 @@ public class DeleteAction extends Action {
Object selectedObject = ((IStructuredSelection) this.view.getViewer()
.getSelection()).getFirstElement();
if(selectedObject instanceof ITaskListElement &&
- MylarTasksPlugin.getDefault().getContributorForElement((ITaskListElement)selectedObject) != null){
- MylarTasksPlugin.getDefault().getContributorForElement((ITaskListElement) selectedObject).itemDeleted((ITaskListElement)selectedObject);
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject) != null){
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITaskListElement) selectedObject).itemDeleted((ITaskListElement)selectedObject);
}else if (selectedObject instanceof ITask) {
ITask task = (ITask) selectedObject;
if (task.isActive()) {
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 8b79352c8..a05fd9574 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
@@ -40,8 +40,8 @@ public class MarkTaskCompleteAction extends Action {
// MylarPlugin.getDefault().actionObserved(this);
Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
if(selectedObject instanceof ITask &&
- MylarTasksPlugin.getDefault().getContributorForElement((ITask)selectedObject) != null) {
- MylarTasksPlugin.getDefault().getContributorForElement((ITask)selectedObject).taskCompleted((ITask)selectedObject);
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITask)selectedObject) != null) {
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITask)selectedObject).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 1b5fcb931..b4bae089c 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
@@ -14,7 +14,7 @@ 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.ITaskListListener;
+import org.eclipse.mylar.tasks.ITaskHandler;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
@@ -43,9 +43,9 @@ public class OpenTaskEditorAction extends Action {
Object obj = ((IStructuredSelection)selection).getFirstElement();
if (obj instanceof ITaskListElement) {
ITaskListElement element = (ITaskListElement)obj;
- ITaskListListener contributor = MylarTasksPlugin.getDefault().getContributorForElement(element);
- if(contributor != null){
- contributor.itemOpened(element);
+ ITaskHandler taskHandler = MylarTasksPlugin.getDefault().getTaskHandlerForElement(element);
+ if(taskHandler != null){
+ taskHandler.itemOpened(element);
} else{
if(element instanceof Task){
((Task)element).openTaskInEditor();
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 9cf9fa1e0..45720adf5 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
@@ -49,7 +49,8 @@ import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.dt.MylarWebRef;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListListener;
+import org.eclipse.mylar.tasks.ITaskHandler;
+import org.eclipse.mylar.tasks.ITaskListDynamicSubMenuContributor;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
@@ -791,10 +792,10 @@ public class TaskListView extends ViewPart {
viewer.refresh();
return true;
} else if(selectedObject instanceof ITaskListElement &&
- MylarTasksPlugin.getDefault().getContributorForElement((ITaskListElement)selectedObject) != null &&
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject) != null &&
getCurrentTarget() instanceof TaskCategory){
- MylarTasksPlugin.getDefault().getContributorForElement((ITaskListElement)selectedObject).dropItem((ITaskListElement)selectedObject, (TaskCategory)getCurrentTarget());
+ MylarTasksPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject).dropItem((ITaskListElement)selectedObject, (TaskCategory)getCurrentTarget());
viewer.setSelection(null);
viewer.refresh();
return true;
@@ -863,7 +864,7 @@ public class TaskListView extends ViewPart {
final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
if (selectedObject instanceof ITaskListElement) {
- for (ITaskListListener contributor : MylarTasksPlugin.getDefault().getContributors()) {
+ for (ITaskListDynamicSubMenuContributor contributor : MylarTasksPlugin.getDefault().getDynamicMenuContributers()) {
manager.add(new Separator());
MenuManager subMenuManager = contributor.getSubMenuManager(this, (ITaskListElement)selectedObject);
if (subMenuManager != null) manager.add(subMenuManager);
@@ -972,9 +973,9 @@ public class TaskListView extends ViewPart {
}
public void closeTaskEditors(ITask task, IWorkbenchPage page) throws LoginException, IOException{
- ITaskListListener contributor = MylarTasksPlugin.getDefault().getContributorForElement(task);
- if(contributor != null){
- contributor.taskClosed(task, page);
+ ITaskHandler taskHandler = MylarTasksPlugin.getDefault().getTaskHandlerForElement(task);
+ if(taskHandler != null){
+ taskHandler.taskClosed(task, page);
} else if (task instanceof Task) {
IEditorInput input = new TaskEditorInput((Task) task);

Back to the top