diff options
author | Darin Wright | 2009-12-01 14:49:25 +0000 |
---|---|---|
committer | Darin Wright | 2009-12-01 14:49:25 +0000 |
commit | 5ee31ed55ca0a3720552e04ab1091e460a20507f (patch) | |
tree | 1346d569fae7b24219baf0e7feda175fdf42ad7d /org.eclipse.debug.ui/ui/org | |
parent | cb9aca189d297be5daf45960bf9bc29527687b33 (diff) | |
download | eclipse.platform.debug-5ee31ed55ca0a3720552e04ab1091e460a20507f.tar.gz eclipse.platform.debug-5ee31ed55ca0a3720552e04ab1091e460a20507f.tar.xz eclipse.platform.debug-5ee31ed55ca0a3720552e04ab1091e460a20507f.zip |
Bug 295771 - [flex-hierarchy] IPresentationContext should be disposed by its creator.
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
9 files changed, 50 insertions, 27 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java index cacf33d08..b37edcaef 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java @@ -1875,6 +1875,10 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende fTableViewer.dispose(); } + if (fPresentationContext != null) { + fPresentationContext.dispose(); + } + if (!fToolTipShell.isDisposed()) { fToolTipShell.dispose(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java index d25db71ef..670355541 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java @@ -165,16 +165,6 @@ public class InternalTreeModelViewer extends TreeViewer private boolean fNotifyUnmap = true; /** - * Flag indicating whether the viewer is a pop-up viewer. A pop-up viewer - * is transient and does not automatically expand and select elements up - * when requested by the model. It also does not dispose the presentation - * context when its control is disposed. - * - * @since 3.5 - */ - private boolean fIsPopup; - - /** * Persist column sizes when they change. * * @since 3.2 @@ -1019,8 +1009,9 @@ public class InternalTreeModelViewer extends TreeViewer setContentProvider(createContentProvider()); setLabelProvider(createLabelProvider()); - fIsPopup = (style & SWT.POP_UP) != 0; - if (fIsPopup) { + // A pop-up viewer is transient and does not automatically expand + // and select elements up when requested by the model + if ((style & SWT.POP_UP) != 0) { ((ITreeModelContentProvider)getContentProvider()).setModelDeltaMask( ~ITreeModelContentProvider.ALL_MODEL_DELTA_FLAGS & ~ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS); } @@ -1138,9 +1129,6 @@ public class InternalTreeModelViewer extends TreeViewer } fCellModifier.dispose(); - if (!fIsPopup) { - fContext.dispose(); - } super.handleDispose(event); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java index c0c229bed..8dfc928da 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java @@ -951,7 +951,6 @@ public class InternalVirtualTreeModelViewer extends Viewer if (fColumnPresentation != null) { fColumnPresentation.dispose(); } - fContext.dispose(); if (fContentProvider != null) { fContentProvider.dispose(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java index 780d18a6e..f8ef91019 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java @@ -22,13 +22,23 @@ import org.eclipse.jface.util.IPropertyChangeListener; * @since 3.2 */ public interface IPresentationContext { - + /** * Property name used for property change notification when the columns * in a presentation context change. */ public static final String PROPERTY_COLUMNS = "PROPERTY_COLUMNS"; //$NON-NLS-1$ - + + /** + * Property indicating whether the presentation context is disposed. + * It is set to <code>Boolean.TRUE</code> after the presentation context + * is disposed. This property may be <code>null</code>, which indicates + * that context is not yet disposed. + * + * @since 3.6 + */ + public static final String PROPERTY_DISPOSED = "PROPERTY_DISPOSED"; //$NON-NLS-1$ + /** * Returns identifiers of the visible columns in the order * labels should be provided, or <code>null</code> if columns diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java index 22c752441..b79b67859 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java @@ -98,8 +98,9 @@ public class PresentationContext implements IPresentationContext { * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#dispose() */ public void dispose() { + fProperties.clear(); + setProperty(PROPERTY_DISPOSED, Boolean.TRUE); fListeners.clear(); - fProperties.clear(); } /* (non-Javadoc) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 327dfc817..b17575779 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -63,6 +63,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedList import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener; import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; @@ -173,6 +174,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi */ private IDebugModelPresentation fPresentation = null; + private IPresentationContext fPresentationContext; + private EditLaunchConfigurationAction fEditConfigAction = null; private AddToFavoritesAction fAddToFavoritesAction = null; private EditSourceLookupPathAction fEditSourceAction = null; @@ -771,9 +774,10 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi */ protected Viewer createViewer(Composite parent) { fPresentation = new DelegatingModelPresentation(); + fPresentationContext = new DebugModelPresentationContext(IDebugUIConstants.ID_DEBUG_VIEW, fPresentation); TreeModelViewer viewer = new TreeModelViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL, - new DebugModelPresentationContext(IDebugUIConstants.ID_DEBUG_VIEW, fPresentation)); + fPresentationContext); viewer.addSelectionChangedListener(fTreeViewerSelectionChangedListener); viewer.getControl().addKeyListener(new KeyAdapter() { @@ -992,6 +996,9 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi viewer.removeSelectionChangedListener(fTreeViewerSelectionChangedListener); ((TreeModelViewer)viewer).removeViewerUpdateListener(this); } + if (fPresentationContext != null) { + fPresentationContext.dispose(); + } IWorkbenchPage page = getSite().getPage(); page.removePartListener((IPartListener2) this); IWorkbenchWindow window = getSite().getWorkbenchWindow(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java index 4862fdeb2..a54b69229 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java @@ -32,6 +32,7 @@ import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.contexts.DebugContextEvent; @@ -74,6 +75,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC public static final String PANE_ID = DebugUIPlugin.getUniqueIdentifier() + ".MemoryView.MemoryBlocksTreeViewPane"; //$NON-NLS-1$ private IViewPart fParent; + private IPresentationContext fPresentationContext; private MemoryViewTreeViewer fTreeViewer; protected IMemoryBlockRetrieval fRetrieval; private ViewPaneSelectionProvider fSelectionProvider; @@ -291,8 +293,8 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC fLabel = label; IMemoryRenderingSite site = getMemoryRenderingSite(); - MemoryViewPresentationContext presentationContext = new MemoryViewPresentationContext(site, this, null); - fTreeViewer = new MemoryViewTreeViewer(parent, style, presentationContext); + fPresentationContext = new MemoryViewPresentationContext(site, this, null); + fTreeViewer = new MemoryViewTreeViewer(parent, style, fPresentationContext); IAdaptable context = DebugUITools.getDebugContext(); IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context); @@ -367,6 +369,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC fAddMemoryBlockAction.dispose(); DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener); fEvtHandler.dispose(); + fPresentationContext.dispose(); } /* (non-Javadoc) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 8023624a9..7e03edb9f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -357,6 +357,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis private SelectionProviderWrapper fSelectionProvider; /** + * Presentation context for this view. + */ + private IPresentationContext fPresentationContext; + + /** * Remove myself as a selection listener * and preference change listener. * @@ -373,6 +378,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis viewer.removeModelChangedListener(this); viewer.removeViewerUpdateListener(this); } + if (fPresentationContext != null) { + fPresentationContext.dispose(); + fPresentationContext = null; + } if (fDetailPane != null) fDetailPane.dispose(); fInputService.dispose(); fSelectionProvider.dispose(); @@ -580,8 +589,8 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis protected TreeModelViewer createTreeViewer(Composite parent) { int style = getViewerStyle(); - final TreeModelViewer variablesViewer = new TreeModelViewer(parent, style, - new DebugModelPresentationContext(getPresentationContextId(), fModelPresentation)); + fPresentationContext = new DebugModelPresentationContext(getPresentationContextId(), fModelPresentation); + final TreeModelViewer variablesViewer = new TreeModelViewer(parent, style, fPresentationContext); variablesViewer.getControl().addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java index 2144d26a0..3c1eaa5fe 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java @@ -64,6 +64,7 @@ public class InspectPopupDialog extends DebugPopup { private static final int MIN_WIDTH = 300; private static final int MIN_HEIGHT = 250; + private IPresentationContext fContext; private TreeModelViewer fViewer; private SashForm fSashForm; private Composite fDetailPaneComposite; @@ -100,17 +101,17 @@ public class InspectPopupDialog extends DebugPopup { fSashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); VariablesView view = getViewToEmulate(); - IPresentationContext context = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW); + fContext = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW); if (view != null) { // copy over properties IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext(); String[] properties = copy.getProperties(); for (int i = 0; i < properties.length; i++) { String key = properties[i]; - context.setProperty(key, copy.getProperty(key)); + fContext.setProperty(key, copy.getProperty(key)); } } - fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, context); + fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, fContext); fViewer.setAutoExpandLevel(1); fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH); @@ -253,6 +254,7 @@ public class InspectPopupDialog extends DebugPopup { fExpression.dispose(); } fDetailPane.dispose(); + fContext.dispose(); return super.close(); } |