From 572047efc509fffef7b1cdc3def9e1483e3a641a Mon Sep 17 00:00:00 2001 From: Frank Becker Date: Sun, 4 May 2014 18:24:17 +0200 Subject: 434057: Support for Luna M7 Change-Id: I69eb7a7ceb0b8d37cbb0c38697f59deb074c1e4d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434057 --- org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF | 3 +- org.eclipse.mylyn.tasks.core/build.properties | 1 - org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF | 3 +- org.eclipse.mylyn.tasks.ui/build.properties | 1 - .../mylyn/internal/tasks/ui/TaskTrimWidget.java | 42 ++++++++++++++++++++-- 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF index 3d1bc79d6..d7c3abc87 100644 --- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.mylyn.commons.net;bundle-version="3.8.0", org.eclipse.mylyn.commons.repositories.core;bundle-version="1.0.0", com.google.guava;bundle-version="15.0.0", - org.apache.xerces;bundle-version="2.9.0";resolution:=optional + org.apache.xerces;bundle-version="2.9.0";resolution:=optional, + org.eclipse.jdt.annotation;bundle-version="[1.0.0,2.0.0)" Export-Package: org.eclipse.mylyn.internal.tasks.core;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs", org.eclipse.mylyn.internal.tasks.core.activity;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs", org.eclipse.mylyn.internal.tasks.core.context;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs", diff --git a/org.eclipse.mylyn.tasks.core/build.properties b/org.eclipse.mylyn.tasks.core/build.properties index bfd49132b..53225309c 100644 --- a/org.eclipse.mylyn.tasks.core/build.properties +++ b/org.eclipse.mylyn.tasks.core/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.jdt.annotation 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()) { -- cgit v1.2.3