Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-07-14 13:46:53 -0400
committermkersten2005-07-14 13:46:53 -0400
commit3b17263b60250a970b45c9bbac341b7439694361 (patch)
treecf1d4d01a63cdee24887dc344ca2b9065ec476aa /org.eclipse.mylyn.tasks.ui
parente53a5e90b86d7ce2cafab95f01a065ccd4bd10eb (diff)
downloadorg.eclipse.mylyn.tasks-3b17263b60250a970b45c9bbac341b7439694361.tar.gz
org.eclipse.mylyn.tasks-3b17263b60250a970b45c9bbac341b7439694361.tar.xz
org.eclipse.mylyn.tasks-3b17263b60250a970b45c9bbac341b7439694361.zip
Fix for Bugzilla Bug 103748
make highlighters work with de-coupled task list
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java50
3 files changed, 36 insertions, 44 deletions
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 44a5f3c62..1bdd833c4 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,6 +14,7 @@ package org.eclipse.mylar.tasks;
import java.util.List;
import org.eclipse.jface.action.IAction;
+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;
@@ -27,7 +28,9 @@ public interface ITaskListActionContributor {
public abstract List<IAction> getToolbarActions(TaskListView view);
- public abstract List<IAction> getPopupActions(TaskListView view);
+ public abstract List<IAction> getPopupActions(TaskListView view, ITaskListElement selection);
+
+ public abstract MenuManager getSubMenuManager(TaskListView view, ITaskListElement selection);
public abstract void taskActivated(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 f7130d6dc..8a9963108 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
@@ -11,6 +11,7 @@
package org.eclipse.mylar.tasks;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -37,7 +38,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
private static MylarTasksPlugin plugin;
private static TaskListManager taskListManager;
private TaskListExternalizer externalizer;
- private ITaskListActionContributor contributor; // TODO: use extension points
+ private List<ITaskListActionContributor> contributors = new ArrayList<ITaskListActionContributor>(); // TODO: use extension points
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";
@@ -52,6 +53,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
public static final String FILTER_INCOMPLETE_MODE = "org.eclipse.mylar.tasks.filter.incomplete";
private ResourceBundle resourceBundle;
+ private ITaskListActionContributor primaryContributor;
public enum Report_Open_Mode {
EDITOR,
@@ -289,14 +291,21 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
return externalizer;
}
- public ITaskListActionContributor getContributor() {
- return contributor;
+ public List<ITaskListActionContributor> getContributors() {
+ return contributors;
}
- public void setContributor(ITaskListActionContributor contributor) {
- this.contributor = contributor;
- if (TaskListView.getDefault() != null) {
- TaskListView.getDefault().resetToolbarsAndPopups();
- }
+ public ITaskListActionContributor getContributor() {
+ return primaryContributor;
+ }
+
+ public void addPrimaryContributor(ITaskListActionContributor contributor) {
+ this.primaryContributor = contributor;
+ addContributor(contributor);
+ }
+
+ public void addContributor(ITaskListActionContributor contributor) {
+ contributors.add(contributor);
+ if (TaskListView.getDefault() != null) TaskListView.getDefault().resetToolbarsAndPopups();
}
}
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 7c47a26ad..17728290a 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
@@ -52,6 +52,7 @@ 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.ITaskListActionContributor;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
@@ -856,43 +857,22 @@ public class TaskListView extends ViewPart {
manager.add(new Separator());
manager.add(createTask);
// manager.add(new Separator());
- if (MylarTasksPlugin.getDefault().getContributor() != null) {
- for (IAction action : MylarTasksPlugin.getDefault().getContributor().getPopupActions(this)) {
- manager.add(action);
+
+ final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
+ if (selectedObject instanceof ITaskListElement) {
+ for (ITaskListActionContributor contributor : MylarTasksPlugin.getDefault().getContributors()) {
+ for (IAction action : contributor.getPopupActions(this, null)) {
+ manager.add(action);
+ }
+ }
+
+ for (ITaskListActionContributor contributor : MylarTasksPlugin.getDefault().getContributors()) {
+ manager.add(new Separator());
+ MenuManager subMenuManager = contributor.getSubMenuManager(this, (ITaskListElement)selectedObject);
+ if (subMenuManager != null) manager.add(subMenuManager);
}
+ manager.add(clearSelectedTaskscapeAction);
}
- manager.add(new Separator());
- manager.add(clearSelectedTaskscapeAction);
- MenuManager subMenuManager = new MenuManager("Choose Highlighter");
- final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
-
- // XXX refactored highlighters
-// 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);
}

Back to the top