Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2016-09-05 13:03:48 +0000
committerStephane Begaudeau2016-09-06 15:43:26 +0000
commite4f26e8ec088a9cb158399409bfab5c0f4c30095 (patch)
tree3d79c22d1b06b8b36c95bae5549b80e248c8be64
parent25640ad4b0f831d0677897515e21af4b86d77869 (diff)
downloadorg.eclipse.eef-e4f26e8ec088a9cb158399409bfab5c0f4c30095.tar.gz
org.eclipse.eef-e4f26e8ec088a9cb158399409bfab5c0f4c30095.tar.xz
org.eclipse.eef-e4f26e8ec088a9cb158399409bfab5c0f4c30095.zip
Remove listener on page disposal to avoid memory leakv1.6.1_RC4v1.6.1
Change-Id: I380e0bd2edf4f8fecd993f785068378e40cfd821 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
index d836b025d..7a8a33c5d 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/EEFTabbedPropertySheetPage.java
@@ -117,6 +117,16 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
private IWorkbenchWindow cachedWorkbenchWindow;
/**
+ * The widget listener used to resize the scrolled composite.
+ */
+ private ControlAdapter scrolledCompositeListener;
+
+ /**
+ * The listener used to forward tab selection changes.
+ */
+ private IEEFTabDescriptorChangedListener viewerSelectionListener;
+
+ /**
* The part activation listener used to manage a part of the lifecycle of the property sheet page.
*/
private IPartListener partActivationListener;
@@ -245,19 +255,21 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
this.widgetFactory.paintBordersFor(form);
this.tabbedPropertyViewer = new EEFTabbedPropertyViewer(this.tabbedPropertyComposite.getTabbedPropertyList(), this.registry);
- this.tabbedPropertyViewer.addSelectionListener(new IEEFTabDescriptorChangedListener() {
+ this.viewerSelectionListener = new IEEFTabDescriptorChangedListener() {
@Override
public void selectionChanged(IEEFTabDescriptor descriptor) {
EEFTabbedPropertySheetPage.this.processSelectionChanged(descriptor);
}
- });
+ };
+ this.tabbedPropertyViewer.addSelectionListener(viewerSelectionListener);
- this.tabbedPropertyComposite.getScrolledComposite().addControlListener(new ControlAdapter() {
+ this.scrolledCompositeListener = new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
EEFTabbedPropertySheetPage.this.resizeScrolledComposite();
}
- });
+ };
+ this.tabbedPropertyComposite.getScrolledComposite().addControlListener(scrolledCompositeListener);
this.partActivationListener = new EEFPartListenerAdapter() {
@Override
@@ -459,8 +471,6 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
* @param part
* the new activated part.
*/
- // Used to keep the compatibility with luna
- @SuppressWarnings("cast")
private void handlePartActivated(IWorkbenchPart part) {
EEFTabbedPropertyViewPlugin.getPlugin().debug("EEFTabbedPropertySheetPage#partActivated(...)"); //$NON-NLS-1$
@@ -479,7 +489,9 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
/*
* Is the part is a IContributedContentsView for the contributor, for example, outline view.
*/
- view = (IContributedContentsView) part.getAdapter(IContributedContentsView.class);
+ // Used to keep the compatibility with luna
+ Object object = part.getAdapter(IContributedContentsView.class);
+ view = (IContributedContentsView) object;
}
if (view == null || (view.getContributingPart() != null && !view.getContributingPart().equals(contributor))) {
@@ -732,6 +744,7 @@ public class EEFTabbedPropertySheetPage extends Page implements IPropertySheetPa
public void dispose() {
this.disposeContributor();
this.widgetFactory.dispose();
+ this.cachedWorkbenchWindow.getPartService().removePartListener(this.partActivationListener);
}
/**

Back to the top