diff options
author | Darin Wright | 2006-08-02 21:01:03 +0000 |
---|---|---|
committer | Darin Wright | 2006-08-02 21:01:03 +0000 |
commit | 1b7f6dd1389f2209d859b52a394d364e89554b9f (patch) | |
tree | 110e34e5e33a0e50d13b019e7c19e89990b221ad /org.eclipse.debug.ui | |
parent | de298dbaf34c1f26561723ac9f445768b791ed13 (diff) | |
download | eclipse.platform.debug-1b7f6dd1389f2209d859b52a394d364e89554b9f.tar.gz eclipse.platform.debug-1b7f6dd1389f2209d859b52a394d364e89554b9f.tar.xz eclipse.platform.debug-1b7f6dd1389f2209d859b52a394d364e89554b9f.zip |
Bug 152664 - Separate workbench part from presentation context id
Diffstat (limited to 'org.eclipse.debug.ui')
12 files changed, 108 insertions, 91 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DebugTargetContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DebugTargetContentAdapter.java index 1cf2361c2..a7c1a363a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DebugTargetContentAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DebugTargetContentAdapter.java @@ -27,7 +27,7 @@ public class DebugTargetContentAdapter extends AsynchronousContentAdapter { * @see org.eclipse.debug.internal.ui.viewers.provisional.AsynchronousContentAdapter#getChildren(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) */ protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (id.equals(IDebugUIConstants.ID_DEBUG_VIEW)) return ((IDebugTarget) parent).getThreads(); else if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) @@ -45,7 +45,7 @@ public class DebugTargetContentAdapter extends AsynchronousContentAdapter { * @see org.eclipse.debug.internal.ui.viewers.provisional.AsynchronousContentAdapter#hasChildren(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) */ protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (id.equals(IDebugUIConstants.ID_DEBUG_VIEW)) return ((IDebugTarget)element).hasThreads(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java index 2e1595f3b..69ed3da84 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java @@ -21,7 +21,7 @@ import org.eclipse.debug.ui.IDebugUIConstants; public class MemoryRetrievalContentAdapter extends AsynchronousContentAdapter{ protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (parent instanceof IMemoryBlockRetrieval) @@ -33,7 +33,7 @@ public class MemoryRetrievalContentAdapter extends AsynchronousContentAdapter{ } protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (element instanceof IMemoryBlockRetrieval) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameContentAdapter.java index 341bc779c..c281b6eff 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameContentAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameContentAdapter.java @@ -20,7 +20,7 @@ import org.eclipse.debug.ui.IDebugUIConstants; public class StackFrameContentAdapter extends AsynchronousContentAdapter { protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); IStackFrame frame = (IStackFrame) parent; if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) { return frame.getVariables(); @@ -31,7 +31,7 @@ public class StackFrameContentAdapter extends AsynchronousContentAdapter { } protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { - String id = context.getPart().getSite().getId(); + String id = context.getId(); IStackFrame frame = (IStackFrame) element; if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) { return frame.hasVariables(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java index f458b45d0..7ddb85d94 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java @@ -14,8 +14,8 @@ import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.internal.ui.viewers.provisional.IColumnEditor; import org.eclipse.debug.internal.ui.viewers.provisional.IColumnEditorFactoryAdapter; -import org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresentationFactoryAdapter; import org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresentation; +import org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresentationFactoryAdapter; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; @@ -30,7 +30,7 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactoryA * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresenetationFactoryAdapter#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object) */ public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { if (element instanceof IStackFrame) { return new VariableColumnPresentation(); @@ -43,7 +43,7 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactoryA * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresenetationFactoryAdapter#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object) */ public String getColumnPresentationId(IPresentationContext context, Object element) { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { if (element instanceof IStackFrame) { return VariableColumnPresentation.DEFAULT_VARIABLE_COLUMN_PRESENTATION; @@ -56,7 +56,7 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactoryA * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnEditorFactoryAdapter#createColumnEditor(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object) */ public IColumnEditor createColumnEditor(IPresentationContext context, Object element) { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { if (element instanceof IVariable) { return new VariableColumnEditor(); @@ -69,7 +69,7 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactoryA * @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnEditorFactoryAdapter#getColumnEditorId(org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext, java.lang.Object) */ public String getColumnEditorId(IPresentationContext context, Object element) { - String id = context.getPart().getSite().getId(); + String id = context.getId(); if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { if (element instanceof IVariable) { return VariableColumnEditor.DEFAULT_VARIABLE_COLUMN_EDITOR; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableLabelAdapter.java index dde715a7b..e730c6cc8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableLabelAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableLabelAdapter.java @@ -22,7 +22,6 @@ import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.swt.graphics.RGB; -import org.eclipse.ui.IWorkbenchPart; /** * Label adapter for variables. @@ -35,10 +34,9 @@ public class VariableLabelAdapter extends AsynchronousDebugLabelAdapter { * @see org.eclipse.debug.internal.ui.elements.adapters.AsynchronousDebugLabelAdapter#getLabels(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) */ protected String[] getLabels(Object element, IPresentationContext context) throws CoreException { - IWorkbenchPart part = context.getPart(); + String viewId = context.getId(); String[] ids = context.getColumns(); - if (part != null && ids != null) { - String viewId = part.getSite().getId(); + if (ids != null) { if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(viewId) || IDebugUIConstants.ID_REGISTER_VIEW.equals(viewId)) { IVariable variable = (IVariable) element; IValue value = variable.getValue(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PresentationContext.java index 779f51320..24c0549f9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PresentationContext.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PresentationContext.java @@ -28,6 +28,7 @@ import org.eclipse.ui.IWorkbenchPart; public class PresentationContext implements IPresentationContext { private IWorkbenchPart fPart; + private String fId; private String[] fColumns; private ListenerList fListeners = new ListenerList(); @@ -38,6 +39,18 @@ public class PresentationContext implements IPresentationContext { */ public PresentationContext(IWorkbenchPart part) { fPart = part; + if (part != null) { + fId = part.getSite().getId(); + } + } + + /** + * Constructs a presentation context for the given id. + * + * @param id presentation context id + */ + public PresentationContext(String id) { + fId = id; } /* (non-Javadoc) @@ -109,4 +122,11 @@ public class PresentationContext implements IPresentationContext { fListeners.remove(listener); } + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext#getId() + */ + public String getId() { + return fId; + } + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java index f6aa92bf4..a66fc45a1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.internal.ui.viewers.AsynchronousSchedulingRuleFactory; -import org.eclipse.ui.IWorkbenchPart; /** * Abstract implementation of an asynchronous content adapter. @@ -160,11 +159,7 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent * @return whether this adapter supports the given context */ protected boolean supportsContext(IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null) { - return supportsPartId(part.getSite().getId()); - } - return true; + return supportsPartId(context.getId()); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IPresentationContext.java index 5ee4aa1fd..dc96f3228 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IPresentationContext.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IPresentationContext.java @@ -63,4 +63,14 @@ public interface IPresentationContext { */ public void removePropertyChangeListener(IPropertyChangeListener listener); + /** + * Returns the id of this presentation context. Usually this is the id of + * the associated part. However, when no part is associated with this context, + * the id may exist on its own. Allows for a context that is not tied to a part. + * + * @return id + * @since 3.3 + */ + public String getId(); + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java index 8b0d40a77..18fb82fc8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java @@ -29,55 +29,55 @@ import org.eclipse.ui.IWorkbenchPart; public class DefaultModelProxyFactory implements IModelProxyFactoryAdapter { public IModelProxy createModelProxy(Object element, IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null) { - String id = part.getSite().getId(); - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(id)) { - if (element instanceof IDebugTarget) { - return new DebugTargetProxy((IDebugTarget)element); - } - if (element instanceof ILaunchManager) { - return new LaunchManagerProxy(); - } - if (element instanceof IProcess) { - return new ProcessProxy((IProcess)element); - } + String id = context.getId(); + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(id)) { + if (element instanceof IDebugTarget) { + return new DebugTargetProxy((IDebugTarget)element); } - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id)) { - if (element instanceof IStackFrame) { - return new DefaultVariableViewModelProxy((IStackFrame)element); - } + if (element instanceof ILaunchManager) { + return new LaunchManagerProxy(); + } + if (element instanceof IProcess) { + return new ProcessProxy((IProcess)element); + } + } + if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id)) { + if (element instanceof IStackFrame) { + return new DefaultVariableViewModelProxy((IStackFrame)element); } - if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id)) { - if (element instanceof IExpressionManager) { - return new ExpressionManagerModelProxy(); - } if (element instanceof IWatchExpression) { + } + if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id)) { + if (element instanceof IExpressionManager) { + return new ExpressionManagerModelProxy(); + } if (element instanceof IWatchExpression) { + IWorkbenchPart part = context.getPart(); + if (part == null) { + return null; + } else { return new DefaultWatchExpressionModelProxy((IWatchExpression)element, part.getSite().getWorkbenchWindow()); } - if (element instanceof IExpression) { - return new DefaultExpressionModelProxy((IExpression)element); - } } - if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { - if (element instanceof IStackFrame) { - return new DefaultVariableViewModelProxy((IStackFrame)element); - } + if (element instanceof IExpression) { + return new DefaultExpressionModelProxy((IExpression)element); } - if (IDebugUIConstants.ID_MEMORY_VIEW.equals(id)) { - if (element instanceof IMemoryBlockRetrieval) - return new MemoryRetrievalProxy((IMemoryBlockRetrieval)element); - if (context instanceof MemoryViewPresentationContext) + } + if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) { + if (element instanceof IStackFrame) { + return new DefaultVariableViewModelProxy((IStackFrame)element); + } + } + if (IDebugUIConstants.ID_MEMORY_VIEW.equals(id)) { + if (element instanceof IMemoryBlockRetrieval) + return new MemoryRetrievalProxy((IMemoryBlockRetrieval)element); + if (context instanceof MemoryViewPresentationContext) + { + if (((MemoryViewPresentationContext)context).getRendering() != null) { - if (((MemoryViewPresentationContext)context).getRendering() != null) - { - if (element instanceof IMemoryBlock) - return new MemoryBlockProxy((IMemoryBlock)element); - } + if (element instanceof IMemoryBlock) + return new MemoryBlockProxy((IMemoryBlock)element); } } } - - return null; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelSelectionPolicyFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelSelectionPolicyFactory.java index 554f34ca5..fdaf1da30 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelSelectionPolicyFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelSelectionPolicyFactory.java @@ -16,7 +16,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IModelSelectionPolicy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelSelectionPolicyFactoryAdapter; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.ui.IWorkbenchPart; /** * Default factory for selection policies. @@ -26,8 +25,7 @@ import org.eclipse.ui.IWorkbenchPart; public class DefaultModelSelectionPolicyFactory implements IModelSelectionPolicyFactoryAdapter { public IModelSelectionPolicy createModelSelectionPolicyAdapter(Object element, IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null && IDebugUIConstants.ID_DEBUG_VIEW.equals(part.getSite().getId())) { + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { if (element instanceof IDebugElement) { return new DefaultSelectionPolicy((IDebugElement)element); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java index 68fdb11e7..5cfdac88f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java @@ -17,7 +17,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; /** * Default selection policy for the debug view. @@ -42,18 +41,15 @@ public class DefaultSelectionPolicy implements IModelSelectionPolicy { * @see org.eclipse.debug.ui.viewers.IModelSelectionPolicy#contains(org.eclipse.jface.viewers.ISelection, org.eclipse.debug.ui.viewers.IPresentationContext) */ public boolean contains(ISelection selection, IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null) { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(part.getSite().getId())) { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) selection; - Object element = ss.getFirstElement(); - if (element instanceof IDebugElement) { - IDebugElement debugElement = (IDebugElement) element; - return fDebugElement.getDebugTarget().equals(debugElement.getDebugTarget()); - } - } - } + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection ss = (IStructuredSelection) selection; + Object element = ss.getFirstElement(); + if (element instanceof IDebugElement) { + IDebugElement debugElement = (IDebugElement) element; + return fDebugElement.getDebugTarget().equals(debugElement.getDebugTarget()); + } + } } return false; } @@ -62,14 +58,11 @@ public class DefaultSelectionPolicy implements IModelSelectionPolicy { * @see org.eclipse.debug.ui.viewers.IModelSelectionPolicy#overrides(org.eclipse.jface.viewers.ISelection, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.ui.viewers.IPresentationContext) */ public boolean overrides(ISelection existing, ISelection candidate, IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null) { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(part.getSite().getId())) { - if (existing instanceof IStructuredSelection && candidate instanceof IStructuredSelection) { - IStructuredSelection ssExisting = (IStructuredSelection) existing; - IStructuredSelection ssCandidate = (IStructuredSelection) candidate; - return overrides(ssExisting.getFirstElement(), ssCandidate.getFirstElement()); - } + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { + if (existing instanceof IStructuredSelection && candidate instanceof IStructuredSelection) { + IStructuredSelection ssExisting = (IStructuredSelection) existing; + IStructuredSelection ssCandidate = (IStructuredSelection) candidate; + return overrides(ssExisting.getFirstElement(), ssCandidate.getFirstElement()); } } return true; @@ -94,12 +87,9 @@ public class DefaultSelectionPolicy implements IModelSelectionPolicy { * @see org.eclipse.debug.ui.viewers.IModelSelectionPolicy#isSticky(org.eclipse.jface.viewers.ISelection, org.eclipse.debug.ui.viewers.IPresentationContext) */ public boolean isSticky(ISelection selection, IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part != null) { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(part.getSite().getId())) { - if (selection instanceof IStructuredSelection) { - return isSticky(((IStructuredSelection)selection).getFirstElement()); - } + if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { + if (selection instanceof IStructuredSelection) { + return isSticky(((IStructuredSelection)selection).getFirstElement()); } } return false; 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 ed118f1a6..308b5b90f 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 @@ -115,7 +115,13 @@ public class InspectPopupDialog extends DebugPopup { fVariablesViewer = new VariablesViewer(fSashForm, SWT.NO_TRIM | SWT.VIRTUAL, null); - fVariablesViewer.setContext(new PresentationContext(view)); + IPresentationContext context; + if (view == null) { + context = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW); + } else { + context = new PresentationContext(view); + } + fVariablesViewer.setContext(context); fModelPresentation = new VariablesViewModelPresentation(); fVariablesViewer.setLabelProvider(fModelPresentation); |