Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-07-12 21:22:18 -0400
committermkersten2005-07-12 21:22:18 -0400
commitbe1e5de715cb7f403726dd3d9db59f5a0c8c6dcc (patch)
treef36fd3fdd8eae006892adaf03e48ba1f9c4ec0b3 /org.eclipse.mylyn.tasks.ui
parent23c8cbf0c6d069ce144d0844eb6071420662b796 (diff)
downloadorg.eclipse.mylyn.tasks-be1e5de715cb7f403726dd3d9db59f5a0c8c6dcc.tar.gz
org.eclipse.mylyn.tasks-be1e5de715cb7f403726dd3d9db59f5a0c8c6dcc.tar.xz
org.eclipse.mylyn.tasks-be1e5de715cb7f403726dd3d9db59f5a0c8c6dcc.zip
Progress on Bugzilla Bug 103099
decouple tasks from mylar.ui
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gifbin0 -> 544 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gifbin349 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gifbin332 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gifbin359 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gifbin362 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gifbin340 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java7
14 files changed, 104 insertions, 33 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gif b/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gif
new file mode 100644
index 000000000..2abc46b38
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif
deleted file mode 100644
index 09fcacad3..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query-new.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif
deleted file mode 100644
index 94e7d5d1c..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/category-query.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif
deleted file mode 100644
index 04f3028c2..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-new.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif
deleted file mode 100644
index bb8538b39..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug-refresh.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif
deleted file mode 100644
index f2d2f3762..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-bug.gif
+++ /dev/null
Binary files differ
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
new file mode 100644
index 000000000..d921dad33
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 University Of British Columbia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasks;
+
+import java.util.List;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
+
+/**
+ * @author Mik Kersten
+ *
+ * TODO: this should use extension points
+ */
+public interface ITaskListActionContributor {
+
+ public abstract List<IAction> getToolbarActions(TaskListView view);
+
+ public abstract List<IAction> getPopupActions(TaskListView view);
+}
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 a51dae414..e74def544 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,12 +19,12 @@ 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.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;
import org.eclipse.swt.graphics.Font;
-import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;
@@ -39,6 +39,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
private static MylarTasksPlugin plugin;
private static TaskListManager taskListManager;
private TaskListExternalizer externalizer;
+ private ITaskListActionContributor contributor; // TODO: use extension points
// TODO: remove hard-coded fonts
public static final Font BOLD = new Font(null, "Tahoma", 8, SWT.BOLD);
@@ -311,4 +312,20 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
public TaskListExternalizer getTaskListExternalizer() {
return externalizer;
}
+
+ public void addActionContributor() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public ITaskListActionContributor getContributor() {
+ return contributor;
+ }
+
+ public void setContributor(ITaskListActionContributor contributor) {
+ this.contributor = contributor;
+ if (TaskListView.getDefault() != null) {
+ TaskListView.getDefault().resetToolbarsAndPopups();
+ }
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
index 604d9050c..18f66cf40 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskList.java
@@ -178,4 +178,10 @@ public class TaskList implements Serializable {
}
return cats;
}
+
+ public void clear() {
+ activeTasks.clear();
+ categories.clear();
+ rootTasks.clear();
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java
index 2f91b0bcc..e7ac344bf 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskListImages.java
@@ -39,21 +39,16 @@ public class TaskListImages {
public static final ImageDescriptor FILTER_PRIORITY = create(T_ELCL, "filter-priority.gif");
public static final ImageDescriptor COLOR_PALETTE = create(T_ELCL, "color-palette.gif");
- public static final ImageDescriptor BUG = create(T_ELCL, "bug.gif");
- public static final ImageDescriptor TASK_BUGZILLA = create(T_TOOL, "task-bug.gif");
- public static final ImageDescriptor TASK_BUGZILLA_NEW = create(T_TOOL, "task-bug-new.gif");
public static final ImageDescriptor TASK = create(T_TOOL, "task.gif");
public static final ImageDescriptor TASK_NEW = create(T_TOOL, "task-new.gif");
public static final ImageDescriptor CATEGORY = create(T_TOOL, "category.gif");
public static final ImageDescriptor CATEGORY_NEW = create(T_TOOL, "category-new.gif");
- public static final ImageDescriptor CATEGORY_QUERY = create(T_TOOL, "category-query.gif");
- public static final ImageDescriptor CATEGORY_QUERY_NEW = create(T_TOOL, "category-query-new.gif");
+
public static final ImageDescriptor TASK_ACTIVE = create(T_TOOL, "task-active.gif");
public static final ImageDescriptor TASK_INACTIVE = create(T_TOOL, "task-inactive.gif");
public static final ImageDescriptor TASK_COMPLETE = create(T_TOOL, "task-complete.gif");
public static final ImageDescriptor TASK_INCOMPLETE = create(T_TOOL, "task-incomplete.gif");
- public static final ImageDescriptor TASK_BUG_REFRESH = create(T_TOOL, "task-bug-refresh.gif");
private static ImageDescriptor create(String prefix, String name) {
try {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
index a01d1c907..b73564396 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ToggleIntersectionModeAction.java
@@ -15,7 +15,6 @@ package org.eclipse.mylar.tasks.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.tasks.TaskListImages;
/**
* @author Mik Kersten
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 49e6d1627..456efb533 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
@@ -53,10 +53,10 @@ import org.eclipse.mylar.dt.MylarWebRef;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.ITask;
import org.eclipse.mylar.tasks.ITaskListElement;
-import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
import org.eclipse.mylar.tasks.TaskCategory;
+import org.eclipse.mylar.tasks.TaskListImages;
import org.eclipse.mylar.tasks.ui.TaskEditorInput;
import org.eclipse.mylar.tasks.ui.actions.ClearContextAction;
import org.eclipse.mylar.tasks.ui.actions.CreateCategoryAction;
@@ -96,9 +96,11 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;
@@ -109,8 +111,6 @@ import org.eclipse.ui.part.ViewPart;
public class TaskListView extends ViewPart {
private static TaskListView INSTANCE;
-
- private List<IAction> contributedActions = new ArrayList<IAction>();
TreeViewer viewer;
private DrillDownAdapter drillDownAdapter;
@@ -939,15 +939,17 @@ public class TaskListView extends ViewPart {
void fillContextMenu(IMenuManager manager) {
manager.add(completeTask);
manager.add(incompleteTask);
-// manager.add(new Separator());
- manager.add(createTask);
-// manager.add(createBugzillaTask);
-// manager.add(rename);
manager.add(delete);
- manager.add(clearSelectedTaskscapeAction);
-// manager.add(moveTaskToRoot);
-// manager.add(refreshQuery);
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);
+ }
+ }
+ manager.add(new Separator());
+ manager.add(clearSelectedTaskscapeAction);
MenuManager subMenuManager = new MenuManager("Choose Highlighter");
final Object selectedObject = ((IStructuredSelection)viewer.getSelection()).getFirstElement();
@@ -982,10 +984,9 @@ public class TaskListView extends ViewPart {
updateActionEnablement(selectedObject);
}
- private void updateActionEnablement(Object sel){
- // XXX refactored
- throw new RuntimeException("unimplemented");
+ private void updateActionEnablement(Object sel) {
// 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){
@@ -1039,12 +1040,13 @@ public class TaskListView extends ViewPart {
manager.add(createTask);
manager.add(createCategory);
manager.add(new Separator());
-// manager.add(createBugzillaTask);
-// manager.add(createBugzillaQueryCategory);
-// manager.add(refresh);
-// manager.add(new Separator());
+ if (MylarTasksPlugin.getDefault().getContributor() != null) {
+ for (IAction action : MylarTasksPlugin.getDefault().getContributor().getToolbarActions(this)) {
+ manager.add(action);
+ }
+ }
+ manager.add(new Separator());
manager.add(filterCompleteTask);
-// manager.add(filterInCompleteTask);
manager.add(filterOnPriority);
}
@@ -1279,7 +1281,24 @@ public class TaskListView extends ViewPart {
super.configureShell(shell);
shell.setText("Enter Task Name");
}
- };
+ }
+
+ public void resetToolbarsAndPopups() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ getViewSite().getActionBars().getToolBarManager().removeAll();
+ getViewSite().getActionBars().getMenuManager().removeAll();
+ fillLocalToolBar(getViewSite().getActionBars().getToolBarManager());
+ fillContextMenu(getViewSite().getActionBars().getMenuManager());
+ IActionBars bars = getViewSite().getActionBars();
+ bars.updateActionBars();
+ getViewSite().getActionBars().getMenuManager().update(true);
+ getViewSite().getActionBars().getToolBarManager().update(true);
+ viewer.refresh();
+ }
+ });
+ }
}
//TextTransfer textTransfer = TextTransfer.getInstance();
@@ -1287,7 +1306,7 @@ public class TaskListView extends ViewPart {
//target.setTransfer(new Transfer[] { textTransfer });
//target.addDropListener(new TaskListDropTargetListener(parent, null, textTransfer, true));
//
-//DragSource source = new DragSource(viewer.getTree(), DND.DROP_MOVE);
+//DragSource source = new DragSouarce(viewer.getTree(), DND.DROP_MOVE);
//source.setTransfer(types);
//source.addDragListener(new DragSourceListener() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/DefaultTaskListExternalizer.java
index 9170dcace..10b4a4702 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/util/DefaultTaskListExternalizer.java
@@ -63,9 +63,13 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
Element node = doc.createElement(getCategoryTagName());
node.setAttribute(NAME, category.getDescription(false));
- for (ITask t : ((TaskCategory)category).getChildren()) {
+ for (ITask task : ((TaskCategory)category).getChildren()) {
try {
- createTaskElement(t, doc, node);
+ Element element = null;
+ for (ITaskListExternalizer externalizer : externalizers) {
+ if (externalizer.canCreateElementFor(task)) element = externalizer.createTaskElement(task, doc, node);
+ }
+ if (element == null) createTaskElement(task, doc, node);
} catch (Exception e) {
MylarPlugin.log(e, e.getMessage());
}
@@ -138,6 +142,7 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
}
public boolean canReadTask(Node node) {
+ System.err.println("> " + node.getNodeName() + ", " + externalizers);
return node.getNodeName().equals(getTaskTagName());
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/TaskListExternalizer.java
index 78de68836..ef6d2314d 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/util/TaskListExternalizer.java
@@ -48,14 +48,15 @@ import org.xml.sax.SAXException;
public class TaskListExternalizer {
private List<ITaskListExternalizer> externalizers = new ArrayList<ITaskListExternalizer>();
- private ITaskListExternalizer defaultExternalizer = new DefaultTaskListExternalizer();
+ private DefaultTaskListExternalizer defaultExternalizer = new DefaultTaskListExternalizer();
private String readVersion = "";
public void addExternalizer(ITaskListExternalizer externalizer) {
externalizers.add(externalizer);
-// System.err.println(">>>>>>>>> " + MylarTasksPlugin.getTaskListManager().getTaskListFile());
-// readTaskList(MylarTasksPlugin.getTaskListManager().getTaskList(), MylarTasksPlugin.getTaskListManager().getTaskListFile());
+ defaultExternalizer.setExternalizers(externalizers);
+ MylarTasksPlugin.getTaskListManager().getTaskList().clear();
+ readTaskList(MylarTasksPlugin.getTaskListManager().getTaskList(), MylarTasksPlugin.getTaskListManager().getTaskListFile());
}
public void removeExternalizer(ITaskListExternalizer externalizer) {

Back to the top