Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.tasks.ui/build.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java42
3 files changed, 41 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index abdf75acf..9c3f2741d 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -32,7 +32,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.mylyn.monitor.core;bundle-version="3.8.0",
org.eclipse.mylyn.monitor.ui;bundle-version="3.8.0",
org.eclipse.mylyn.tasks.core;bundle-version="3.8.0",
- com.google.guava;bundle-version="15.0.0"
+ com.google.guava;bundle-version="15.0.0",
+ org.eclipse.jdt.annotation;bundle-version="[1.0.0,2.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
Export-Package: org.eclipse.mylyn.internal.tasks.ui;x-internal:=true,
diff --git a/org.eclipse.mylyn.tasks.ui/build.properties b/org.eclipse.mylyn.tasks.ui/build.properties
index 0cc50f7b3..5957a47b3 100644
--- a/org.eclipse.mylyn.tasks.ui/build.properties
+++ b/org.eclipse.mylyn.tasks.ui/build.properties
@@ -16,5 +16,4 @@ src.includes = about.html,\
schema/
source.. = src/
-additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.ui.navigator,platform:/plugin/org.eclipse.mylyn.discovery.ui,platform:/plugin/org.eclipse.jdt.annotation
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java
index 547427c8e..1f0bad864 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java
@@ -11,11 +11,15 @@
package org.eclipse.mylyn.internal.tasks.ui;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
import java.util.Set;
+import org.apache.commons.lang.reflect.MethodUtils;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.ui.SelectionProviderAdapter;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
@@ -40,6 +44,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.internal.ObjectActionContributorManager;
@@ -229,10 +234,11 @@ public class TaskTrimWidget extends WorkbenchWindowControlContribution {
menuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
actionGroup.fillContextMenu(manager);
- // trims do not have a workbench part so there is no simple way of registering the
+ // trims do not have a workbench part so there is no simple way of registering the
// context menu
- ObjectActionContributorManager.getManager().contributeObjectActions(null, manager,
- activeTaskSelectionProvider);
+ if (!contributeObjectActionsOld(manager)) {
+ contributeObjectActionsNew(manager);
+ }
}
});
}
@@ -260,6 +266,36 @@ public class TaskTrimWidget extends WorkbenchWindowControlContribution {
activeTaskSelectionProvider.setSelection(StructuredSelection.EMPTY);
}
+ private boolean contributeObjectActionsOld(IMenuManager manager) {
+ try {
+ MethodUtils.invokeExactMethod(ObjectActionContributorManager.getManager(), "contributeObjectActions", //$NON-NLS-1$
+ new Object[] { null, manager, activeTaskSelectionProvider }, new Class[] { IWorkbenchPart.class,
+ IMenuManager.class, ISelectionProvider.class });
+ } catch (NoSuchMethodException e) {
+ return false;
+ } catch (IllegalAccessException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean contributeObjectActionsNew(IMenuManager manager) {
+ try {
+ MethodUtils.invokeExactMethod(ObjectActionContributorManager.getManager(), "contributeObjectActions", //$NON-NLS-1$
+ new Object[] { null, manager, activeTaskSelectionProvider, Collections.EMPTY_SET }, new Class[] {
+ IWorkbenchPart.class, IMenuManager.class, ISelectionProvider.class, Set.class });
+ } catch (NoSuchMethodException e) {
+ return false;
+ } catch (IllegalAccessException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ return false;
+ }
+ return true;
+ }
+
// // From PerspectiveBarContributionItem
// private String shortenText(String taskLabel) {
// if (taskLabel == null || composite == null || composite.isDisposed()) {

Back to the top