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 134654 Details for
Bug 253002
[Contributions] CompoundContributionItem disposes old items on show
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
CompoundContributionItem early disposal v02
cci-v02.txt (text/plain), 2.67 KB, created by
Paul Webster
on 2009-05-06 13:34:50 EDT
(
hide
)
Description:
CompoundContributionItem early disposal v02
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2009-05-06 13:34:50 EDT
Size:
2.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java,v >retrieving revision 1.8 >diff -u -r1.8 CompoundContributionItem.java >--- Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java 28 May 2007 13:17:34 -0000 1.8 >+++ Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java 6 May 2009 17:33:35 -0000 >@@ -13,11 +13,13 @@ > import org.eclipse.jface.action.ContributionItem; > import org.eclipse.jface.action.IContributionItem; > import org.eclipse.jface.action.IContributionManager; >-import org.eclipse.jface.action.IMenuListener; >+import org.eclipse.jface.action.IMenuListener2; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.MenuItem; >+import org.eclipse.ui.PlatformUI; > > /** > * A compound contribution is a contribution item consisting of a >@@ -29,11 +31,15 @@ > > private boolean dirty = true; > >- private IMenuListener menuListener = new IMenuListener() { >+ private IMenuListener2 menuListener = new IMenuListener2() { > public void menuAboutToShow(IMenuManager manager) { > manager.markDirty(); > dirty = true; > } >+ >+ public void menuAboutToHide(IMenuManager manager) { >+ disposeOldItems(); >+ } > }; > > private IContributionItem[] oldItems; >@@ -91,16 +97,27 @@ > protected abstract IContributionItem[] getContributionItems(); > > private IContributionItem[] getContributionItemsToFill() { >- if (oldItems != null) { >- for (int i = 0; i < oldItems.length; i++) { >- IContributionItem oldItem = oldItems[i]; >- oldItem.dispose(); >- } >- oldItems = null; >- } >- oldItems = getContributionItems(); >- return oldItems; >- } >+ oldItems = getContributionItems(); >+ return oldItems; >+ } >+ >+ private void disposeOldItems() { >+ if (oldItems == null) { >+ return; >+ } >+ final Display display = PlatformUI.getWorkbench().getDisplay(); >+ final IContributionItem[] itemsToDispose = oldItems; >+ oldItems = null; >+ final Runnable dispose = new Runnable() { >+ public void run() { >+ for (int i = 0; i < itemsToDispose.length; i++) { >+ IContributionItem oldItem = itemsToDispose[i]; >+ oldItem.dispose(); >+ } >+ } >+ }; >+ display.asyncExec(dispose); >+ } > > /* (non-Javadoc) > * @see org.eclipse.jface.action.ContributionItem#isDirty()
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 253002
:
134055
| 134654