Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 223414 Details for
Bug 374568
Part menu is not rendered correctly after removing menu items.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Additional Modification To Patch
updatedMenuManagerRenderer.patch (text/plain), 4.34 KB, created by
Josh Davis
on 2012-11-09 15:14:55 EST
(
hide
)
Description:
Additional Modification To Patch
Filename:
MIME Type:
Creator:
Josh Davis
Created:
2012-11-09 15:14:55 EST
Size:
4.34 KB
patch
obsolete
>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 a439075..bc3e4f7 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 >@@ -48,6 +48,7 @@ > import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl; > import org.eclipse.e4.ui.workbench.IResourceUtilities; > import org.eclipse.e4.ui.workbench.UIEvents; >+import org.eclipse.e4.ui.workbench.UIEvents.ElementContainer; > import org.eclipse.e4.ui.workbench.modeling.ExpressionContext; > import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities; > import org.eclipse.emf.common.util.URI; >@@ -204,6 +205,48 @@ > } > }; > >+ private EventHandler childUpdater = new EventHandler() { >+ public void handleEvent(Event event) { >+ // Ensure that this event is for a MMenuItem >+ if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MMenu)) >+ return; >+ >+ Object menuModel = event.getProperty(UIEvents.EventTags.ELEMENT); >+ >+ if (UIEvents.isADD(event)) { >+ processContents((MElementContainer<MUIElement>) menuModel); >+ } else if (UIEvents.isREMOVE(event)) { >+ MenuManager parentManager = getManager((MMenu) menuModel); >+ if (parentManager == null) { >+ return; >+ } >+ Object oldValue = event >+ .getProperty(UIEvents.EventTags.OLD_VALUE); >+ if (oldValue instanceof MMenu) { >+ disposeMenuManager(getManager((MMenu) oldValue), >+ parentManager, (MMenu) oldValue); >+ } else if (oldValue instanceof MMenuElement) { >+ disposeContributionItem( >+ getContribution((MMenuElement) oldValue), >+ parentManager, (MMenuElement) oldValue); >+ parentManager.update(false); >+ } else if (oldValue instanceof List) { >+ for (Object object : (List) oldValue) { >+ if (object instanceof MMenu) { >+ disposeMenuManager(getManager((MMenu) object), >+ parentManager, (MMenu) object); >+ } else if (object instanceof MMenuElement) { >+ disposeContributionItem( >+ getContribution((MMenuElement) object), >+ parentManager, (MMenuElement) object); >+ } >+ } >+ parentManager.update(false); >+ } >+ } >+ } >+ }; >+ > private MenuManagerRendererFilter rendererFilter; > > @PostConstruct >@@ -213,6 +256,7 @@ > eventBroker.subscribe(UIEvents.Item.TOPIC_ENABLED, enabledUpdater); > eventBroker > .subscribe(UIEvents.UIElement.TOPIC_ALL, toBeRenderedUpdater); >+ eventBroker.subscribe(ElementContainer.TOPIC_CHILDREN, childUpdater); > > context.set(MenuManagerRenderer.class, this); > Display display = context.get(Display.class); >@@ -235,6 +279,7 @@ > eventBroker.unsubscribe(selectionUpdater); > eventBroker.unsubscribe(enabledUpdater); > eventBroker.unsubscribe(toBeRenderedUpdater); >+ eventBroker.unsubscribe(childUpdater); > > ContextInjectionFactory.uninject(MenuManagerEventHelper.showHelper, > context); >@@ -520,6 +565,32 @@ > parentManager.update(false); > } > >+ // Disposes the menuManager and its children >+ private void disposeMenuManager(MenuManager menuManager, >+ MenuManager parentManager, MMenu menuModel) { >+ // Cleanup all contributions in menuManager since the parent is being >+ // disposed. >+ for (IContributionItem contributionItem : menuManager.getItems()) { >+ if (contributionItem instanceof MenuManager) { >+ disposeMenuManager((MenuManager) contributionItem, menuManager, >+ getMenuModel((MenuManager) contributionItem)); >+ } else { >+ disposeContributionItem(contributionItem, parentManager, >+ getMenuElement(contributionItem)); >+ } >+ } >+ clearModelToManager(menuModel, menuManager); >+ parentManager.remove(menuManager); >+ menuManager.dispose(); >+ } >+ >+ private void disposeContributionItem(IContributionItem contributionItem, >+ MenuManager parentManager, MMenuElement menuElement) { >+ parentManager.remove(contributionItem); >+ contributionItem.dispose(); >+ clearModelToContribution(menuElement, contributionItem); >+ } >+ > private void addToManager(MenuManager parentManager, MMenuElement model, > IContributionItem menuManager) { > MElementContainer<MUIElement> parent = model.getParent();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 374568
:
212819
|
212820
|
212854
|
212855
|
212856
|
215508
|
223365
| 223414 |
228502
|
228503