Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-07-19 22:33:53 +0000
committersminto2005-07-19 22:33:53 +0000
commit40a2f3c097a428c2e7bf80c35f83d2e2a58e8463 (patch)
tree6ac43baa33313cc01e6b6d5443ee572dd67eb1d7
parent761cff8f7a12c8fd957c982ef2d48b799f1a7d30 (diff)
downloadorg.eclipse.mylyn.tasks-40a2f3c097a428c2e7bf80c35f83d2e2a58e8463.tar.gz
org.eclipse.mylyn.tasks-40a2f3c097a428c2e7bf80c35f83d2e2a58e8463.tar.xz
org.eclipse.mylyn.tasks-40a2f3c097a428c2e7bf80c35f83d2e2a58e8463.zip
fixed Bug #103588: use extension points in place of ITaskListActionContributor
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml88
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaQueryCategoryAction.java26
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaTaskAction.java38
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java36
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaAction.java35
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaReportsAction.java35
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditor.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/NewBugEditor.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskContributor.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskListActionContributor.java)28
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskExternalizer.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gifbin544 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskContributor.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ITaskListActionContributor.java)11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/internal/TaskListExternalizer.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/OpenTaskEditorAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java26
16 files changed, 239 insertions, 118 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index acc357443..98bfef616 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -105,15 +105,99 @@
searchResultClass="org.eclipse.mylar.bugzilla.core.search.BugzillaSearchResult"
id="org.eclipse.mylar.bugzilla.BugzillaSearchResultPage"/>
</extension>
+
<extension
point="org.eclipse.mylar.tasks.taskListContributor">
<taskListContributor
- actionContributorClass="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTaskListActionContributor"
+ actionContributorClass="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTaskContributor"
externalizerClass="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTaskExternalizer"
id="org.eclipse.mylar.bugzilla.ui.tasklist"
name="Bugzilla Contributer">
</taskListContributor>
</extension>
-
+
+ <extension point="org.eclipse.ui.viewActions">
+ <viewContribution
+ id="org.eclipse.mylar.bugzilla.ui.tasks.actions"
+ targetID="org.eclipse.mylar.tasks.ui.views.TaskListView">
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaReportsAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug-refresh.gif"
+ id="org.eclipse.mylar.bugzilla.tasks.refresh"
+ label="Refresh Non-Resolved Bugzilla reports"
+ style="push"
+ toolbarPath="mylar"
+ tooltip="Refresh Non-Resolved Bugzilla reports">
+ </action>
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaQueryCategoryAction"
+ enablesFor="*"
+ icon="icons/etool16/category-query-new.gif"
+ id="org.eclipse.mylar.bugzilla.tasks.addQuery"
+ label="Add Bugzilla Query"
+ style="push"
+ toolbarPath="mylar"
+ tooltip="Add Bugzilla Query">
+ </action>
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateNewBugzillaTaskAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug-new.gif"
+ id="org.eclipse.mylar.bugzilla.tasks.addNew"
+ label="Create and Add New Bugzilla Report"
+ style="push"
+ toolbarPath="mylar"
+ tooltip="Create and Add New Bugzilla Report">
+ </action>
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaTaskAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug.gif"
+ id="org.eclipse.mylar.bugzilla.tasks.addExisting"
+ label="Add Existing Bugzilla Report"
+ style="push"
+ toolbarPath="mylar"
+ tooltip="Add Existing Bugzilla Report">
+ </action>
+ </viewContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <viewerContribution
+ id="org.eclipse.mylar.bugzilla.ui.viewerContribution1"
+ targetID="org.eclipse.mylar.tasks.ui.views.TaskListView">
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaTaskAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug.gif"
+ id="org.eclipse.mylar.bugzilla.ui.popup.addExisting"
+ label="Add Existing Bugzilla Report"
+ menubarPath="mylar"
+ tooltip="Add Existing Bugzilla Report">
+ <enablement>
+ <objectClass name="org.eclipse.mylar.tasks.internal.TaskCategory"/>
+ </enablement>
+ </action>
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug-refresh.gif"
+ id="org.eclipse.mylar.bugzilla.ui.popup.refresh"
+ label="Bugzilla Refresh"
+ menubarPath="mylar"
+ tooltip="Bugzilla Refresh">
+ <enablement>
+ <or>
+ <objectClass name="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTask"/>
+ <objectClass name="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaQueryCategory"/>
+ <objectClass name="org.eclipse.mylar.bugzilla.ui.tasks.BugzillaHit"/>
+ </or>
+ </enablement>
+ </action>
+ </viewerContribution>
+
+ </extension>
</plugin>
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaQueryCategoryAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaQueryCategoryAction.java
index ed0249cca..76cc7c022 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaQueryCategoryAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaQueryCategoryAction.java
@@ -14,7 +14,9 @@ package org.eclipse.mylar.bugzilla.ui.actions;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylar.bugzilla.ui.BugzillaImages;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaQueryCategory;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaQueryDialog;
@@ -22,6 +24,8 @@ import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.progress.IProgressService;
@@ -29,14 +33,11 @@ import org.eclipse.ui.progress.IProgressService;
/**
* @author Mik Kersten and Ken Sueda
*/
-public class CreateBugzillaQueryCategoryAction extends Action {
+public class CreateBugzillaQueryCategoryAction extends Action implements IViewActionDelegate {
public static final String ID = "org.eclipse.mylar.tasks.actions.create.bug.query";
- private final TaskListView view;
-
- public CreateBugzillaQueryCategoryAction(TaskListView view) {
- this.view = view;
+ public CreateBugzillaQueryCategoryAction() {
setText("Add Bugzilla Query");
setToolTipText("Add Bugzilla Query");
setId(ID);
@@ -65,7 +66,20 @@ public class CreateBugzillaQueryCategoryAction extends Action {
} catch (Exception e) {
MylarPlugin.log(e, "There was a problem executing the query refresh");
}
- this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
}
}
+
+ public void init(IViewPart view) {
+
+ }
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaTaskAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaTaskAction.java
index d7b730bea..71702a622 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaTaskAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateBugzillaTaskAction.java
@@ -12,29 +12,30 @@
package org.eclipse.mylar.bugzilla.ui.actions;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.bugzilla.ui.BugzillaImages;
import org.eclipse.mylar.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
/**
* @author Mik Kersten and Ken Sueda
*/
-public class CreateBugzillaTaskAction extends Action {
+public class CreateBugzillaTaskAction extends Action implements IViewActionDelegate{
private static final String LABEL = "Add Existing Bugzilla Report";
public static final String ID = "org.eclipse.mylar.tasks.actions.create.bug";
- private final TaskListView view;
-
- public CreateBugzillaTaskAction(TaskListView view) {
- this.view = view;
+ public CreateBugzillaTaskAction() {
setText(LABEL);
setToolTipText(LABEL);
setId(ID);
@@ -44,7 +45,10 @@ public class CreateBugzillaTaskAction extends Action {
@Override
public void run() {
// MylarPlugin.getDefault().actionObserved(this);
- String bugIdString = this.view.getBugIdFromUser();
+ if(TaskListView.getDefault() == null)
+ return;
+
+ String bugIdString = TaskListView.getDefault().getBugIdFromUser();
int bugId = -1;
try {
if (bugIdString != null) {
@@ -53,7 +57,7 @@ public class CreateBugzillaTaskAction extends Action {
return;
}
} catch (NumberFormatException nfe) {
- this.view.showMessage("Please enter a valid report number");
+ TaskListView.getDefault().showMessage("Please enter a valid report number");
return;
}
@@ -69,9 +73,9 @@ public class CreateBugzillaTaskAction extends Action {
// }
ITask newTask = new BugzillaTask("Bugzilla-"+bugId, "<bugzilla info>", true);
- Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
+ Object selectedObject = ((IStructuredSelection)TaskListView.getDefault().getViewer().getSelection()).getFirstElement();
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
if(contributor != null){
ITask addedTask = contributor.taskAdded(newTask);
if(addedTask instanceof BugzillaTask){
@@ -104,6 +108,18 @@ public class CreateBugzillaTaskAction extends Action {
// } else {
// MylarTasksPlugin.getTaskListManager().getTaskList().addRootTask((ITask)bugTask);
// }
- this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
+ }
+
+ public void init(IViewPart view) {
+ }
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
index eea6a9e1f..c5250bea8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
@@ -12,7 +12,9 @@
package org.eclipse.mylar.bugzilla.ui.actions;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylar.bugzilla.ui.BugzillaImages;
@@ -20,24 +22,23 @@ import org.eclipse.mylar.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTask;
import org.eclipse.mylar.bugzilla.ui.wizard.NewBugWizard;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten and Ken Sueda
*/
-public class CreateNewBugzillaTaskAction extends Action {
+public class CreateNewBugzillaTaskAction extends Action implements IViewActionDelegate{
public static final String ID = "org.eclipse.mylar.tasks.actions.create.bug";
- private final TaskListView view;
-
- public CreateNewBugzillaTaskAction(TaskListView view) {
- this.view = view;
+ public CreateNewBugzillaTaskAction() {
setText("Create and Add Bugzilla Report");
setToolTipText("Create and Add Bugzilla Report");
setId(ID);
@@ -75,11 +76,13 @@ public class CreateNewBugzillaTaskAction extends Action {
return;
}
-
+
ITask newTask = new BugzillaTask("Bugzilla-"+bugId, "<bugzilla info>", true);
- Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement();
+ Object selectedObject = null;
+ if(TaskListView.getDefault() != null)
+ selectedObject = ((IStructuredSelection)TaskListView.getDefault().getViewer().getSelection()).getFirstElement();
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
if(contributor != null){
ITask addedTask = contributor.taskAdded(newTask);
if(addedTask instanceof BugzillaTask){
@@ -100,9 +103,22 @@ public class CreateNewBugzillaTaskAction extends Action {
}
BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry((BugzillaTask)newTask);
- this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
} else {
// TODO handle not good
}
}
+
+ public void init(IViewPart view) {
+
+ }
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaAction.java
index 180afd7cf..1a8ea1524 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaAction.java
@@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -29,6 +30,8 @@ import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.progress.IProgressService;
@@ -36,25 +39,21 @@ import org.eclipse.ui.progress.IProgressService;
/**
* @author Ken Sueda
*/
-public class RefreshBugzillaAction extends Action {
+public class RefreshBugzillaAction extends Action implements IViewActionDelegate{
public static final String ID = "org.eclipse.mylar.tasks.actions.refresh.bugzilla";
- private final TaskListView view;
-
private BugzillaQueryCategory cat = null;
- public RefreshBugzillaAction(TaskListView view) {
- this.view = view;
+ public RefreshBugzillaAction() {
setText("Bugzilla Refresh");
setToolTipText("Bugzilla Refresh");
setId(ID);
setImageDescriptor(BugzillaImages.TASK_BUG_REFRESH);
}
- public RefreshBugzillaAction(TaskListView view, BugzillaQueryCategory cat) {
+ public RefreshBugzillaAction(BugzillaQueryCategory cat) {
assert(cat != null);
- this.view = view;
this.cat = cat;
setText("Bugzilla Refresh");
setToolTipText("Bugzilla Refresh");
@@ -65,8 +64,8 @@ public class RefreshBugzillaAction extends Action {
@Override
public void run() {
Object obj = cat;
- if(cat == null){
- ISelection selection = this.view.getViewer().getSelection();
+ if(cat == null && TaskListView.getDefault() != null){
+ ISelection selection = TaskListView.getDefault().getViewer().getSelection();
obj = ((IStructuredSelection) selection).getFirstElement();
}
if (obj instanceof BugzillaQueryCategory) {
@@ -81,7 +80,8 @@ public class RefreshBugzillaAction extends Action {
((BugzillaTask)hit.getOrCreateCorrespondingTask()).refresh();
}
}
- RefreshBugzillaAction.this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
}
});
}
@@ -123,6 +123,19 @@ public class RefreshBugzillaAction extends Action {
}
}
}
- view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
+ }
+
+ public void init(IViewPart view) {
+
+ }
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaReportsAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaReportsAction.java
index 7592d47ac..f68d1cf08 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaReportsAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/actions/RefreshBugzillaReportsAction.java
@@ -17,7 +17,9 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylar.bugzilla.ui.BugzillaImages;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaHit;
import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaQueryCategory;
@@ -28,6 +30,8 @@ import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.TaskCategory;
import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.progress.IProgressService;
@@ -35,16 +39,13 @@ import org.eclipse.ui.progress.IProgressService;
/**
* @author Mik Kersten and Ken Sueda
*/
-public class RefreshBugzillaReportsAction extends Action {
+public class RefreshBugzillaReportsAction extends Action implements IViewActionDelegate{
public static final String ID = "org.eclipse.mylar.tasks.actions.refresh.bugdb";
- private final TaskListView view;
-
private boolean showProgress = true;
- public RefreshBugzillaReportsAction(TaskListView view) {
- this.view = view;
+ public RefreshBugzillaReportsAction() {
setText("Refresh Non-Resolved Bugzilla reports");
setToolTipText("Refresh Non-Resolved Bugzilla reports");
setId(ID);
@@ -80,7 +81,8 @@ public class RefreshBugzillaReportsAction extends Action {
}
}
}
- view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
}
private void runWithProgressBar() {
@@ -114,7 +116,8 @@ public class RefreshBugzillaReportsAction extends Action {
// monitor.worked(1);
// }
// monitor.done();
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
}
};
@@ -167,11 +170,25 @@ public class RefreshBugzillaReportsAction extends Action {
}
}
}
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
}
});
}
}
- RefreshBugzillaReportsAction.this.view.getViewer().refresh();
+ if(TaskListView.getDefault() != null)
+ TaskListView.getDefault().getViewer().refresh();
+ }
+
+ public void init(IViewPart view) {
+
+ }
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ System.out.println("sel changed");
}
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditor.java
index b1eff6f8a..22e63b65a 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditor.java
@@ -356,7 +356,7 @@ public class ExistingBugEditor extends AbstractBugEditor
public void run() {
if(TaskListView.getDefault() != null &&
TaskListView.getDefault().getViewer() != null){
- new RefreshBugzillaReportsAction(TaskListView.getDefault()).run();
+ new RefreshBugzillaReportsAction().run();
}
}
});
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/NewBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/NewBugEditor.java
index 2c3076d3b..e174758fc 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/NewBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/NewBugEditor.java
@@ -268,7 +268,7 @@ public class NewBugEditor extends AbstractBugEditor {
public void run() {
if(TaskListView.getDefault() != null &&
TaskListView.getDefault().getViewer() != null){
- new RefreshBugzillaReportsAction(TaskListView.getDefault()).run();
+ new RefreshBugzillaReportsAction().run();
}
}
});
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskListActionContributor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskContributor.java
index 184f65aad..2fd210553 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskListActionContributor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskContributor.java
@@ -14,7 +14,6 @@ package org.eclipse.mylar.bugzilla.ui.tasks;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -23,14 +22,11 @@ import org.eclipse.mylar.bugzilla.ui.BugzillaOpenStructure;
import org.eclipse.mylar.bugzilla.ui.BugzillaUITools;
import org.eclipse.mylar.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.bugzilla.ui.ViewBugzillaAction;
-import org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaQueryCategoryAction;
-import org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaTaskAction;
-import org.eclipse.mylar.bugzilla.ui.actions.CreateNewBugzillaTaskAction;
import org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaAction;
import org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaReportsAction;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.TaskCategory;
@@ -44,23 +40,7 @@ import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten and Ken Sueda
*/
-public class BugzillaTaskListActionContributor implements ITaskListActionContributor {
-
- public List<IAction> getToolbarActions(TaskListView view) {
- List<IAction> actions = new ArrayList<IAction>();
- actions.add(new CreateBugzillaTaskAction(view));
- actions.add(new CreateNewBugzillaTaskAction(view));
- actions.add(new CreateBugzillaQueryCategoryAction(view));
- actions.add(new RefreshBugzillaReportsAction(view));
- return actions;
- }
-
- public List<IAction> getPopupActions(TaskListView view, ITaskListElement selection) {
- List<IAction> actions = new ArrayList<IAction>();
- actions.add(new CreateBugzillaTaskAction(view));
- actions.add(new RefreshBugzillaAction(view));
- return actions;
- }
+public class BugzillaTaskContributor implements ITaskContributor {
public MenuManager getSubMenuManager(TaskListView view, ITaskListElement selection) {
return null;
@@ -143,7 +123,7 @@ public class BugzillaTaskListActionContributor implements ITaskListActionContrib
queryCategory.setDescription(sqd.getName());
queryCategory.setUrl(sqd.getUrl());
- new RefreshBugzillaAction(TaskListView.getDefault(), queryCategory).run();
+ new RefreshBugzillaAction(queryCategory).run();
}
} else if(element instanceof BugzillaHit){
BugzillaHit hit = (BugzillaHit)element;
@@ -217,7 +197,7 @@ public class BugzillaTaskListActionContributor implements ITaskListActionContrib
public void restoreState(TaskListView taskListView) {
if (BugzillaPlugin.getDefault().refreshOnStartUpEnabled()) {
- RefreshBugzillaReportsAction refresh = new RefreshBugzillaReportsAction(taskListView);
+ RefreshBugzillaReportsAction refresh = new RefreshBugzillaReportsAction();
refresh.setShowProgress(false);
refresh.run();
refresh.setShowProgress(true);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskExternalizer.java
index e17402f85..070200e8b 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskExternalizer.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasks/BugzillaTaskExternalizer.java
@@ -18,7 +18,7 @@ import org.eclipse.mylar.bugzilla.ui.tasks.BugzillaTask.BugTaskState;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.AbstractCategory;
import org.eclipse.mylar.tasks.ITask;
-import org.eclipse.mylar.tasks.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.internal.DefaultTaskListExternalizer;
import org.eclipse.mylar.tasks.internal.MylarExternalizerException;
@@ -171,7 +171,7 @@ public class BugzillaTaskExternalizer extends DefaultTaskListExternalizer {
MylarPlugin.log(e, "Failed to read bug report");
}
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(task);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(task);
if(contributor != null){
ITask addedTask = contributor.taskAdded(task);
if(addedTask instanceof BugzillaTask) task = (BugzillaTask)addedTask;
diff --git a/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gif b/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.gif
deleted file mode 100644
index 2abc46b38..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/elcl16/context-clear.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/ITaskContributor.java
index 1bdd833c4..cf2f27a5c 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/ITaskContributor.java
@@ -11,9 +11,6 @@
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;
@@ -24,12 +21,8 @@ import org.eclipse.ui.IWorkbenchPage;
*
* TODO: this should use extension points
*/
-public interface ITaskListActionContributor {
-
- public abstract List<IAction> getToolbarActions(TaskListView view);
+public interface ITaskContributor {
- public abstract List<IAction> getPopupActions(TaskListView view, ITaskListElement selection);
-
public abstract MenuManager getSubMenuManager(TaskListView view, ITaskListElement selection);
public abstract void taskActivated(ITask task);
@@ -42,7 +35,7 @@ public interface ITaskListActionContributor {
public abstract void itemOpened(ITaskListElement element);
- public void taskClosed(ITask element, IWorkbenchPage page);
+ public abstract void taskClosed(ITask element, IWorkbenchPage page);
public abstract boolean acceptsItem(ITaskListElement element);
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 9dd144e45..69e3cd486 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,7 +42,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
private static MylarTasksPlugin plugin;
private static TaskListManager taskListManager;
private TaskListExternalizer externalizer;
- private List<ITaskListActionContributor> contributors = new ArrayList<ITaskListActionContributor>(); // TODO: use extension points
+ private List<ITaskContributor> contributors = new ArrayList<ITaskContributor>(); // TODO: use extension points
public static final String TASK_CONTRIBUTER_ID = "org.eclipse.mylar.tasks.taskListContributor";
public static final String EXTERNALIZER_CLASS_ID = "externalizerClass";
@@ -297,18 +297,18 @@ public class MylarTasksPlugin extends AbstractUIPlugin {
return externalizer;
}
- public List<ITaskListActionContributor> getContributors() {
+ public List<ITaskContributor> getContributors() {
return contributors;
}
- public ITaskListActionContributor getContributorForElement(ITaskListElement element){
- for(ITaskListActionContributor contributer: contributors){
+ public ITaskContributor getContributorForElement(ITaskListElement element){
+ for(ITaskContributor contributer: contributors){
if(contributer.acceptsItem(element)) return contributer;
}
return null;
}
- public void addContributor(ITaskListActionContributor contributor) {
+ public void addContributor(ITaskContributor contributor) {
contributors.add(contributor);
// if (TaskListView.getDefault() != null) TaskListView.getDefault().resetToolbarsAndPopups();
}
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 72dd2ea30..81af05092 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
@@ -41,7 +41,7 @@ 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.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.ITaskListExternalizer;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.w3c.dom.Document;
@@ -82,14 +82,14 @@ public class TaskListExternalizer {
}
Object contributor = elements[j].createExecutableExtension(MylarTasksPlugin.ACTION_CONTRIBUTER_CLASS_ID);
- if (contributor instanceof ITaskListActionContributor) {
- MylarTasksPlugin.getDefault().addContributor((ITaskListActionContributor) contributor);
+ if (contributor instanceof ITaskContributor) {
+ MylarTasksPlugin.getDefault().addContributor((ITaskContributor) contributor);
}else {
- MylarPlugin.log("Could not load contributor: " + contributor.getClass().getCanonicalName() + " must implement " + ITaskListActionContributor.class.getCanonicalName(), this);
+ MylarPlugin.log("Could not load contributor: " + contributor.getClass().getCanonicalName() + " must implement " + ITaskContributor.class.getCanonicalName(), this);
}
} catch (CoreException e){
- MylarPlugin.log(e, "Could not load extension for externalizer");
+ MylarPlugin.log(e, "Could not load extensions");
}
}
}
@@ -280,7 +280,7 @@ public class TaskListExternalizer {
if (externalizer.canReadTask(child)) {
// TODO add the tasks properly
ITask newTask = externalizer.readTask(child, tlist, null, null);
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(newTask);
if(contributor != null){
newTask = contributor.taskAdded(newTask);
}
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 dd56c697f..af95cfb5b 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.ITaskListActionContributor;
+import org.eclipse.mylar.tasks.ITaskContributor;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
@@ -43,7 +43,7 @@ public class OpenTaskEditorAction extends Action {
Object obj = ((IStructuredSelection)selection).getFirstElement();
if (obj instanceof ITaskListElement) {
ITaskListElement element = (ITaskListElement)obj;
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(element);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(element);
if(contributor != null){
contributor.itemOpened(element);
} else{
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 74aa13bea..0b850bc20 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
@@ -20,7 +20,6 @@ import javax.security.auth.login.LoginException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -52,7 +51,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.ITaskContributor;
import org.eclipse.mylar.tasks.ITaskListElement;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
import org.eclipse.mylar.tasks.Task;
@@ -856,17 +855,12 @@ public class TaskListView extends ViewPart {
manager.add(delete);
manager.add(new Separator());
manager.add(createTask);
-// manager.add(new Separator());
+ manager.add(new Separator("mylar"));
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()) {
+
+ for (ITaskContributor contributor : MylarTasksPlugin.getDefault().getContributors()) {
manager.add(new Separator());
MenuManager subMenuManager = contributor.getSubMenuManager(this, (ITaskListElement)selectedObject);
if (subMenuManager != null) manager.add(subMenuManager);
@@ -975,7 +969,7 @@ public class TaskListView extends ViewPart {
}
public void closeTaskEditors(ITask task, IWorkbenchPage page) throws LoginException, IOException{
- ITaskListActionContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(task);
+ ITaskContributor contributor = MylarTasksPlugin.getDefault().getContributorForElement(task);
if(contributor != null){
contributor.taskClosed(task, page);
} else if (task instanceof Task) {
@@ -1151,17 +1145,11 @@ public class TaskListView extends ViewPart {
private void fillLocalToolBar(IToolBarManager manager) {
manager.removeAll();
- // XXX only adding if there are contributions
- List<ITaskListActionContributor> contributors = MylarTasksPlugin.getDefault().getContributors();
manager.add(createTask);
manager.add(createCategory);
+ manager.add(new Separator("mylar"));
+
manager.add(new Separator());
- for(ITaskListActionContributor contributor: contributors){
- for (IAction action : contributor.getToolbarActions(this)) {
- manager.add(action);
- }
- manager.add(new Separator());
- }
manager.add(filterCompleteTask);
manager.add(filterOnPriority);

Back to the top