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 221201 Details for
Bug 389335
CommandContributionItem IBindingManagerListener leak
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Possible patch
patch cci.txt (text/plain), 5.32 KB, created by
Oleg Besedin
on 2012-09-18 11:23:03 EDT
(
hide
)
Description:
Possible patch
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2012-09-18 11:23:03 EDT
Size:
5.32 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java >index 1ddf6f1..b607833 100644 >--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java >+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2009 IBM Corporation and others. >+ * Copyright (c) 2006, 2012 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -216,41 +216,6 @@ > contributionParameters.parameters); > > if (command != null) { >- try { >- UIElement callback = new UIElement( >- contributionParameters.serviceLocator) { >- >- public void setChecked(boolean checked) { >- CommandContributionItem.this.setChecked(checked); >- } >- >- public void setDisabledIcon(ImageDescriptor desc) { >- CommandContributionItem.this.setDisabledIcon(desc); >- } >- >- public void setHoverIcon(ImageDescriptor desc) { >- CommandContributionItem.this.setHoverIcon(desc); >- } >- >- public void setIcon(ImageDescriptor desc) { >- CommandContributionItem.this.setIcon(desc); >- } >- >- public void setText(String text) { >- CommandContributionItem.this.setText(text); >- } >- >- public void setTooltip(String text) { >- CommandContributionItem.this.setTooltip(text); >- } >- >- public void setDropDownId(String id) { >- dropDownMenuOverride = id; >- } >- }; >- elementRef = commandService.registerElementForCommand(command, >- callback); >- command.getCommand().addCommandListener(getCommandListener()); > setImages(contributionParameters.serviceLocator, > contributionParameters.iconStyle); > >@@ -268,17 +233,6 @@ > if (workbench != null && helpContextId != null) { > this.workbenchHelpSystem = workbench.getHelpSystem(); > } >- } catch (NotDefinedException e) { >- StatusManager >- .getManager() >- .handle( >- StatusUtil >- .newStatus( >- IStatus.ERROR, >- "Unable to register menu item \"" + getId() //$NON-NLS-1$ >- + "\", command \"" + contributionParameters.commandId + "\" not defined", //$NON-NLS-1$ //$NON-NLS-2$ >- null)); >- } > } > > } >@@ -490,8 +444,7 @@ > update(null); > updateIcons(); > >- bindingService.addBindingManagerListener(bindingManagerListener); >- >+ establishReferences(); > } > > /* (non-Javadoc) >@@ -522,8 +475,7 @@ > update(null); > updateIcons(); > >- bindingService.addBindingManagerListener(bindingManagerListener); >- >+ establishReferences(); > } > > /* >@@ -557,7 +509,7 @@ > update(null); > updateIcons(); > >- bindingService.addBindingManagerListener(bindingManagerListener); >+ establishReferences(); > } > > /* >@@ -748,16 +700,58 @@ > } > } > >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.jface.action.ContributionItem#dispose() >- */ >- public void dispose() { >- if (widget != null) { >- widget.dispose(); >- widget = null; >+ public void setParent(IContributionManager parent) { >+ super.setParent(parent); >+ if (parent == null) >+ disconnectReferences(); >+ } >+ >+ private void establishReferences() { >+ if (command != null) { >+ UIElement callback = new UIElement(serviceLocator) { >+ >+ public void setChecked(boolean checked) { >+ CommandContributionItem.this.setChecked(checked); >+ } >+ >+ public void setDisabledIcon(ImageDescriptor desc) { >+ CommandContributionItem.this.setDisabledIcon(desc); >+ } >+ >+ public void setHoverIcon(ImageDescriptor desc) { >+ CommandContributionItem.this.setHoverIcon(desc); >+ } >+ >+ public void setIcon(ImageDescriptor desc) { >+ CommandContributionItem.this.setIcon(desc); >+ } >+ >+ public void setText(String text) { >+ CommandContributionItem.this.setText(text); >+ } >+ >+ public void setTooltip(String text) { >+ CommandContributionItem.this.setTooltip(text); >+ } >+ >+ public void setDropDownId(String id) { >+ dropDownMenuOverride = id; >+ } >+ }; >+ try { >+ elementRef = commandService.registerElementForCommand(command, callback); >+ } catch (NotDefinedException e) { >+ StatusManager.getManager().handle( >+ StatusUtil.newStatus(IStatus.ERROR, "Unable to register menu item \"" + getId() //$NON-NLS-1$ >+ + "\", command \"" + command.getId() + "\" not defined", //$NON-NLS-1$ //$NON-NLS-2$ >+ null)); >+ } >+ command.getCommand().addCommandListener(getCommandListener()); > } >+ bindingService.addBindingManagerListener(bindingManagerListener); >+ } >+ >+ private void disconnectReferences() { > if (elementRef != null) { > commandService.unregisterElement(elementRef); > elementRef = null; >@@ -770,6 +764,20 @@ > if (bindingService != null) { > bindingService.removeBindingManagerListener(bindingManagerListener); > } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.action.ContributionItem#dispose() >+ */ >+ public void dispose() { >+ if (widget != null) { >+ widget.dispose(); >+ widget = null; >+ } >+ >+ disconnectReferences(); > > command = null; > commandService = null;
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 389335
: 221201 |
221303