aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSnjezana Peco2013-01-22 03:19:45 (EST)
committerDani Megert2013-01-22 03:19:45 (EST)
commit0fcc8cb5b2c36e93fdf48c4922337eff4f5d9ac3 (patch)
treec65e4c3c891385cb0b973b4fa9ca1b8ac055e067
parentfd541d2f3fb968c3db6606d53a2e7b9cf084a389 (diff)
downloadeclipse.jdt.ui-0fcc8cb5b2c36e93fdf48c4922337eff4f5d9ac3.zip
eclipse.jdt.ui-0fcc8cb5b2c36e93fdf48c4922337eff4f5d9ac3.tar.gz
eclipse.jdt.ui-0fcc8cb5b2c36e93fdf48c4922337eff4f5d9ac3.tar.bz2
Fixed bug 398383: The NewWizardMenu class gets leaked when ever callingv20130122-081945
a context menu
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/NewWizardsActionGroup.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/NewWizardsActionGroup.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/NewWizardsActionGroup.java
index 6ed6130..66e8ab3 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/NewWizardsActionGroup.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/NewWizardsActionGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Snjezana Peco <snjezana.peco@redhat.com> - The NewWizardMenu class gets leaked when ever calling a context menu - http://bugs.eclipse.org/33710
*******************************************************************************/
package org.eclipse.jdt.internal.ui.actions;
@@ -43,6 +44,7 @@ import org.eclipse.jdt.internal.ui.workingsets.IWorkingSetIDs;
public class NewWizardsActionGroup extends ActionGroup {
private IWorkbenchSite fSite;
+ private NewWizardMenu fNewWizardMenu;
/**
* Creates a new <code>NewWizardsActionGroup</code>. The group requires
@@ -66,14 +68,21 @@ public class NewWizardsActionGroup extends ActionGroup {
ISelection selection= getContext().getSelection();
if (selection instanceof IStructuredSelection) {
if (canEnable((IStructuredSelection)selection)) {
- MenuManager newMenu = new MenuManager(ActionMessages.NewWizardsActionGroup_new);
+ MenuManager newMenu= new MenuManager(ActionMessages.NewWizardsActionGroup_new);
menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
- newMenu.add(new NewWizardMenu(fSite.getWorkbenchWindow()));
+ newMenu.add(getNewWizardMenu());
}
}
}
+ private NewWizardMenu getNewWizardMenu() {
+ if (fNewWizardMenu == null) {
+ fNewWizardMenu= new NewWizardMenu(fSite.getWorkbenchWindow());
+ }
+ return fNewWizardMenu;
+ }
+
private boolean canEnable(IStructuredSelection sel) {
if (sel.size() == 0)
return true;
@@ -111,4 +120,13 @@ public class NewWizardsActionGroup extends ActionGroup {
return false;
}
+ @Override
+ public void dispose() {
+ if (fNewWizardMenu != null) {
+ fNewWizardMenu.dispose();
+ fNewWizardMenu= null;
+ }
+ super.dispose();
+ }
+
}