summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSopot Cela2013-11-15 03:38:42 (EST)
committer Lars Vogel2013-11-18 04:37:56 (EST)
commit1e515cb836966de51ea94bf3545746cd5e56fbd7 (patch)
tree878ec29fd35b8adcf84b3666e415772cea86a69b
parente9d68826133b68555b1ad63f963a71659300d686 (diff)
downloadeclipse.platform.ui-1e515cb836966de51ea94bf3545746cd5e56fbd7.zip
eclipse.platform.ui-1e515cb836966de51ea94bf3545746cd5e56fbd7.tar.gz
eclipse.platform.ui-1e515cb836966de51ea94bf3545746cd5e56fbd7.tar.bz2
Bug 318435 - [Contributions] Changes in the application model for therefs/changes/19/18419/2
menu are not reflected in the user interface Change-Id: I17f3cd8dd380c844739e2875002410f167f56bae Signed-off-by: Sopot Cela <sopotcela@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
index 1e2e580..166e57d 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
@@ -123,6 +123,28 @@ public class MenuManagerRenderer extends SWTPartRenderer {
}
};
+ private EventHandler labelUpdater = new EventHandler() {
+ public void handleEvent(Event event) {
+ // Ensure that this event is for a MMenu
+ if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MMenu))
+ return;
+
+ String attName = (String) event
+ .getProperty(UIEvents.EventTags.ATTNAME);
+ MMenu model = (MMenu) event.getProperty(UIEvents.EventTags.ELEMENT);
+ MenuManager manager = getManager(model);
+ Menu menu = manager.getMenu();
+ if ((menu == null) || (menu.getParentItem() == null))
+ return;
+ if (UIEvents.UILabel.LABEL.equals(attName)) {
+ menu.getParentItem().setText(getText(model));
+ }
+ if (UIEvents.UILabel.ICONURI.equals(attName)) {
+ menu.getParentItem().setImage(getImage(model));
+ }
+ }
+ };
+
private EventHandler toBeRenderedUpdater = new EventHandler() {
public void handleEvent(Event event) {
Object element = event.getProperty(UIEvents.EventTags.ELEMENT);
@@ -214,6 +236,7 @@ public class MenuManagerRenderer extends SWTPartRenderer {
@PostConstruct
public void init() {
eventBroker.subscribe(UIEvents.UILabel.TOPIC_ALL, itemUpdater);
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_ALL, labelUpdater);
eventBroker.subscribe(UIEvents.Item.TOPIC_SELECTED, selectionUpdater);
eventBroker.subscribe(UIEvents.Item.TOPIC_ENABLED, enabledUpdater);
eventBroker
@@ -237,6 +260,7 @@ public class MenuManagerRenderer extends SWTPartRenderer {
@PreDestroy
public void contextDisposed() {
eventBroker.unsubscribe(itemUpdater);
+ eventBroker.unsubscribe(labelUpdater);
eventBroker.unsubscribe(selectionUpdater);
eventBroker.unsubscribe(enabledUpdater);
eventBroker.unsubscribe(toBeRenderedUpdater);