summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDaniel Rolka2013-07-15 05:13:29 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-22 13:20:11 (EDT)
commit05735beaf7d3217caba9506f1bc4cea774a53936 (patch)
tree7536b4fedc2b53db0b10a0996048dd90ee7371e6
parent89472f2da05022ddb83f2d943909f73e888d94a5 (diff)
downloadeclipse.platform.ui-05735beaf7d3217caba9506f1bc4cea774a53936.zip
eclipse.platform.ui-05735beaf7d3217caba9506f1bc4cea774a53936.tar.gz
eclipse.platform.ui-05735beaf7d3217caba9506f1bc4cea774a53936.tar.bz2
Bug 394013 - Unable to get dropdown menu in ToolItem to displayI20130723-0800refs/changes/93/14093/3
Change-Id: Ic377daeaf9f37de2300a4a538ec6a7d05c7d0307 Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/DirectContributionItem.java17
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java5
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemRenderer.java10
3 files changed, 30 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/DirectContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/DirectContributionItem.java
index 4045a3a..4d251a4 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/DirectContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/DirectContributionItem.java
@@ -19,7 +19,9 @@ import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.internal.workbench.Activator;
import org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer;
import org.eclipse.e4.ui.internal.workbench.Policy;
@@ -90,6 +92,10 @@ public class DirectContributionItem extends ContributionItem {
resUtils = (ISWTResourceUtilities) utils;
}
+ @Inject
+ @Optional
+ private Logger logger;
+
private IMenuListener menuListener = new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
update(null);
@@ -443,6 +449,17 @@ public class DirectContributionItem extends ContributionItem {
return menu;
}
}
+ } else {
+ final IEclipseContext lclContext = getContext(model);
+ IPresentationEngine engine = lclContext
+ .get(IPresentationEngine.class);
+ obj = engine.createGui(mmenu, toolItem.getParent(), lclContext);
+ if (obj instanceof Menu) {
+ return (Menu) obj;
+ }
+ if (logger != null) {
+ logger.debug("Rendering returned " + obj); //$NON-NLS-1$
+ }
}
return null;
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
index 55e0856..7c71cce 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
@@ -817,8 +817,9 @@ public class HandledContributionItem extends ContributionItem {
Menu menu = (Menu) obj;
// menu.setData(AbstractPartRenderer.OWNING_ME, menu);
return menu;
- } else {
- System.err.println("Rendering returned " + obj); //$NON-NLS-1$
+ }
+ if (logger != null) {
+ logger.debug("Rendering returned " + obj); //$NON-NLS-1$
}
}
return null;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemRenderer.java
index 0d2aeab..22cc9b9 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemRenderer.java
@@ -46,6 +46,7 @@ import org.eclipse.e4.ui.model.application.ui.menu.MItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MRenderedMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MToolItem;
+import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.bindings.TriggerSequence;
@@ -454,6 +455,15 @@ public class ToolItemRenderer extends SWTPartRenderer {
return menu;
}
}
+ } else {
+ final IEclipseContext lclContext = getContext(mmenu);
+ IPresentationEngine engine = lclContext
+ .get(IPresentationEngine.class);
+ obj = engine.createGui(mmenu, toolItem.getParent(), lclContext);
+ if (obj instanceof Menu) {
+ return (Menu) obj;
+ }
+ logger.debug("Rendering returned " + obj); //$NON-NLS-1$
}
return null;
}