Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-10-25 13:51:28 +0000
committerDarin Wright2006-10-25 13:51:28 +0000
commita245ff12d78f21b86b838aa70cf74b0c107ce49a (patch)
treef5aec2982913400becc041595fbf9869241e7eef
parent0948a38dca8777d660bcf25e28f55948876091b9 (diff)
downloadeclipse.platform.debug-a245ff12d78f21b86b838aa70cf74b0c107ce49a.tar.gz
eclipse.platform.debug-a245ff12d78f21b86b838aa70cf74b0c107ce49a.tar.xz
eclipse.platform.debug-a245ff12d78f21b86b838aa70cf74b0c107ce49a.zip
merge with HEAD
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java69
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java10
18 files changed, 84 insertions, 169 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
index bea3d3461..7fa14bec3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
@@ -14,7 +14,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.ISuspendResume;
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.debug.internal.ui.contexts.provisional.IDebugContextService;
import org.eclipse.debug.ui.actions.IRunToLineTarget;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -63,7 +63,7 @@ public class RetargetRunToLineAction extends RetargetAction {
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
- DebugContextManager.getDefault().removeDebugContextListener(fContextListener, fWindow);
+ DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fContextListener);
super.dispose();
}
/* (non-Javadoc)
@@ -71,9 +71,9 @@ public class RetargetRunToLineAction extends RetargetAction {
*/
public void init(IWorkbenchWindow window) {
super.init(window);
- IDebugContextManager manager = DebugContextManager.getDefault();
- manager.addDebugContextListener(fContextListener, window);
- ISelection activeContext = manager.getActiveContext(window);
+ IDebugContextService service = DebugContextManager.getDefault().getContextService(window);
+ service.addDebugContextListener(fContextListener);
+ ISelection activeContext = service.getActiveContext();
fContextListener.contextActivated(activeContext, null);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java
index 26ca932d6..e78c73130 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java
@@ -156,8 +156,9 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
fWindow = window;
fUpdateService = DebugCommandService.getService(fWindow);
IDebugContextManager manager = DebugContextManager.getDefault();
- manager.addDebugContextListener(this, window);
- ISelection activeContext = manager.getActiveContext(window);
+ IDebugContextService contextService = manager.getContextService(window);
+ contextService.addDebugContextListener(this);
+ ISelection activeContext = contextService.getActiveContext();
if (activeContext != null) {
fUpdateService.updateCommand(getCommandType(), new BooleanRequestMonitor(this, 1));
} else {
@@ -181,10 +182,11 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
* @return structured selection
*/
protected ISelection getContext() {
- if (fPart != null) {
- DebugContextManager.getDefault().getContextService(fWindow).getActiveContext(fPart.getSite().getId());
+ IDebugContextService contextService = DebugContextManager.getDefault().getContextService(fWindow);
+ if (fPart != null) {
+ contextService.getActiveContext(fPart.getSite().getId());
}
- return DebugContextManager.getDefault().getActiveContext(fWindow);
+ return contextService.getActiveContext();
}
/*
@@ -218,11 +220,11 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
*/
public void dispose() {
IDebugContextManager manager = DebugContextManager.getDefault();
+ IDebugContextService service = manager.getContextService(fWindow);
if (fPart != null) {
- IDebugContextService service = manager.getContextService(fWindow);
service.removeDebugContextListener(this, fPart.getSite().getId());
} else {
- manager.removeDebugContextListener(this, fWindow);
+ manager.removeDebugContextListener(this);
}
fWindow = null;
fPart = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
index d9b94e94d..dda71e52f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
@@ -20,7 +20,6 @@ import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager;
import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider;
import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService;
import org.eclipse.debug.internal.ui.views.ViewContextManager;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -97,8 +96,6 @@ public class DebugContextManager implements IDebugContextManager {
if (service == null) {
service = new DebugWindowContextService(window);
fServices.put(window, service);
- // TODO: register 'null' provider (global)
-
// register global listeners
Object[] listeners = fGlobalListeners.getListeners();
for (int i = 0; i < listeners.length; i++) {
@@ -126,64 +123,6 @@ public class DebugContextManager implements IDebugContextManager {
}
/* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow)
- */
- public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window) {
- IDebugContextService service = createService(window);
- service.addDebugContextListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow)
- */
- public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window) {
- IDebugContextService service = getService(window);
- if (service != null) {
- service.removeDebugContextListener(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow, java.lang.String)
- */
- public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId) {
- DebugWindowContextService service = createService(window);
- service.addDebugContextListener(listener, partId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow, java.lang.String)
- */
- public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId) {
- IDebugContextService service = getService(window);
- if (service != null) {
- service.removeDebugContextListener(listener, partId);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#getActiveContext(org.eclipse.ui.IWorkbenchWindow)
- */
- public ISelection getActiveContext(IWorkbenchWindow window) {
- IDebugContextService service = getService(window);
- if (service != null) {
- return service.getActiveContext();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#getActiveContext(org.eclipse.ui.IWorkbenchWindow, java.lang.String)
- */
- public ISelection getActiveContext(IWorkbenchWindow window, String partId) {
- IDebugContextService service = getService(window);
- if (service != null) {
- return service.getActiveContext(partId);
- }
- return null;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.internal.ui.contexts.IDebugContextListener)
*/
public void addDebugContextListener(IDebugContextListener listener) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java
index 02f41bcee..b2bdd6c36 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java
@@ -10,23 +10,19 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.contexts.provisional;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * A debug context drives debugging - source lookup and action enablement in the
- * debug user interface. The context service provides notification
- * of changes in the active context specific to the workbench, a specific window, or a
- * specific part.
+ * Manages debug context services. There is a debug context service
+ * for each workbench window. Clients interested in context change
+ * notification for all windows can register with the manager.
* <p>
- * Clients provide a context policy to notify the context service of interesting
- * contexts within a model. For example the debug platform provides a context policy
- * that maps debug events to suspended contexts.
+ * Clients may register debug context providers with the manager.
* </p>
* <p>
* Not intended to be implemented by clients.
* </p>
- * @since 3.2
+ * @since 3.3
*/
public interface IDebugContextManager {
@@ -42,60 +38,7 @@ public interface IDebugContextManager {
*
* @param provider
*/
- public void removeDebugContextProvider(IDebugContextProvider provider);
-
- /**
- * Registers for context activation notification in the given window.
- *
- * @param listener
- * @param window
- */
- public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window);
- /**
- * Unregisters for context activation notification in this service in the
- * given window.
- *
- * @param listener
- * @param window
- */
- public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window);
-
- /**
- * Registers for context activation notification in the specified part of the
- * specified window.
- *
- * @param listener
- * @param window
- * @param partId
- */
- public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId);
-
- /**
- * Unregisters for context activation notification in the specified part of
- * the specified window.
- *
- * @param listener
- * @param partId
- */
- public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId);
-
- /**
- * Returns the active context in the given window
- * or <code>null</code>.
- *
- * @param window
- * @return
- */
- public ISelection getActiveContext(IWorkbenchWindow window);
-
- /**
- * Returns the active context in the specified part of the given
- * window or <code>null</code>.
- *
- * @param partId
- * @return
- */
- public ISelection getActiveContext(IWorkbenchWindow window, String partId);
+ public void removeDebugContextProvider(IDebugContextProvider provider);
/**
* Registers for context activation notification in all windows.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
index c038719e2..3c8da1be5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
@@ -11,6 +11,7 @@
package org.eclipse.debug.internal.ui.model.elements;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.model.IErrorReportingExpression;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue;
@@ -37,4 +38,14 @@ public class ExpressionContentProvider extends VariableContentProvider {
}
return EMPTY;
}
+
+ protected boolean hasChildren(Object element, IPresentationContext context, IProgressMonitor monitor) throws CoreException {
+ if (element instanceof IErrorReportingExpression) {
+ IErrorReportingExpression expression = (IErrorReportingExpression) element;
+ if (expression.hasErrors()) {
+ return true;
+ }
+ }
+ return ((IExpression)element).getValue().hasVariables();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
index b6485c043..5c22be15a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
@@ -31,11 +31,11 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla
public SourceLookupService(IWorkbenchWindow window) {
fWindow = window;
- DebugContextManager.getDefault().addDebugContextListener(this, window);
+ DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this);
}
public void dispose() {
- DebugContextManager.getDefault().removeDebugContextListener(this, fWindow);
+ DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
}
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 87f84ec94..54fa699d8 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
@@ -19,7 +19,7 @@ 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.debug.internal.ui.contexts.provisional.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
@@ -58,9 +58,9 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
if (fWindow == null) {
fWindow = DebugUIPlugin.getActiveWorkbenchWindow();
}
- IDebugContextManager contextManager = DebugContextManager.getDefault();
- contextManager.addDebugContextListener(DefaultWatchExpressionModelProxy.this, fWindow);
- ISelection activeContext = contextManager.getActiveContext(fWindow);
+ IDebugContextService contextService = DebugContextManager.getDefault().getContextService(fWindow);
+ contextService.addDebugContextListener(DefaultWatchExpressionModelProxy.this);
+ ISelection activeContext = contextService.getActiveContext();
if (activeContext != null) {
contextActivated(activeContext, null);
}
@@ -77,7 +77,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
*/
public synchronized void dispose() {
super.dispose();
- DebugContextManager.getDefault().removeDebugContextListener(this, fWindow);
+ DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
fWindow = null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index 0061e484c..c76c83406 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -582,14 +582,14 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
applyUserViewBindings();
loadPerspectives();
window.addPerspectiveListener(this);
- DebugContextManager.getDefault().addDebugContextListener(this, window);
+ DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this);
DebugUIPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(this);
fContextService.addContextManagerListener(this);
}
public void dispose() {
fWindow.removePerspectiveListener(this);
- DebugContextManager.getDefault().removeDebugContextListener(this, fWindow);
+ DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
DebugUIPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this);
fContextService.removeContextManagerListener(this);
}
@@ -670,7 +670,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
applyUserViewBindings();
// clear activations to re-enable activation based on new settings
fPerspectiveToActivatedContexts.clear();
- ISelection selection = DebugContextManager.getDefault().getActiveContext(fWindow);
+ ISelection selection = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext();
contextActivated(selection, null);
}
}
@@ -890,7 +890,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
if (page.getWorkbenchWindow().equals(fWindow)) {
- ISelection activeContext = DebugContextManager.getDefault().getActiveContext(fWindow);
+ ISelection activeContext = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext();
if (activeContext != null) {
contextActivated(activeContext, null);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
index 859ee2f13..fac458559 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
@@ -100,7 +100,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
DebugPlugin.getDefault().addDebugEventListener(this);
- DebugContextManager.getDefault().addDebugContextListener(this, fPage.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
// contribute to toolbar
IActionBars actionBars = fPage.getSite().getActionBars();
@@ -115,7 +115,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
*/
public void dispose() {
deactivated();
- DebugContextManager.getDefault().removeDebugContextListener(this, fPage.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
DebugPlugin.getDefault().removeDebugEventListener(this);
if (fRemoveTerminated != null) {
fRemoveTerminated.dispose();
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 d81eb5b38..08f67a445 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
@@ -14,7 +14,11 @@ package org.eclipse.debug.internal.ui.views.launch;
import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
@@ -91,6 +95,7 @@ import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.IShowInTarget;
import org.eclipse.ui.part.IShowInTargetList;
import org.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.progress.UIJob;
public class LaunchView extends AbstractDebugView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2 {
@@ -195,7 +200,20 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
return;
}
}
- fire(new DebugContextEvent(this, fContext, type));
+ DebugContextEvent event = new DebugContextEvent(this, fContext, type);
+ if (getControl().getDisplay().getThread() == Thread.currentThread()) {
+ fire(event);
+ } else {
+ final DebugContextEvent finalEvent = event;
+ Job job = new UIJob("context change") { //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ fire(finalEvent);
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.schedule();
+ }
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
index c097f52e4..cf6d4325e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
@@ -126,14 +126,14 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
{
MemoryViewUtil.getMemoryBlockManager().addListener(this);
fParent.getViewSite().getPage().addSelectionListener(this);
- DebugContextManager.getDefault().addDebugContextListener(this, fParent.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this);
}
protected void removeListeners()
{
MemoryViewUtil.getMemoryBlockManager().removeListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
- DebugContextManager.getDefault().removeDebugContextListener(this, fParent.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
if (fStackLayout.topControl != null)
{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
index 8236c2473..816127ccd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
@@ -104,7 +104,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION));
// listen for context changed
- DebugContextManager.getDefault().addDebugContextListener(this, site.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this);
// get current context
fCurrentContext = DebugUITools.getDebugContext();
@@ -338,7 +338,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
// remove listeners
DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugContextManager.getDefault().removeDebugContextListener(this, fSite.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
}
private void addDefaultRenderings(IMemoryBlock memoryBlock)
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 5e71c31a7..da057cccf 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
@@ -372,7 +372,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getPage().addSelectionListener(this);
fDebugContextListener = new TreeViewPaneContextListener();
- DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, fParent.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -482,7 +482,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getSelectionProvider().removeSelectionChangedListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
fAddMemoryBlockAction.dispose();
- DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fParent.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
fEvtHandler.dispose();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
index eabf4c4d4..7a5a6a5e2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
@@ -219,7 +219,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
public void init(IViewPart view) {
fView = view;
- DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, fView.getViewSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
DebugPlugin.getDefault().getMemoryBlockManager().addListener(fListener);
updateActionEnablement();
}
@@ -347,7 +347,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
public void dispose() {
fAction = null;
DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fListener);
- DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fView.getViewSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
if (fMenuCreator != null)
fMenuCreator.dispose();
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 1ac103f9b..c5c2b1a08 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
@@ -528,7 +528,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
public void dispose() {
getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem);
- DebugContextManager.getDefault().removeDebugContextListener(this, getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
getSite().getWorkbenchWindow().removePerspectiveListener(this);
DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getFontRegistry().removeListener(this);
@@ -774,7 +774,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
getSite().setSelectionProvider(getVariablesViewSelectionProvider());
// listen to debug context
- DebugContextManager.getDefault().addDebugContextListener(this, getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
return variablesViewer;
}
@@ -1561,7 +1561,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
protected void becomesVisible() {
super.becomesVisible();
- ISelection selection = DebugContextManager.getDefault().getActiveContext(getSite().getWorkbenchWindow());
+ ISelection selection = DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).getActiveContext();
contextActivated(selection, null);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index bcbef008a..46a88d74f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -192,7 +192,7 @@ public class DebugUITools {
public static IAdaptable getDebugContext() {
IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow();
if (activeWindow != null) {
- ISelection activeContext = DebugContextManager.getDefault().getActiveContext(activeWindow);
+ ISelection activeContext = DebugContextManager.getDefault().getContextService(activeWindow).getActiveContext();
if (activeContext instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) activeContext;
if (!selection.isEmpty()) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
index 9467a7226..c7da8dc25 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
@@ -322,12 +322,12 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
if (fWindow != null)
{
- DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fWindow);
+ DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fDebugContextListener);
}
if (window != null)
{
- DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, window);
+ DebugContextManager.getDefault().getContextService(window).addDebugContextListener(fDebugContextListener);
}
fWindow = window;
}
@@ -336,7 +336,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
fPart = part;
if (fWindow != null)
- setupActionDelegate(DebugContextManager.getDefault().getActiveContext(fWindow));
+ setupActionDelegate(DebugContextManager.getDefault().getContextService(fWindow).getActiveContext());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
index 1232c2000..de8ac8552 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
@@ -21,6 +21,7 @@ import org.eclipse.debug.internal.ui.actions.ActionMessages;
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.debug.internal.ui.contexts.provisional.IDebugContextService;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
@@ -89,7 +90,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
* @see org.eclipse.ui.IActionDelegate2#dispose()
*/
public void dispose() {
- DebugContextManager.getDefault().removeDebugContextListener(fContextListener, fActivePart.getSite().getWorkbenchWindow());
+ DebugContextManager.getDefault().getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener);
fActivePart = null;
fPartTarget = null;
@@ -180,13 +181,14 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
private void bindTo(IWorkbenchPart part) {
IDebugContextManager manager = DebugContextManager.getDefault();
if (fActivePart != null && !fActivePart.equals(part)) {
- manager.removeDebugContextListener(fContextListener, fActivePart.getSite().getWorkbenchWindow());
+ manager.getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener);
}
fPartTarget = null;
fActivePart = part;
if (part != null) {
IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow();
- manager.addDebugContextListener(fContextListener, workbenchWindow);
+ IDebugContextService service = manager.getContextService(workbenchWindow);
+ service.addDebugContextListener(fContextListener);
fPartTarget = (IRunToLineTarget) part.getAdapter(IRunToLineTarget.class);
if (fPartTarget == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
@@ -195,7 +197,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
fPartTarget = (IRunToLineTarget) adapterManager.loadAdapter(part, IRunToLineTarget.class.getName());
}
}
- ISelection activeContext = manager.getActiveContext(workbenchWindow);
+ ISelection activeContext = service.getActiveContext();
fContextListener.contextActivated(activeContext, part);
}
update();

Back to the top