Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-10-25 20:31:06 +0000
committerDarin Wright2006-10-25 20:31:06 +0000
commitf9f61d6af94d99aef2defc7b69c8b44c7a4dc95d (patch)
tree0599902aeb800bbf8007312d748b74dd5cc0d38b
parent00524d9ba5dcc8f78800597225f584ab305d0601 (diff)
downloadeclipse.platform.debug-f9f61d6af94d99aef2defc7b69c8b44c7a4dc95d.tar.gz
eclipse.platform.debug-f9f61d6af94d99aef2defc7b69c8b44c7a4dc95d.tar.xz
eclipse.platform.debug-f9f61d6af94d99aef2defc7b69c8b44c7a4dc95d.zip
merge with HEAD
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.debug.ui/component.xml8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java43
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java88
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextListener.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java65
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java105
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISourceDisplayAdapter.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerAdapter.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerListener.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java39
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewUpdatePolicy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java30
38 files changed, 334 insertions, 784 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 683e5ba5a..70d3eef45 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -44,6 +44,7 @@ Export-Package: org.eclipse.debug.internal.ui;x-internal:=true,
org.eclipse.debug.ui,
org.eclipse.debug.ui.actions,
org.eclipse.debug.ui.console,
+ org.eclipse.debug.ui.contexts,
org.eclipse.debug.ui.memory,
org.eclipse.debug.ui.sourcelookup
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
diff --git a/org.eclipse.debug.ui/component.xml b/org.eclipse.debug.ui/component.xml
index 67282f82b..e1068eea7 100644
--- a/org.eclipse.debug.ui/component.xml
+++ b/org.eclipse.debug.ui/component.xml
@@ -76,6 +76,14 @@
<type name="IConsoleLineTracker" />
<type name="IConsoleLineTrackerExtension" />
</package>
+ <package name="org.eclipse.debug.ui.contexts">
+ <type name="AbstractDebugContextProvider" instantiate="false" subclass="true"/>
+ <type name="DebugContextEvent" instantiate="true" subclass="false"/>
+ <type name="IDebugContextListener"/>
+ <type name="IDebugContextManager" implement="false"/>
+ <type name="IDebugContextProvider" />
+ <type name="IDebugContextService" implement="false"/>
+ </package>
<package name="org.eclipse.debug.ui.memory">
<type name="AbstractMemoryRendering" />
<type name="AbstractMemoryRenderingBindingsProvider" />
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 7fa14bec3..a5e87eeda 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
@@ -12,10 +12,11 @@ package org.eclipse.debug.internal.ui.actions;
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.IDebugContextService;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.IRunToLineTarget;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
@@ -28,15 +29,12 @@ import org.eclipse.ui.IWorkbenchWindow;
*/
public class RetargetRunToLineAction extends RetargetAction {
- private IDebugContextListener fContextListener = new DebugContextListener();
+ private DebugContextListener fContextListener = new DebugContextListener();
private ISuspendResume fTargetElement = null;
class DebugContextListener implements IDebugContextListener {
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ protected void contextActivated(ISelection selection) {
fTargetElement = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
@@ -50,20 +48,18 @@ public class RetargetRunToLineAction extends RetargetAction {
update();
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- contextActivated(selection, part);
+ public void debugContextChanged(DebugContextEvent event) {
+ contextActivated(event.getContext());
}
+
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
- DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(fContextListener);
super.dispose();
}
/* (non-Javadoc)
@@ -71,10 +67,10 @@ public class RetargetRunToLineAction extends RetargetAction {
*/
public void init(IWorkbenchWindow window) {
super.init(window);
- IDebugContextService service = DebugContextManager.getDefault().getContextService(window);
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
service.addDebugContextListener(fContextListener);
ISelection activeContext = service.getActiveContext();
- fContextListener.contextActivated(activeContext, null);
+ fContextListener.contextActivated(activeContext);
}
/* (non-Javadoc)
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 e78c73130..60a41c89b 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
@@ -15,11 +15,11 @@ import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand;
-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.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
@@ -109,15 +109,15 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
*/
abstract protected Class getCommandType();
- public void contextActivated(ISelection context, IWorkbenchPart part) {
+ public void update(ISelection context) {
fUpdateService.postUpdateCommand(getCommandType(), new CommandMonitor(this));
- }
+ }
- public void contextChanged(ISelection context, IWorkbenchPart part) {
- contextActivated(context, part);
- }
+ public void debugContextChanged(DebugContextEvent event) {
+ update(event.getContext());
+ }
- /*
+ /*
* (non-Javadoc)
* @see org.eclipse.jface.action.Action#setEnabled(boolean)
*/
@@ -137,7 +137,7 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
fPart = part;
fWindow = part.getSite().getWorkbenchWindow();
fUpdateService = DebugCommandService.getService(fWindow);
- IDebugContextService service = DebugContextManager.getDefault().getContextService(fWindow);
+ IDebugContextService service = getDebugContextService();
String partId = part.getSite().getId();
service.addDebugContextListener(this, partId);
ISelection activeContext = service.getActiveContext(partId);
@@ -155,8 +155,7 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
public void init(IWorkbenchWindow window) {
fWindow = window;
fUpdateService = DebugCommandService.getService(fWindow);
- IDebugContextManager manager = DebugContextManager.getDefault();
- IDebugContextService contextService = manager.getContextService(window);
+ IDebugContextService contextService = getDebugContextService();
contextService.addDebugContextListener(this);
ISelection activeContext = contextService.getActiveContext();
if (activeContext != null) {
@@ -182,11 +181,10 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
* @return structured selection
*/
protected ISelection getContext() {
- IDebugContextService contextService = DebugContextManager.getDefault().getContextService(fWindow);
if (fPart != null) {
- contextService.getActiveContext(fPart.getSite().getId());
+ getDebugContextService().getActiveContext(fPart.getSite().getId());
}
- return contextService.getActiveContext();
+ return getDebugContextService().getActiveContext();
}
/*
@@ -219,16 +217,23 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
* Clean up when removing
*/
public void dispose() {
- IDebugContextManager manager = DebugContextManager.getDefault();
- IDebugContextService service = manager.getContextService(fWindow);
+ IDebugContextService service = getDebugContextService();
if (fPart != null) {
service.removeDebugContextListener(this, fPart.getSite().getId());
} else {
- manager.removeDebugContextListener(this);
+ service.removeDebugContextListener(this);
}
fWindow = null;
fPart = null;
}
+
+ /**
+ * Returns the context service this action linked to.
+ * @return
+ */
+ protected IDebugContextService getDebugContextService() {
+ return DebugUITools.getDebugContextManager().getContextService(fWindow);
+ }
/**
* @return The help context id for this action
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
index 2ef382fe7..161bee38f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
@@ -18,13 +18,13 @@ import java.util.Map.Entry;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
import org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand;
-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.IDebugContextService;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -72,7 +72,7 @@ public class DebugCommandService implements IDebugContextListener {
public DebugCommandService(IWorkbenchWindow window) {
fWindow = window;
- fContextService = DebugContextManager.getDefault().getContextService(window);
+ fContextService = DebugUITools.getDebugContextManager().getContextService(window);
fContextService.addPostDebugContextListener(this);
PlatformUI.getWorkbench().addWindowListener(new IWindowListener() {
@@ -189,17 +189,9 @@ public class DebugCommandService implements IDebugContextListener {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
- postUpdate(selection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- postUpdate(selection);
+ public void debugContextChanged(DebugContextEvent event) {
+ postUpdate(event.getContext());
}
+
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
index 146967d45..b16a5c134 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
@@ -19,10 +19,10 @@ import org.eclipse.debug.internal.ui.actions.RelaunchActionDelegate;
import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
/**
* Action which terminates a launch and then re-launches it.
@@ -59,7 +59,8 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
return ITerminateCommand.class;
}
- public void contextActivated(ISelection context, IWorkbenchPart part) {
+ public void debugContextChanged(DebugContextEvent event) {
+ ISelection context = event.getContext();
if (context instanceof IStructuredSelection) {
Object[] elements = ((IStructuredSelection)context).toArray();
for (int i = 0; i < elements.length; i++) {
@@ -69,7 +70,7 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
}
}
}
- super.contextActivated(context, part);
+ super.debugContextChanged(event);
}
protected boolean canRelaunch(Object element) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
index 85de71dea..7a663527c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
@@ -15,9 +15,9 @@ import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.internal.ui.commands.provisional.IStepFiltersCommand;
import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
public class ToggleStepFiltersAction extends DebugCommandAction {
@@ -65,14 +65,12 @@ public class ToggleStepFiltersAction extends DebugCommandAction {
return AS_CHECK_BOX;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.IDebugContextService)
- */
- public void contextActivated(ISelection context, IWorkbenchPart part) {
+ public void debugContextChanged(DebugContextEvent event) {
+ ISelection context = event.getContext();
if (context.isEmpty()) {
setEnabled(true);
} else {
- super.contextActivated(context, part);
+ super.debugContextChanged(event);
}
}
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 dda71e52f..17b602b09 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
@@ -15,13 +15,11 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.ListenerList;
-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.IDebugContextProvider;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService;
import org.eclipse.debug.internal.ui.views.ViewContextManager;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextManager;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -80,16 +78,6 @@ public class DebugContextManager implements IDebugContextManager {
}
return fgDefault;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#addDebugContextProvider(org.eclipse.debug.ui.contexts.IDebugContextProvider)
- */
- public void addDebugContextProvider(IDebugContextProvider provider) {
- IWorkbenchPart part = provider.getPart();
- IWorkbenchWindow window = part.getSite().getWorkbenchWindow();
- DebugWindowContextService service = createService(window);
- service.addProvider(provider);
- }
protected DebugWindowContextService createService(IWorkbenchWindow window) {
DebugWindowContextService service = (DebugWindowContextService) fServices.get(window);
@@ -111,18 +99,6 @@ public class DebugContextManager implements IDebugContextManager {
}
/* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextManager#removeDebugContextProvider(org.eclipse.debug.ui.contexts.IDebugContextProvider)
- */
- public void removeDebugContextProvider(IDebugContextProvider provider) {
- IWorkbenchPart part = provider.getPart();
- IWorkbenchWindow window = part.getSite().getWorkbenchWindow();
- DebugWindowContextService service = (DebugWindowContextService) fServices.get(window);
- if (service != null) {
- service.removeProvider(provider);
- }
- }
-
- /* (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/DebugModelContextBindingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
index 464c05f38..9383bc576 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
@@ -33,10 +33,11 @@ import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugModelProvider;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.ActivityManagerEvent;
import org.eclipse.ui.activities.IActivity;
@@ -119,7 +120,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
loadDebugModelContextBindings();
loadDebugModelActivityExtensions();
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- DebugContextManager.getDefault().addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().addDebugContextListener(this);
IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
activitySupport.getActivityManager().addActivityManagerListener(this);
}
@@ -172,15 +173,15 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Iterator iterator = ss.iterator();
- while (iterator.hasNext()) {
- activated(iterator.next());
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ ISelection selection = event.getContext();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Iterator iterator = ss.iterator();
+ while (iterator.hasNext()) {
+ activated(iterator.next());
+ }
}
}
}
@@ -277,12 +278,6 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
activations.add(activation);
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- }
-
/**
* Returns the debug model identifiers associated with the given object or <code>null</code>
* if none.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index 19781ca16..7749c2269 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -19,11 +19,10 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextProvider;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IPartListener2;
@@ -37,7 +36,7 @@ import org.eclipse.ui.IWorkbenchWindow;
*
* @since 3.2
*/
-public class DebugWindowContextService implements IDebugContextService, IPartListener2, IDebugContextEventListener {
+public class DebugWindowContextService implements IDebugContextService, IPartListener2, IDebugContextListener {
private Map fListenersByPartId = new HashMap();
private Map fProvidersByPartId = new HashMap();
@@ -56,7 +55,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
fWindow = null;
}
- protected synchronized void addProvider(IDebugContextProvider provider) {
+ public synchronized void addDebugContextProvider(IDebugContextProvider provider) {
IWorkbenchPart part = provider.getPart();
String id = null;
if (part != null) {
@@ -70,12 +69,12 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
active = activePage.getActivePart();
}
if (fProviders.size() == 1 && (part == null || part.equals(active))) {
- notify(DebugContextEvent.ACTIVATED);
+ notify(provider);
}
- provider.addDebugContextEventListener(this);
+ provider.addDebugContextListener(this);
}
- protected synchronized void removeProvider(IDebugContextProvider provider) {
+ public synchronized void removeDebugContextProvider(IDebugContextProvider provider) {
int index = fProviders.indexOf(provider);
if (index >= 0) {
IWorkbenchPart part = provider.getPart();
@@ -86,10 +85,15 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
fProvidersByPartId.remove(id);
fProviders.remove(index);
if (index == 0) {
- notify(DebugContextEvent.ACTIVATED);
+ IDebugContextProvider activeProvider = getActiveProvider();
+ if (activeProvider != null) {
+ notify(activeProvider);
+ } else {
+ notify(new DebugContextEvent(provider, new StructuredSelection(), DebugContextEvent.ACTIVATED));
+ }
}
}
- provider.removeDebugContextEventListener(this);
+ provider.removeDebugContextListener(this);
}
/* (non-Javadoc)
@@ -130,38 +134,39 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
removeDebugContextListener(listener, null);
}
- protected void notify(int type) {
- if (fProviders.isEmpty()) {
- notify(type, new StructuredSelection(), null);
- } else {
- IDebugContextProvider provider = (IDebugContextProvider) fProviders.get(0);
- notify(type, provider.getActiveContext(), provider.getPart());
+ /**
+ * Notifies listeners of the context in the specified provider.
+ *
+ * @param provdier context provider
+ */
+ protected void notify(IDebugContextProvider provdier) {
+ ISelection activeContext = provdier.getActiveContext();
+ if (activeContext == null) {
+ activeContext = new StructuredSelection();
}
+ notify(new DebugContextEvent(provdier, activeContext, DebugContextEvent.ACTIVATED));
}
- protected void notify(int type, ISelection context, IWorkbenchPart part) {
- notify(type, getListeners(null), context, part);
+ protected void notify(DebugContextEvent event) {
+ notify(event, getListeners(null));
+ IWorkbenchPart part = event.getDebugContextProvider().getPart();
if (part != null) {
- notify(type, getListeners(part), context, part);
+ notify(event, getListeners(part));
}
- notify(type, getPostListeners(null), context, part);
+ notify(event, getPostListeners(null));
if (part != null) {
- notify(type, getPostListeners(part), context, part);
+ notify(event, getPostListeners(part));
}
}
- protected void notify(final int type, ListenerList list, final ISelection context, final IWorkbenchPart part) {
+ protected void notify(final DebugContextEvent event, ListenerList list) {
if (list != null) {
Object[] listeners = list.getListeners();
for (int i = 0; i < listeners.length; i++) {
final IDebugContextListener listener = (IDebugContextListener) listeners[i];
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
- if (type == DebugContextEvent.ACTIVATED) {
- listener.contextActivated(context, part);
- } else {
- listener.contextChanged(context, part);
- }
+ listener.debugContextChanged(event);
}
public void handleException(Throwable exception) {
DebugUIPlugin.log(exception);
@@ -224,8 +229,21 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
* @see org.eclipse.debug.ui.contexts.IDebugContextService#getActiveContext()
*/
public ISelection getActiveContext() {
+ IDebugContextProvider activeProvider = getActiveProvider();
+ if (activeProvider != null) {
+ return activeProvider.getActiveContext();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the active provider or <code>null</code>
+ *
+ * @return active provider or <code>null</code>
+ */
+ protected IDebugContextProvider getActiveProvider() {
if (!fProviders.isEmpty()) {
- return ((IDebugContextProvider)fProviders.get(0)).getActiveContext();
+ return (IDebugContextProvider)fProviders.get(0);
}
return null;
}
@@ -234,13 +252,13 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
* @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
*/
public void partActivated(IWorkbenchPartReference partRef) {
- Object provider = fProvidersByPartId.get(partRef.getId());
+ IDebugContextProvider provider = (IDebugContextProvider) fProvidersByPartId.get(partRef.getId());
if (provider != null) {
int index = fProviders.indexOf(provider);
if (index > 0) {
fProviders.remove(index);
fProviders.add(0, provider);
- notify(DebugContextEvent.ACTIVATED);
+ notify(provider);
}
}
@@ -291,11 +309,11 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
*/
- public void contextEvent(DebugContextEvent event) {
+ public void debugContextChanged(DebugContextEvent event) {
if (!fProviders.isEmpty()) {
IDebugContextProvider provider = (IDebugContextProvider) fProviders.get(0);
if (provider == event.getDebugContextProvider()) {
- notify(event.getEventType());
+ notify(event);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java
deleted file mode 100644
index 5370af0ad..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Abstract implementation of a debug context provider.
- * <p>
- * Clients implementing context providers should subclass this class.
- * </p>
- * @since 3.3
- */
-public abstract class AbstractDebugContextProvider implements IDebugContextProvider {
-
- /**
- * Event listeners
- */
- private ListenerList fListeners = new ListenerList();
-
- /**
- * Part or <code>null</code>
- */
- private IWorkbenchPart fPart;
-
- /**
- * Constructs a context provider for the specified part, possibly <code>null</code>.
- *
- * @param part workbench part or <code>null</code>
- */
- public AbstractDebugContextProvider(IWorkbenchPart part) {
- fPart = part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#addDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener)
- */
- public void addDebugContextEventListener(IDebugContextEventListener listener) {
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#getPart()
- */
- public IWorkbenchPart getPart() {
- return fPart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#removeDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener)
- */
- public void removeDebugContextEventListener(IDebugContextEventListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Fires the given context event to all listeners.
- *
- * @param event debug context event
- */
- protected void fire(final DebugContextEvent event) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IDebugContextEventListener listener = (IDebugContextEventListener) listeners[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- listener.contextEvent(event);
- }
- public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
- });
-
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java
deleted file mode 100644
index a1ebea685..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * A debug context event.
- *
- * @since 3.3
- */
-public class DebugContextEvent extends EventObject {
-
- /**
- * The context
- */
- private ISelection fContext;
-
- /**
- * Type of context event - change or activation
- */
- private int fEventType;
-
- /**
- * Context activation event type.
- */
- public static final int ACTIVATED = 1;
-
- /**
- * Context change event type.
- */
- public static final int CHANGED = 2;
-
- /**
- * Generated serial version UID for this class.
- */
- private static final long serialVersionUID = 3395172504615255524L;
-
- /**
- * @param source
- */
- public DebugContextEvent(IDebugContextProvider source, ISelection context, int eventType) {
- super(source);
- fContext = context;
- fEventType = eventType;
- }
-
- /**
- * Returns the context associated with this event.
- *
- * @return
- */
- public ISelection getContext() {
- return fContext;
- }
-
- /**
- * Returns the event type.
- *
- * @return event type
- */
- public int getEventType() {
- return fEventType;
- }
-
- /**
- * Returns the context provider that initiated this event.
- *
- * @return context provider
- */
- public IDebugContextProvider getDebugContextProvider() {
- return (IDebugContextProvider) getSource();
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java
deleted file mode 100644
index a5238fdee..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-
-/**
- * Notified of context events by a debug context provider.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @since 3.3
- * @see IDebugContextManager
- */
-public interface IDebugContextEventListener {
-
- /**
- * Notification of the specified debug context event.
- *
- * @param event debug context event
- */
- public void contextEvent(DebugContextEvent event);
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextListener.java
deleted file mode 100644
index 8945554c6..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Notified of context activation and when the active context changes state.
- * Listeners register with the debug context manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.2
- * @see IDebugContextManager
- */
-public interface IDebugContextListener {
-
- /**
- * Notification the given selection contains the active context in the
- * specified part.
- *
- * @param selection selection containing active context
- * @param part workbench part or <code>null</code>
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part);
-
- /**
- * Notification the context in the given selection has changed state
- * in the specified part. Context changes are only sent for contexts
- * that are active.
- *
- * @param selection selection containing changed context
- * @param part workbench part or <code>null</code>
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part);
-
-}
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
deleted file mode 100644
index b2bdd6c36..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * 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 may register debug context providers with the manager.
- * </p>
- * <p>
- * Not intended to be implemented by clients.
- * </p>
- * @since 3.3
- */
-public interface IDebugContextManager {
-
- /**
- * Registers the given debug context provider.
- *
- * @param provider
- */
- public void addDebugContextProvider(IDebugContextProvider provider);
-
- /**
- * Unregisters the given debug context provider.
- *
- * @param provider
- */
- public void removeDebugContextProvider(IDebugContextProvider provider);
-
- /**
- * Registers for context activation notification in all windows.
- *
- * @param listener
- */
- public void addDebugContextListener(IDebugContextListener listener);
-
- /**
- * Unregisters for context activation notification in all windows.
- *
- * @param listener
- */
- public void removeDebugContextListener(IDebugContextListener listener);
-
- /**
- * Returns the context service for the specified window.
- *
- * @param window
- * @return context service
- * @since 3.3
- */
- public IDebugContextService getContextService(IWorkbenchWindow window);
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java
deleted file mode 100644
index b47a43653..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Provides debug context context information for a part.
- * Provides change notification as the active context is changed,
- * or as the active context changes state.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.2
- */
-public interface IDebugContextProvider {
-
- /**
- * Returns the part associated with this provider.
- *
- * @return the part for which active context information is being provided
- */
- public IWorkbenchPart getPart();
-
- /**
- * Registers the given listener for context events.
- *
- * @param listener event listener
- */
- public void addDebugContextEventListener(IDebugContextEventListener listener);
-
- /**
- * Unregisters the given listener for context events.
- *
- * @param listener event listener
- */
- public void removeDebugContextEventListener(IDebugContextEventListener listener);
-
- /**
- * Returns the currently active context, possibly empty or <code>null</code>.
- *
- * @return active context, possibly empty or <code>null</code>.
- */
- public ISelection getActiveContext();
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java
deleted file mode 100644
index a7d7a4706..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.contexts.provisional;
-
-import org.eclipse.jface.viewers.ISelection;
-
-
-/**
- * Debug context service for a window.
- *
- * @since 3.2
- */
-public interface IDebugContextService {
-
- /**
- * Registers for context activation notification in this service.
- *
- * @param listener
- */
- public void addDebugContextListener(IDebugContextListener listener);
- /**
- * Unregisters for context activation notification in this service.
- *
- * @param listener
- */
- public void removeDebugContextListener(IDebugContextListener listener);
-
- /**
- * Registers for context activation notification in the specified part.
- *
- * @param listener
- * @param partId
- */
- public void addDebugContextListener(IDebugContextListener listener, String partId);
-
- /**
- * Unregisters for context activation notification in the specified part.
- *
- * @param listener
- * @param partId
- */
- public void removeDebugContextListener(IDebugContextListener listener, String partId);
-
- /**
- * Returns the active context in this service's window
- * or <code>null</code>.
- *
- * @return
- */
- public ISelection getActiveContext();
-
- /**
- * Returns the active context in the specified part or <code>null</code>.
- *
- * @param partId
- * @return
- */
- public ISelection getActiveContext(String partId);
-
- /**
- * Registers for post context notification. Post listeners
- * are notified of context activation and change after all
- * non-post listeners are notified.
- *
- * @param listener
- * @since 3.3
- */
- public void addPostDebugContextListener(IDebugContextListener listener);
- /**
- * Unregisters for post context notification.
- *
- * @param listener
- * @since 3.3
- */
- public void removePostDebugContextListener(IDebugContextListener listener);
-
- /**
- * Registers for post context notification in the specified part. Post listeners
- * are notified of context activation and change after all
- * non-post listeners are notified.
- *
- * @param listener
- * @param partId
- * @since 3.3
- */
- public void addPostDebugContextListener(IDebugContextListener listener, String partId);
-
- /**
- * Unregisters for post context notification in the specified part.
- *
- * @param listener
- * @param partId
- * @since 3.3
- */
- public void removePostDebugContextListener(IDebugContextListener listener, String partId);
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISourceDisplayAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISourceDisplayAdapter.java
index b77c3272d..84f015745 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISourceDisplayAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISourceDisplayAdapter.java
@@ -16,7 +16,13 @@ import org.eclipse.ui.IWorkbenchPage;
* An adapter that is capable of displaying source for an object.
* The adapter is obtained from an object in a debug context.
*
- * @since 3.2
+ * @since 3.3
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
*/
public interface ISourceDisplayAdapter {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerAdapter.java
index f26aa949a..c693a142b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerAdapter.java
@@ -24,7 +24,13 @@ package org.eclipse.debug.internal.ui.contexts.provisional;
* <p>
* Clients may implement this interface.
* </p>
- * @since 3.2
+ * @since 3.3
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
*/
public interface ISuspendTriggerAdapter {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerListener.java
index d60be9364..4f4c3d607 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/ISuspendTriggerListener.java
@@ -18,7 +18,13 @@ import org.eclipse.debug.core.ILaunch;
* <p>
* Clients may implement this interface.
* </p>
- * @since 3.2
+ * @since 3.3
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
*/
public interface ISuspendTriggerListener {
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 3c8da1be5..f78a5f3b6 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
@@ -46,6 +46,10 @@ public class ExpressionContentProvider extends VariableContentProvider {
return true;
}
}
- return ((IExpression)element).getValue().hasVariables();
+ IValue value = ((IExpression)element).getValue();
+ if (value == null) {
+ return false;
+ }
+ return value.hasVariables();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
index a4b4cd962..fe2f1bafc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
@@ -42,4 +42,10 @@ public class ExpressionManagerContentProvider extends ElementContentProvider {
return id.equals(IDebugUIConstants.ID_EXPRESSION_VIEW);
}
+ protected boolean hasChildren(Object element, IPresentationContext context, IProgressMonitor monitor) throws CoreException {
+ return ((IExpressionManager)element).hasExpressions();
+ }
+
+
+
}
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 5c22be15a..e8f40ca48 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
@@ -11,9 +11,10 @@
package org.eclipse.debug.internal.ui.sourcelookup;
import org.eclipse.core.runtime.IAdaptable;
-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.ISourceDisplayAdapter;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
@@ -31,27 +32,19 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla
public SourceLookupService(IWorkbenchWindow window) {
fWindow = window;
- DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(this);
}
public void dispose() {
- DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(this);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextActivated(java.lang.Object, org.eclipse.ui.IWorkbenchPart)
- */
- public synchronized void contextActivated(ISelection selection, IWorkbenchPart part) {
- displaySource(selection, part, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ public synchronized void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ displaySource(event.getContext(), event.getDebugContextProvider().getPart(), false);
+ }
}
-
+
/**
* Displays source for the given selection and part, optionally forcing
* a source lookup.
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 54fa699d8..e2fade18f 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
@@ -17,13 +17,13 @@ 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.IDebugContextService;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
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;
@@ -58,11 +58,11 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
if (fWindow == null) {
fWindow = DebugUIPlugin.getActiveWorkbenchWindow();
}
- IDebugContextService contextService = DebugContextManager.getDefault().getContextService(fWindow);
+ IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
contextService.addDebugContextListener(DefaultWatchExpressionModelProxy.this);
ISelection activeContext = contextService.getActiveContext();
if (activeContext != null) {
- contextActivated(activeContext, null);
+ contextActivated(activeContext);
}
return Status.OK_STATUS;
}
@@ -77,7 +77,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
*/
public synchronized void dispose() {
super.dispose();
- DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(this);
fWindow = null;
}
@@ -88,10 +88,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
return new DebugEventHandler[]{new ExpressionEventHandler(this)};
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ protected void contextActivated(ISelection selection) {
if (fWindow != null) {
if (selection instanceof IStructuredSelection) {
IDebugElement context = null;
@@ -108,11 +105,11 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
}
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- }
+
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ contextActivated(event.getContext());
+ }
+ }
}
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 c76c83406..4392f320d 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
@@ -36,11 +36,12 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
import org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IPerspectiveDescriptor;
@@ -48,7 +49,6 @@ import org.eclipse.ui.IPerspectiveListener4;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
@@ -569,6 +569,10 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
}
}
+
+ private IDebugContextService getDebugContextService() {
+ return DebugUITools.getDebugContextManager().getContextService(fWindow);
+ }
/**
* Creates a service for the given window
@@ -582,14 +586,14 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
applyUserViewBindings();
loadPerspectives();
window.addPerspectiveListener(this);
- DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this);
+ getDebugContextService().addDebugContextListener(this);
DebugUIPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(this);
fContextService.addContextManagerListener(this);
}
public void dispose() {
fWindow.removePerspectiveListener(this);
- DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this);
+ getDebugContextService().removeDebugContextListener(this);
DebugUIPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this);
fContextService.removeContextManagerListener(this);
}
@@ -670,8 +674,8 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
applyUserViewBindings();
// clear activations to re-enable activation based on new settings
fPerspectiveToActivatedContexts.clear();
- ISelection selection = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext();
- contextActivated(selection, null);
+ ISelection selection = getDebugContextService().getActiveContext();
+ contextActivated(selection);
}
}
}
@@ -715,12 +719,9 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
list.add(token);
}
return list;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ }
+
+ public void contextActivated(ISelection selection) {
if (isEnabledPerspective()) {
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
IStructuredSelection ss = (IStructuredSelection) selection;
@@ -820,10 +821,10 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ contextActivated(event.getContext());
+ }
}
/* (non-Javadoc)
@@ -890,9 +891,9 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
if (page.getWorkbenchWindow().equals(fWindow)) {
- ISelection activeContext = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext();
+ ISelection activeContext = getDebugContextService().getActiveContext();
if (activeContext != null) {
- contextActivated(activeContext, null);
+ contextActivated(activeContext);
}
}
}
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 fac458559..3d49588de 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
@@ -22,16 +22,15 @@ import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.debug.core.model.IStreamsProxy2;
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.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
@@ -100,7 +99,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
DebugPlugin.getDefault().addDebugEventListener(this);
- DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
// contribute to toolbar
IActionBars actionBars = fPage.getSite().getActionBars();
@@ -115,7 +114,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
*/
public void dispose() {
deactivated();
- DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
DebugPlugin.getDefault().removeDebugEventListener(this);
if (fRemoveTerminated != null) {
fRemoveTerminated.dispose();
@@ -209,21 +208,6 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
return fConsole != null ? fConsole.getProcess() : null;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
- if (fView != null && getProcess().equals(DebugUITools.getCurrentProcess())) {
- fView.display(fConsole);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- }
-
/* (non-Javadoc)
* @see org.eclipse.ui.console.IConsolePageParticipant#activated()
*/
@@ -247,4 +231,16 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
handlerService.deactivateHandler(fActivatedHandler);
contextService.deactivateContext(fActivatedContext);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
+ */
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ if (fView != null && getProcess().equals(DebugUITools.getCurrentProcess())) {
+ fView.display(fConsole);
+ }
+ }
+
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
index 647e1b008..f5210e4d2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
@@ -28,7 +28,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
/**
* Displays expressions and their values with a detail
@@ -81,8 +80,8 @@ public class ExpressionView extends VariablesView {
menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
-
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+
+ protected void contextActivated(ISelection selection) {
if (!isVisible()) {
return;
}
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 08f67a445..b11dfc4fb 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
@@ -46,9 +46,6 @@ import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRelaunchAction
import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRemoveAction;
import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction;
import org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersAction;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.AbstractDebugContextProvider;
-import org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent;
import org.eclipse.debug.internal.ui.sourcelookup.EditSourceLookupPathAction;
import org.eclipse.debug.internal.ui.sourcelookup.LookupSourceAction;
import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer;
@@ -59,8 +56,11 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -152,7 +152,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
if ((delta.getFlags() & IModelDelta.STATE) > 0) {
if ((delta.getFlags() & (IModelDelta.CONTENT | IModelDelta.SELECT)) == 0) {
// state change without content/select - possible state change of active context
- possibleChange(element, DebugContextEvent.CHANGED);
+ possibleChange(element, DebugContextEvent.STATE);
}
} else if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
if ((delta.getFlags() & IModelDelta.SELECT) == 0) {
@@ -308,7 +308,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
viewer.setInput(DebugPlugin.getDefault().getLaunchManager());
//setEventHandler(new LaunchViewEventHandler(this));
fProvider = new ContextProvider(viewer);
- DebugContextManager.getDefault().addDebugContextProvider(fProvider);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fProvider);
return viewer;
}
@@ -443,7 +443,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
public void dispose() {
- DebugContextManager.getDefault().removeDebugContextProvider(fProvider);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextProvider(fProvider);
disposeActions();
fProvider.dispose();
Viewer viewer = getViewer();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewUpdatePolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewUpdatePolicy.java
index 65a22bdcc..e35dcf65a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewUpdatePolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewUpdatePolicy.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.launch;
-import org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent;
import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer;
import org.eclipse.debug.internal.ui.viewers.TreeUpdatePolicy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
/**
* @since 3.2
@@ -42,7 +42,7 @@ public class LaunchViewUpdatePolicy extends TreeUpdatePolicy {
super.handleState(viewer, delta);
if ((delta.getFlags() & (IModelDelta.CONTENT | IModelDelta.SELECT)) == 0) {
// a state change without content or selection is a possible context change
- fView.possibleContextChange(delta.getElement(), DebugContextEvent.CHANGED);
+ fView.possibleContextChange(delta.getElement(), DebugContextEvent.STATE);
}
}
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 cf6d4325e..6b28317d9 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
@@ -18,9 +18,8 @@ import org.eclipse.debug.core.IMemoryBlockListener;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
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.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -126,14 +125,14 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
{
MemoryViewUtil.getMemoryBlockManager().addListener(this);
fParent.getViewSite().getPage().addSelectionListener(this);
- DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this);
}
protected void removeListeners()
{
MemoryViewUtil.getMemoryBlockManager().removeListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
- DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().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 816127ccd..b713e9f7f 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
@@ -36,19 +36,17 @@ import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPart;
/**
@@ -104,7 +102,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION));
// listen for context changed
- DebugContextManager.getDefault().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this);
// get current context
fCurrentContext = DebugUITools.getDebugContext();
@@ -338,7 +336,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
// remove listeners
DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugContextManager.getDefault().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
}
private void addDefaultRenderings(IMemoryBlock memoryBlock)
@@ -408,12 +406,14 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
job.schedule();
}
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
- IAdaptable context = DebugUITools.getDebugContext();
- updateAction(context);
- fCurrentContext = context;
- }
-
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
+ */
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ IAdaptable context = DebugUITools.getDebugContext();
+ updateAction(context);
+ fCurrentContext = context;
+ }
}
}
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 da057cccf..f53b8b3c1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
@@ -32,13 +32,13 @@ import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer;
import org.eclipse.debug.internal.ui.views.variables.ViewerState;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
@@ -289,7 +289,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
class TreeViewPaneContextListener implements IDebugContextListener
{
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ public void contextActivated(ISelection selection) {
if (selection.isEmpty() && fRetrieval != null)
{
@@ -342,11 +342,16 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
}
}
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
+ */
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ contextActivated(event.getContext());
+ }
}
}
-
public MemoryBlocksTreeViewPane(IViewPart parent)
{
fParent = parent;
@@ -372,7 +377,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getPage().addSelectionListener(this);
fDebugContextListener = new TreeViewPaneContextListener();
- DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -482,7 +487,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getSelectionProvider().removeSelectionChangedListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
fAddMemoryBlockAction.dispose();
- DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
fEvtHandler.dispose();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
index 952aff35f..26619c293 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
@@ -30,6 +30,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.views.memory.renderings.CreateRendering;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
@@ -1193,7 +1194,7 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
return fIsDisposed;
}
- public void contextActivated(final ISelection selection, IWorkbenchPart part) {
+ public void contextActivated(final ISelection selection) {
UIJob job = new UIJob("contextActivated"){ //$NON-NLS-1$
public IStatus runInUIThread(IProgressMonitor monitor)
@@ -1230,9 +1231,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
job.schedule();
}
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- }
-
/**
* @param memory
*/
@@ -1256,4 +1254,14 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
return folder;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
+ */
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ contextActivated(event.getContext());
+ }
+
+ }
}
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 7a5a6a5e2..903049226 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
@@ -23,10 +23,10 @@ import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer;
import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
@@ -42,7 +42,6 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.progress.WorkbenchJob;
public class SwitchMemoryBlockAction extends Action implements IViewActionDelegate, IActionDelegate2 {
@@ -63,13 +62,11 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ public void debugContextChanged(DebugContextEvent event) {
updateActionEnablement();
}
-
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- updateActionEnablement();
- }};
+
+ };
/**
* Switch tab folder for fMemoryBlock to the top in Memory Rendering View
@@ -219,7 +216,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
public void init(IViewPart view) {
fView = view;
- DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fView.getViewSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
DebugPlugin.getDefault().getMemoryBlockManager().addListener(fListener);
updateActionEnablement();
}
@@ -347,7 +344,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
public void dispose() {
fAction = null;
DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fListener);
- DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().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 c5c2b1a08..677038569 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
@@ -47,8 +47,6 @@ import org.eclipse.debug.internal.ui.actions.variables.AssignValueAction;
import org.eclipse.debug.internal.ui.actions.variables.ChangeVariableValueAction;
import org.eclipse.debug.internal.ui.actions.variables.ShowTypesAction;
import org.eclipse.debug.internal.ui.actions.variables.ToggleDetailPaneAction;
-import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
-import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
@@ -60,10 +58,13 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMon
import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
import org.eclipse.debug.internal.ui.views.IDebugExceptionHandler;
import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
@@ -528,7 +529,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
public void dispose() {
getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem);
- DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
getSite().getWorkbenchWindow().removePerspectiveListener(this);
DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getFontRegistry().removeListener(this);
@@ -774,7 +775,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
getSite().setSelectionProvider(getVariablesViewSelectionProvider());
// listen to debug context
- DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
return variablesViewer;
}
@@ -1420,10 +1421,13 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return fSelectionProvider;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextActivated(java.lang.Object, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ public void debugContextChanged(DebugContextEvent event) {
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
+ contextActivated(event.getContext());
+ }
+ }
+
+ protected void contextActivated(ISelection selection) {
if (!isAvailable() || !isVisible()) {
return;
}
@@ -1438,12 +1442,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
updateAction(FIND_ACTION);
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- }
-
/**
* Delegate to the <code>DOUBLE_CLICK_ACTION</code>,
* if any.
@@ -1561,8 +1559,8 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
protected void becomesVisible() {
super.becomesVisible();
- ISelection selection = DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).getActiveContext();
- contextActivated(selection, null);
+ ISelection selection = DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).getActiveContext();
+ contextActivated(selection);
}
protected TreeModelViewer getVariablesViewer() {
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 46a88d74f..3d0c775cd 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
@@ -44,6 +44,7 @@ import org.eclipse.debug.internal.ui.memory.MemoryRenderingManager;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIUtils;
import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager;
+import org.eclipse.debug.ui.contexts.IDebugContextManager;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.sourcelookup.ISourceContainerBrowser;
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
@@ -192,7 +193,7 @@ public class DebugUITools {
public static IAdaptable getDebugContext() {
IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow();
if (activeWindow != null) {
- ISelection activeContext = DebugContextManager.getDefault().getContextService(activeWindow).getActiveContext();
+ ISelection activeContext = DebugUITools.getDebugContextManager().getContextService(activeWindow).getActiveContext();
if (activeContext instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) activeContext;
if (!selection.isEmpty()) {
@@ -800,4 +801,20 @@ public class DebugUITools {
public static Color getPreferenceColor(String id) {
return DebugUIPlugin.getPreferenceColor(id);
}
+
+ /**
+ * Returns the debug context manager.
+ *
+ * @return debug context manager
+ * @since 3.3
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This method has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
+ */
+ public static IDebugContextManager getDebugContextManager() {
+ return DebugContextManager.getDefault();
+ }
}
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 c7da8dc25..aa406960d 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
@@ -19,8 +19,9 @@ import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
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.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
@@ -132,16 +133,17 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
private class DebugContextListener implements IDebugContextListener
{
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ private void contextActivated(ISelection selection) {
setupActionDelegate(selection);
updateAction(fAction, fCurrentSelection);
}
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- setupActionDelegate(selection);
- updateAction(fAction, fCurrentSelection);
+ public void debugContextChanged(DebugContextEvent event) {
+ contextActivated(event.getContext());
}
+
+
}
private void setupActionDelegate(ISelection context)
@@ -322,12 +324,12 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
if (fWindow != null)
{
- DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(fDebugContextListener);
}
if (window != null)
{
- DebugContextManager.getDefault().getContextService(window).addDebugContextListener(fDebugContextListener);
+ DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(fDebugContextListener);
}
fWindow = window;
}
@@ -336,7 +338,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
fPart = part;
if (fWindow != null)
- setupActionDelegate(DebugContextManager.getDefault().getContextService(fWindow).getActiveContext());
+ setupActionDelegate(DebugUITools.getDebugContextManager().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 de8ac8552..1aad2a74c 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
@@ -18,11 +18,11 @@ import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
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.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextManager;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -55,15 +55,12 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
private IWorkbenchPart fActivePart = null;
private IRunToLineTarget fPartTarget = null;
private IAction fAction = null;
- private IDebugContextListener fContextListener = new DebugContextListener();
+ private DebugContextListener fContextListener = new DebugContextListener();
private ISuspendResume fTargetElement = null;
class DebugContextListener implements IDebugContextListener {
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ protected void contextActivated(ISelection selection) {
fTargetElement = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
@@ -76,12 +73,9 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
}
update();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
- */
- public void contextChanged(ISelection selection, IWorkbenchPart part) {
- contextActivated(selection, part);
+
+ public void debugContextChanged(DebugContextEvent event) {
+ contextActivated(event.getContext());
}
}
@@ -90,7 +84,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
* @see org.eclipse.ui.IActionDelegate2#dispose()
*/
public void dispose() {
- DebugContextManager.getDefault().getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener);
+ DebugUITools.getDebugContextManager().getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener);
fActivePart = null;
fPartTarget = null;
@@ -179,7 +173,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
* @param part
*/
private void bindTo(IWorkbenchPart part) {
- IDebugContextManager manager = DebugContextManager.getDefault();
+ IDebugContextManager manager = DebugUITools.getDebugContextManager();
if (fActivePart != null && !fActivePart.equals(part)) {
manager.getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener);
}
@@ -198,7 +192,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
}
}
ISelection activeContext = service.getActiveContext();
- fContextListener.contextActivated(activeContext, part);
+ fContextListener.contextActivated(activeContext);
}
update();
}

Back to the top