diff options
23 files changed, 166 insertions, 142 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java index 45b3ac35e..ff566ca5c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java @@ -15,11 +15,8 @@ import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DefaultLabelProvider; import org.eclipse.debug.internal.ui.VariableValueEditorManager; -import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.actions.IVariableValueEditor; import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; /** * @since 3.2 @@ -27,12 +24,6 @@ import org.eclipse.ui.IWorkbenchPart; */ public class DefaultVariableCellModifier implements ICellModifier { - private IPresentationContext fContext; - - public DefaultVariableCellModifier(IPresentationContext context) { - fContext = context; - } - /* (non-Javadoc) * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) */ @@ -72,36 +63,22 @@ public class DefaultVariableCellModifier implements ICellModifier { if (element instanceof IVariable) { IVariable variable = (IVariable) element; IVariableValueEditor editor = VariableValueEditorManager.getDefault().getVariableValueEditor(variable.getModelIdentifier()); - Shell shell = null; - IWorkbenchPart part = fContext.getPart(); - if (part != null) { - shell = part.getSite().getShell(); - } if (value instanceof String) { value = DefaultLabelProvider.encodeEsacpedChars((String)value); } if (editor != null) { - if (editor.saveVariable(variable, (String) value, shell)) { + if (editor.saveVariable(variable, (String) value, DebugUIPlugin.getShell())) { return; } } try { variable.setValue((String) value); } catch (DebugException e) { - DebugUIPlugin.errorDialog(shell, Messages.VariableColumnPresentation_4, Messages.VariableColumnPresentation_5, e.getStatus()); + DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), Messages.VariableColumnPresentation_4, Messages.VariableColumnPresentation_5, e.getStatus()); } } } } } - - /** - * Returns the context in which this cell modifier is being used. - * - * @return presentation context - */ - protected IPresentationContext getPresentationContext() { - return fContext; - } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnEditor.java index 27aaac419..9c42bb683 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnEditor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnEditor.java @@ -43,7 +43,7 @@ public class VariableColumnEditor extends AbstractColumnEditor { */ public ICellModifier getCellModifier() { if (fCellModifier == null) { - fCellModifier = new DefaultVariableCellModifier(getPresentationContext()); + fCellModifier = new DefaultVariableCellModifier(); } return fCellModifier; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableContentAdapter.java index e66053e24..0a526379d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableContentAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableContentAdapter.java @@ -27,7 +27,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.views.variables.IndexedVariablePartition; import org.eclipse.debug.internal.ui.views.variables.VariablesView; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.ui.IWorkbenchPart; public class VariableContentAdapter extends AsynchronousContentAdapter { @@ -175,11 +174,8 @@ public class VariableContentAdapter extends AsynchronousContentAdapter { * in the specified context */ protected boolean isShowLogicalStructure(IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part instanceof VariablesView) { - return ((VariablesView) part).isShowLogicalStructure(); - } - return false; + Boolean show = (Boolean) context.getProperty(VariablesView.PRESENTATION_SHOW_LOGICAL_STRUCTURES); + return show != null && show.booleanValue(); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java index 4e02a4105..0cdb6c1d9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java @@ -14,12 +14,10 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; 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.model.IChildrenCountUpdate; import org.eclipse.debug.internal.ui.model.IChildrenUpdate; import org.eclipse.debug.internal.ui.model.IElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.AsynchronousSchedulingRuleFactory; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; /** @@ -42,7 +40,7 @@ public abstract class ElementContentProvider implements IElementContentProvider } }; job.setSystem(true); - job.setRule(getRetrieveChildRule(update.getParent(), update.getPresentationContext())); // TODO: + // TODO: rule job.schedule(); } @@ -62,29 +60,7 @@ public abstract class ElementContentProvider implements IElementContentProvider // TODO: rule job.schedule(); } - - /** - * Returns the scheduling rule for jobs retrieving children. - * - * @param parent - * @param context - * @return scheduling rule or <code>null</code> - */ - protected ISchedulingRule getRetrieveChildRule(Object parent, IPresentationContext context) { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerPartRule(context); - } - - /** - * Returns the scheduling rule for jobs determining an element's child count. - * - * @param parent - * @param context - * @return scheduling rule or <code>null</code> - */ - protected ISchedulingRule getRetrieveChildCountRule(Object parent, IPresentationContext context) { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerPartRule(context); - } - + /** * Computes the children for the given parent in the specified context. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java index 94e7a57e5..2cc8fcf3f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java @@ -25,7 +25,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.views.variables.IndexedVariablePartition; import org.eclipse.debug.internal.ui.views.variables.VariablesView; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.ui.IWorkbenchPart; /** * @since 3.3 @@ -70,11 +69,8 @@ public class VariableContentProvider extends ElementContentProvider { * in the specified context */ protected boolean isShowLogicalStructure(IPresentationContext context) { - IWorkbenchPart part = context.getPart(); - if (part instanceof VariablesView) { - return ((VariablesView) part).isShowLogicalStructure(); - } - return false; + Boolean show = (Boolean) context.getProperty(VariablesView.PRESENTATION_SHOW_LOGICAL_STRUCTURES); + return show != null && show.booleanValue(); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ModelContentProvider.java index f408c0155..fb032c2c7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ModelContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ModelContentProvider.java @@ -41,7 +41,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IModelProxy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; -import org.eclipse.debug.ui.AbstractDebugView; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TreePath; @@ -49,7 +48,6 @@ import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.ui.IMemento; -import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.XMLMemento; import org.eclipse.ui.progress.UIJob; import org.eclipse.ui.progress.WorkbenchJob; @@ -445,7 +443,7 @@ abstract class ModelContentProvider implements IContentProvider, } proxy .addModelChangedListener(ModelContentProvider.this); - proxy.installed(); + proxy.installed(getViewer()); } return Status.OK_STATUS; } @@ -628,15 +626,6 @@ abstract class ModelContentProvider implements IContentProvider, return fViewer; } - protected void handlePresentationFailure(IAsynchronousRequestMonitor request, IStatus status) { - IWorkbenchPart part = getPresentationContext().getPart(); - if (part instanceof AbstractDebugView) { - AbstractDebugView view = (AbstractDebugView) part; - view.showMessage(status.getMessage()); - } - } - - /** * Translates and returns the given child index from the viewer coordinate * space to the model coordinate space. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ViewerUpdateMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ViewerUpdateMonitor.java index 5b2e8b8f7..d3248f75c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ViewerUpdateMonitor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/viewers/ViewerUpdateMonitor.java @@ -38,9 +38,7 @@ abstract class ViewerUpdateMonitor extends AbstractRequestMonitor implements IPr try { if (!isCanceled() && !getContentProvider().isDisposed()) { IStatus status = getStatus(); - if (status != null && !status.isOK()) { - getContentProvider().handlePresentationFailure(ViewerUpdateMonitor.this, status); - } else { + if (status == null || status.isOK()) { performUpdate(); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java index a59301271..7eca4b6a1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java @@ -190,7 +190,7 @@ public abstract class AsynchronousModel { if (!monitor.isCanceled()) { proxy.init(getPresentationContext()); getViewer().modelProxyAdded(proxy); - proxy.installed(); + proxy.installed(fViewer); } return Status.OK_STATUS; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java index d8c1e421c..5a9218c18 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java @@ -11,7 +11,6 @@ package org.eclipse.debug.internal.ui.viewers; import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; /** * Scheduling rule factory for asycn operations. @@ -97,15 +96,4 @@ public class AsynchronousSchedulingRuleFactory { return new SerialPerObjectRule(lock); } - /** - * Returns a scheduling rule that allows all jobs with an instance of - * the rule to run one at a time per part associated with the given - * presentation context. - * - * @param context presentation context - * @return scheduling rule - */ - public ISchedulingRule newSerialPerPartRule(IPresentationContext context) { - return newSerialPerObjectRule(context.getPart()); - } } 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 020aedcf2..8ade98081 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 @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers; +import java.util.HashMap; +import java.util.Map; + import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; @@ -31,6 +34,7 @@ public class PresentationContext implements IPresentationContext { private String fId; private String[] fColumns; private ListenerList fListeners = new ListenerList(); + private Map fProperties = new HashMap(); /** * Constructs a presentation context for the given part. @@ -129,4 +133,34 @@ public class PresentationContext implements IPresentationContext { return fId; } + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext#getProperty(java.lang.String) + */ + public Object getProperty(String property) { + synchronized (fProperties) { + return fProperties.get(property); + } + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext#setProperty(java.lang.String, java.lang.Object) + */ + public void setProperty(String property, Object value) { + synchronized (fProperties) { + Object oldValue = fProperties.get(property); + if (!isEqual(oldValue, value)) { + fProperties.put(property, value); + firePropertyChange(property, oldValue, value); + } + } + } + + private boolean isEqual(Object a, Object b) { + if (a == null) { + return b == null; + } + return a.equals(b); + } + + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java index 91c611120..9238f8e36 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java @@ -15,6 +15,7 @@ import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.jface.viewers.Viewer; /** * Common function for a model proxy. @@ -26,6 +27,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin; public abstract class AbstractModelProxy implements IModelProxy { private IPresentationContext fContext; + private Viewer fViewer; private ListenerList fListeners = new ListenerList(); @@ -92,6 +94,7 @@ public abstract class AbstractModelProxy implements IModelProxy { */ public synchronized void dispose() { fContext = null; + fViewer = null; } /* (non-Javadoc) @@ -112,11 +115,22 @@ public abstract class AbstractModelProxy implements IModelProxy { } /* (non-Javadoc) + * * Subclasses should override as required. * - * @see org.eclipse.debug.internal.ui.viewers.IModelProxy#installed() + * @see org.eclipse.debug.internal.ui.viewers.provisional.IModelProxy#installed(org.eclipse.jface.viewers.Viewer) + */ + public void installed(Viewer viewer) { + fViewer = viewer; + } + + /** + * Returns the viewer this proxy is installed in. + * + * @return viewer or <code>null</code> if not installed */ - public void installed() { + protected Viewer getViewer() { + return fViewer; } } 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 a66fc45a1..aecd19e21 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 @@ -56,7 +56,7 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent * @return scheduling rule or <code>null</code> */ protected ISchedulingRule getRetrieveChildrenRule(Object parent, IPresentationContext context) { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerPartRule(context); + return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context); } @@ -86,7 +86,7 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent * @return scheduling rule or <code>null</code> */ protected ISchedulingRule getIsContainerRule(Object parent, IPresentationContext context) { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerPartRule(context); + return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java index dfd1a8cf4..50a6baa01 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java @@ -66,7 +66,7 @@ public abstract class AsynchronousLabelAdapter implements IAsynchronousLabelAdap * @return scheduling rule or <code>null</code> */ protected ISchedulingRule getLabelRule(Object element, IPresentationContext context) { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerPartRule(context); + return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IModelProxy.java index b88c7b497..3aef07b97 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IModelProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IModelProxy.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers.provisional; +import org.eclipse.jface.viewers.Viewer; + /** * A model proxy represents a model for a specific presentation context and * fires deltas to notify listeners of changes in the model. A model proxy @@ -46,15 +48,17 @@ public interface IModelProxy { public void init(IPresentationContext context); /** - * Notification this model proxy has been installed in its presentation - * context. This indicates that the model proxy has been created and registered + * Notification this model proxy has been installed in the specified + * viewer. This indicates that the model proxy has been created and registered * model change listeners are ready to process deltas. * <p> * This method is called by the asynchronous viewer framework and should not * be called by clients. * </p> + * @param viewer viewer + * @since 3.3 */ - public void installed(); + public void installed(Viewer viewer); /** * Disposes this model proxy. 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 dc96f3228..8825b2e3b 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 @@ -35,6 +35,7 @@ public interface IPresentationContext { * * @return the part for which a request is being made * or <code>null</code> + * @deprecated to be removed in 3.3 */ public IWorkbenchPart getPart(); @@ -73,4 +74,21 @@ public interface IPresentationContext { */ public String getId(); + /** + * Sets the specified property and notifies listeners of changes. + * + * @param property property name + * @param value property value + */ + public void setProperty(String property, Object value); + + /** + * Returns the property with the specified name or <code>null</code> + * if none. + * + * @param property property name + * @return property value or <code>null</code> + */ + public Object getProperty(String property); + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java index 56fd179d9..a47e896b1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java @@ -19,6 +19,7 @@ import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; +import org.eclipse.jface.viewers.Viewer; /** * Default model proxy for a debug target. @@ -66,9 +67,9 @@ public class DebugTargetProxy extends EventHandlerModelProxy { } /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.AbstractModelProxy#installed() + * @see org.eclipse.debug.internal.ui.viewers.provisional.IModelProxy#installed(org.eclipse.jface.viewers.Viewer) */ - public void installed() { + public void installed(Viewer viewer) { // select any thread that is already suspended after installation IDebugTarget target = fDebugTarget; if (target != null) { 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 c339e2ac7..996ec1602 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 @@ -24,7 +24,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IModelProxy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.ui.IWorkbenchPart; public class DefaultModelProxyFactory implements IModelProxyFactoryAdapter { @@ -51,12 +50,7 @@ public class DefaultModelProxyFactory implements IModelProxyFactoryAdapter { 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()); - } + return new DefaultWatchExpressionModelProxy((IWatchExpression)element); } if (element instanceof IExpression) { return new DefaultExpressionModelProxy((IExpression)element); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java index 43c2f9750..87f84ec94 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java @@ -10,15 +10,23 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers.update; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IWatchExpression; +import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.contexts.DebugContextManager; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.Viewer; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.progress.UIJob; /** * @since 3.2 @@ -28,24 +36,40 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx private IWorkbenchWindow fWindow; - public DefaultWatchExpressionModelProxy(IWatchExpression expression, IWorkbenchWindow window) { + public DefaultWatchExpressionModelProxy(IWatchExpression expression) { super(expression); - fWindow = window; - DebugContextManager.getDefault().addDebugContextListener(this, window); } /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed() + * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) */ - public void installed() { - super.installed(); - IWorkbenchPart part = getPresentationContext().getPart(); - if (part != null) { - ISelection activeContext = DebugContextManager.getDefault().getActiveContext(part.getSite().getWorkbenchWindow()); - if (activeContext != null) { - contextActivated(activeContext, null); + public void installed(final Viewer viewer) { + super.installed(viewer); + UIJob job = new UIJob("install watch expression model proxy") { //$NON-NLS-1$ + public IStatus runInUIThread(IProgressMonitor monitor) { + IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); + for (int i = 0; i < workbenchWindows.length; i++) { + IWorkbenchWindow window = workbenchWindows[i]; + if (viewer.getControl().getShell().equals(window.getShell())) { + fWindow = window; + break; + } + } + if (fWindow == null) { + fWindow = DebugUIPlugin.getActiveWorkbenchWindow(); + } + IDebugContextManager contextManager = DebugContextManager.getDefault(); + contextManager.addDebugContextListener(DefaultWatchExpressionModelProxy.this, fWindow); + ISelection activeContext = contextManager.getActiveContext(fWindow); + if (activeContext != null) { + contextActivated(activeContext, null); + } + return Status.OK_STATUS; } - } + + }; + job.setSystem(true); + job.schedule(); } /* (non-Javadoc) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java index aac1572b8..f868e2473 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java @@ -19,6 +19,7 @@ import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; +import org.eclipse.jface.viewers.Viewer; public class ExpressionManagerModelProxy extends AbstractModelProxy implements IExpressionsListener { @@ -32,9 +33,9 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I } /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed() + * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) */ - public void installed() { + public void installed(Viewer viewer) { updateExpressions(getExpressionManager().getExpressions(), IModelDelta.INSTALL); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java index b7e332e60..eeec9c5c5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java @@ -23,6 +23,7 @@ import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; +import org.eclipse.jface.viewers.Viewer; public class LaunchManagerProxy extends AbstractModelProxy implements ILaunchesListener2 { @@ -43,9 +44,9 @@ public class LaunchManagerProxy extends AbstractModelProxy implements ILaunchesL } /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.AbstractModelProxy#installed() + * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) */ - public void installed() { + public void installed(Viewer viewer) { // expand existing launches ILaunch[] launches = fLaunchManager.getLaunches(); launchesAdded(launches); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java index 808c0588f..432472d0c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java @@ -25,6 +25,8 @@ import org.eclipse.debug.ui.memory.IMemoryRendering; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryBlockListener { private IMemoryBlockRetrieval fRetrieval; @@ -103,18 +105,14 @@ public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryB } } - private IStructuredSelection getCurrentSelection() - { - if (getPresentationContext() == null) - { - return StructuredSelection.EMPTY; + private IStructuredSelection getCurrentSelection() { + Viewer viewer = getViewer(); + if (viewer instanceof StructuredViewer) { + StructuredViewer sv = (StructuredViewer) viewer; + ISelection selection = sv.getSelection(); + if (selection instanceof IStructuredSelection) + return (IStructuredSelection)selection; } - - ISelection selection = getPresentationContext().getPart().getSite().getSelectionProvider().getSelection(); - - if (selection instanceof IStructuredSelection) - return (IStructuredSelection)selection; - return StructuredSelection.EMPTY; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java index 7139168fe..6f2e31712 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java @@ -17,6 +17,7 @@ import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; +import org.eclipse.jface.viewers.Viewer; public class ProcessProxy extends EventHandlerModelProxy { @@ -79,7 +80,8 @@ public class ProcessProxy extends EventHandlerModelProxy { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.AbstractModelProxy#installed() */ - public void installed() { + public void installed(Viewer viewer) { + super.installed(viewer); // select process if in run mode IProcess process = fProcess; if (process != null) { 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 f266369bd..25567a157 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 @@ -423,6 +423,13 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis public static final String LOGICAL_STRUCTURE_TYPE_PREFIX = "VAR_LS_"; //$NON-NLS-1$ /** + * Presentation context property. + * TODO: make API + * @since 3.3 + */ + public static final String PRESENTATION_SHOW_LOGICAL_STRUCTURES = "PRESENTATION_SHOW_LOGICAL_STRUCTURES"; //$NON-NLS-1$ + + /** * the preference name for the view part of the sash form * @since 3.2 */ @@ -459,9 +466,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis private final PositionLabelValue fColumnLabel= new PositionLabelValue(); /** The arguments for the position label pattern. */ private final Object[] fPositionLabelPatternArguments= new Object[] { fLineLabel, fColumnLabel }; - /** Whether logical structures are showing */ - private boolean fShowLogical; - /** * Visits deltas to determine if details should be displayed @@ -1496,18 +1500,23 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis return isAvailable(); } + protected IPresentationContext getPresentationContext() { + return getVariablesViewer().getPresentationContext(); + } + /** * Sets whether logical structures are being displayed */ public void setShowLogicalStructure(boolean flag) { - fShowLogical = flag; + getPresentationContext().setProperty(PRESENTATION_SHOW_LOGICAL_STRUCTURES, Boolean.TRUE); } /** * Returns whether logical structures are being displayed */ public boolean isShowLogicalStructure() { - return fShowLogical; + Boolean show = (Boolean) getPresentationContext().getProperty(PRESENTATION_SHOW_LOGICAL_STRUCTURES); + return show != null && show.booleanValue(); } /** @@ -1645,6 +1654,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis * @see org.eclipse.debug.internal.ui.model.viewers.IViewerUpdateListener#updateComplete(org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) */ public void updateComplete(IAsynchronousRequestMonitor update) { + IStatus status = update.getStatus(); + if (status != null && !(status.getCode() == IStatus.OK || status.getCode() == IStatus.CANCEL)) { + showMessage(status.getMessage()); + } } /* (non-Javadoc) |