diff options
author | Andrey Loskutov | 2015-01-27 09:53:44 +0000 |
---|---|---|
committer | Wojciech Sudol | 2015-04-13 15:19:08 +0000 |
commit | c3b8e9835547d11ed4588698cc8461d81b98a983 (patch) | |
tree | ec7a92a446abb03d5dfdcc4f179131022b241495 | |
parent | b2e28768d99664d259e7abd589e2d96ea1a742fc (diff) | |
download | eclipse.platform.ui-c3b8e9835547d11ed4588698cc8461d81b98a983.tar.gz eclipse.platform.ui-c3b8e9835547d11ed4588698cc8461d81b98a983.tar.xz eclipse.platform.ui-c3b8e9835547d11ed4588698cc8461d81b98a983.zip |
Bug 420956 - Explicitly dispose CommandContributionItem after disconnecting it from manager
Change-Id: I61e7d3eea9fc1a0d4b85a9d3e94c04f69ab68453
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java index beeed91b0ad..4065bf6c13c 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java @@ -648,13 +648,21 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa toolItem.setRenderer(renderer); HandledContributionItem ci = ContextInjectionFactory.make(HandledContributionItem.class, window.getContext()); + if (manager instanceof ContributionManager) { + // set basic attributes to the item before adding to the manager + ci.setId(toolItem.getElementId()); + ci.setVisible(toolItem.isVisible()); + ContributionManager cm = (ContributionManager) manager; cm.insert(index, ci); cm.remove(item); + + // explicitly dispose contribution since it is now + // disconnected from manager + item.dispose(); } ci.setModel(toolItem); - ci.setVisible(toolItem.isVisible()); renderer.linkModelToContribution(toolItem, ci); container.getChildren().add(toolItem); } else { |