diff options
author | Darin Wright | 2006-10-24 22:10:39 +0000 |
---|---|---|
committer | Darin Wright | 2006-10-24 22:10:39 +0000 |
commit | 52e4cbedce96b4b241822ffed54994de1c56bbc0 (patch) | |
tree | ee8026bfc0a240d7aca7e666b516ebf538eefc28 | |
parent | 041c646c4b1653c005dd63ae094a1fdedd7a2114 (diff) | |
download | eclipse.platform.debug-52e4cbedce96b4b241822ffed54994de1c56bbc0.tar.gz eclipse.platform.debug-52e4cbedce96b4b241822ffed54994de1c56bbc0.tar.xz eclipse.platform.debug-52e4cbedce96b4b241822ffed54994de1c56bbc0.zip |
Bug 160932 API for debug context and debug commands
17 files changed, 67 insertions, 169 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java index bea3d3461..7fa14bec3 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java @@ -14,7 +14,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.debug.internal.ui.contexts.DebugContextManager; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; -import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService; import org.eclipse.debug.ui.actions.IRunToLineTarget; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -63,7 +63,7 @@ public class RetargetRunToLineAction extends RetargetAction { * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() */ public void dispose() { - DebugContextManager.getDefault().removeDebugContextListener(fContextListener, fWindow); + DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fContextListener); super.dispose(); } /* (non-Javadoc) @@ -71,9 +71,9 @@ public class RetargetRunToLineAction extends RetargetAction { */ public void init(IWorkbenchWindow window) { super.init(window); - IDebugContextManager manager = DebugContextManager.getDefault(); - manager.addDebugContextListener(fContextListener, window); - ISelection activeContext = manager.getActiveContext(window); + IDebugContextService service = DebugContextManager.getDefault().getContextService(window); + service.addDebugContextListener(fContextListener); + ISelection activeContext = service.getActiveContext(); fContextListener.contextActivated(activeContext, null); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java index 26ca932d6..e78c73130 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java @@ -156,8 +156,9 @@ public abstract class DebugCommandAction extends Action implements IDebugContext fWindow = window; fUpdateService = DebugCommandService.getService(fWindow); IDebugContextManager manager = DebugContextManager.getDefault(); - manager.addDebugContextListener(this, window); - ISelection activeContext = manager.getActiveContext(window); + IDebugContextService contextService = manager.getContextService(window); + contextService.addDebugContextListener(this); + ISelection activeContext = contextService.getActiveContext(); if (activeContext != null) { fUpdateService.updateCommand(getCommandType(), new BooleanRequestMonitor(this, 1)); } else { @@ -181,10 +182,11 @@ public abstract class DebugCommandAction extends Action implements IDebugContext * @return structured selection */ protected ISelection getContext() { - if (fPart != null) { - DebugContextManager.getDefault().getContextService(fWindow).getActiveContext(fPart.getSite().getId()); + IDebugContextService contextService = DebugContextManager.getDefault().getContextService(fWindow); + if (fPart != null) { + contextService.getActiveContext(fPart.getSite().getId()); } - return DebugContextManager.getDefault().getActiveContext(fWindow); + return contextService.getActiveContext(); } /* @@ -218,11 +220,11 @@ public abstract class DebugCommandAction extends Action implements IDebugContext */ public void dispose() { IDebugContextManager manager = DebugContextManager.getDefault(); + IDebugContextService service = manager.getContextService(fWindow); if (fPart != null) { - IDebugContextService service = manager.getContextService(fWindow); service.removeDebugContextListener(this, fPart.getSite().getId()); } else { - manager.removeDebugContextListener(this, fWindow); + manager.removeDebugContextListener(this); } fWindow = null; fPart = null; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java index d9b94e94d..dda71e52f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java @@ -20,7 +20,6 @@ import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService; import org.eclipse.debug.internal.ui.views.ViewContextManager; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWindowListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; @@ -97,8 +96,6 @@ public class DebugContextManager implements IDebugContextManager { if (service == null) { service = new DebugWindowContextService(window); fServices.put(window, service); - // TODO: register 'null' provider (global) - // register global listeners Object[] listeners = fGlobalListeners.getListeners(); for (int i = 0; i < listeners.length; i++) { @@ -126,64 +123,6 @@ public class DebugContextManager implements IDebugContextManager { } /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow) - */ - public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window) { - IDebugContextService service = createService(window); - service.addDebugContextListener(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow) - */ - public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window) { - IDebugContextService service = getService(window); - if (service != null) { - service.removeDebugContextListener(listener); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow, java.lang.String) - */ - public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId) { - DebugWindowContextService service = createService(window); - service.addDebugContextListener(listener, partId); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, org.eclipse.ui.IWorkbenchWindow, java.lang.String) - */ - public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId) { - IDebugContextService service = getService(window); - if (service != null) { - service.removeDebugContextListener(listener, partId); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#getActiveContext(org.eclipse.ui.IWorkbenchWindow) - */ - public ISelection getActiveContext(IWorkbenchWindow window) { - IDebugContextService service = getService(window); - if (service != null) { - return service.getActiveContext(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextManager#getActiveContext(org.eclipse.ui.IWorkbenchWindow, java.lang.String) - */ - public ISelection getActiveContext(IWorkbenchWindow window, String partId) { - IDebugContextService service = getService(window); - if (service != null) { - return service.getActiveContext(partId); - } - return null; - } - - /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.contexts.IDebugContextManager#addDebugContextListener(org.eclipse.debug.internal.ui.contexts.IDebugContextListener) */ public void addDebugContextListener(IDebugContextListener listener) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java index 02f41bcee..b2bdd6c36 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java @@ -10,23 +10,19 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.contexts.provisional; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindow; /** - * A debug context drives debugging - source lookup and action enablement in the - * debug user interface. The context service provides notification - * of changes in the active context specific to the workbench, a specific window, or a - * specific part. + * Manages debug context services. There is a debug context service + * for each workbench window. Clients interested in context change + * notification for all windows can register with the manager. * <p> - * Clients provide a context policy to notify the context service of interesting - * contexts within a model. For example the debug platform provides a context policy - * that maps debug events to suspended contexts. + * Clients may register debug context providers with the manager. * </p> * <p> * Not intended to be implemented by clients. * </p> - * @since 3.2 + * @since 3.3 */ public interface IDebugContextManager { @@ -42,60 +38,7 @@ public interface IDebugContextManager { * * @param provider */ - public void removeDebugContextProvider(IDebugContextProvider provider); - - /** - * Registers for context activation notification in the given window. - * - * @param listener - * @param window - */ - public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window); - /** - * Unregisters for context activation notification in this service in the - * given window. - * - * @param listener - * @param window - */ - public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window); - - /** - * Registers for context activation notification in the specified part of the - * specified window. - * - * @param listener - * @param window - * @param partId - */ - public void addDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId); - - /** - * Unregisters for context activation notification in the specified part of - * the specified window. - * - * @param listener - * @param partId - */ - public void removeDebugContextListener(IDebugContextListener listener, IWorkbenchWindow window, String partId); - - /** - * Returns the active context in the given window - * or <code>null</code>. - * - * @param window - * @return - */ - public ISelection getActiveContext(IWorkbenchWindow window); - - /** - * Returns the active context in the specified part of the given - * window or <code>null</code>. - * - * @param partId - * @return - */ - public ISelection getActiveContext(IWorkbenchWindow window, String partId); + public void removeDebugContextProvider(IDebugContextProvider provider); /** * Registers for context activation notification in all windows. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java index b6485c043..5c22be15a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java @@ -31,11 +31,11 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla public SourceLookupService(IWorkbenchWindow window) { fWindow = window; - DebugContextManager.getDefault().addDebugContextListener(this, window); + DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this); } public void dispose() { - DebugContextManager.getDefault().removeDebugContextListener(this, fWindow); + DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java index 43c2f9750..b4062f2e0 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 @@ -31,7 +31,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx public DefaultWatchExpressionModelProxy(IWatchExpression expression, IWorkbenchWindow window) { super(expression); fWindow = window; - DebugContextManager.getDefault().addDebugContextListener(this, window); + DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this); } /* (non-Javadoc) @@ -41,7 +41,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx super.installed(); IWorkbenchPart part = getPresentationContext().getPart(); if (part != null) { - ISelection activeContext = DebugContextManager.getDefault().getActiveContext(part.getSite().getWorkbenchWindow()); + ISelection activeContext = DebugContextManager.getDefault().getContextService(part.getSite().getWorkbenchWindow()).getActiveContext(); if (activeContext != null) { contextActivated(activeContext, null); } @@ -53,7 +53,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx */ public synchronized void dispose() { super.dispose(); - DebugContextManager.getDefault().removeDebugContextListener(this, fWindow); + DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this); fWindow = null; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java index 0061e484c..c76c83406 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java @@ -582,14 +582,14 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi applyUserViewBindings(); loadPerspectives(); window.addPerspectiveListener(this); - DebugContextManager.getDefault().addDebugContextListener(this, window); + DebugContextManager.getDefault().getContextService(window).addDebugContextListener(this); DebugUIPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(this); fContextService.addContextManagerListener(this); } public void dispose() { fWindow.removePerspectiveListener(this); - DebugContextManager.getDefault().removeDebugContextListener(this, fWindow); + DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(this); DebugUIPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this); fContextService.removeContextManagerListener(this); } @@ -670,7 +670,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi applyUserViewBindings(); // clear activations to re-enable activation based on new settings fPerspectiveToActivatedContexts.clear(); - ISelection selection = DebugContextManager.getDefault().getActiveContext(fWindow); + ISelection selection = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext(); contextActivated(selection, null); } } @@ -890,7 +890,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi */ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { if (page.getWorkbenchWindow().equals(fWindow)) { - ISelection activeContext = DebugContextManager.getDefault().getActiveContext(fWindow); + ISelection activeContext = DebugContextManager.getDefault().getContextService(fWindow).getActiveContext(); if (activeContext != null) { contextActivated(activeContext, null); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java index 859ee2f13..fac458559 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java @@ -100,7 +100,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW); DebugPlugin.getDefault().addDebugEventListener(this); - DebugContextManager.getDefault().addDebugContextListener(this, fPage.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this); // contribute to toolbar IActionBars actionBars = fPage.getSite().getActionBars(); @@ -115,7 +115,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I */ public void dispose() { deactivated(); - DebugContextManager.getDefault().removeDebugContextListener(this, fPage.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this); DebugPlugin.getDefault().removeDebugEventListener(this); if (fRemoveTerminated != null) { fRemoveTerminated.dispose(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 0e8610432..aa6dbf103 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -14,7 +14,11 @@ package org.eclipse.debug.internal.ui.views.launch; import java.util.Iterator; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -89,6 +93,7 @@ import org.eclipse.ui.part.IShowInSource; import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.IShowInTargetList; import org.eclipse.ui.part.ShowInContext; +import org.eclipse.ui.progress.UIJob; public class LaunchView extends AbstractDebugView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2 { @@ -160,7 +165,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi fire(new DebugContextEvent(this, selection, DebugContextEvent.ACTIVATED)); } - protected void possibleContextChange(Object element, int type) { + protected void possibleContextChange(Object element, final int type) { synchronized (this) { if (fContext instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) fContext; @@ -171,7 +176,15 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi return; } } - fire(new DebugContextEvent(this, fContext, type)); + Job job = new UIJob("context change") { //$NON-NLS-1$ + public IStatus runInUIThread(IProgressMonitor monitor) { + fire(new DebugContextEvent(ContextProvider.this, fContext, type)); + return Status.OK_STATUS; + } + + }; + job.setSystem(true); + job.schedule(); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java index c097f52e4..cf6d4325e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java @@ -126,14 +126,14 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS { MemoryViewUtil.getMemoryBlockManager().addListener(this); fParent.getViewSite().getPage().addSelectionListener(this); - DebugContextManager.getDefault().addDebugContextListener(this, fParent.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this); } protected void removeListeners() { MemoryViewUtil.getMemoryBlockManager().removeListener(this); fParent.getViewSite().getPage().removeSelectionListener(this); - DebugContextManager.getDefault().removeDebugContextListener(this, fParent.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(this); if (fStackLayout.topControl != null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java index 8236c2473..816127ccd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java @@ -104,7 +104,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION)); // listen for context changed - DebugContextManager.getDefault().addDebugContextListener(this, site.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this); // get current context fCurrentContext = DebugUITools.getDebugContext(); @@ -338,7 +338,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene // remove listeners DebugPlugin.getDefault().removeDebugEventListener(this); - DebugContextManager.getDefault().removeDebugContextListener(this, fSite.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this); } private void addDefaultRenderings(IMemoryBlock memoryBlock) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java index 5e71c31a7..da057cccf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java @@ -372,7 +372,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC fParent.getViewSite().getPage().addSelectionListener(this); fDebugContextListener = new TreeViewPaneContextListener(); - DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, fParent.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener); fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @@ -482,7 +482,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC fParent.getViewSite().getSelectionProvider().removeSelectionChangedListener(this); fParent.getViewSite().getPage().removeSelectionListener(this); fAddMemoryBlockAction.dispose(); - DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fParent.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener); fEvtHandler.dispose(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java index eabf4c4d4..7a5a6a5e2 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java @@ -219,7 +219,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega public void init(IViewPart view) { fView = view; - DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, fView.getViewSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener); DebugPlugin.getDefault().getMemoryBlockManager().addListener(fListener); updateActionEnablement(); } @@ -347,7 +347,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega public void dispose() { fAction = null; DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fListener); - DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fView.getViewSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fView.getViewSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener); if (fMenuCreator != null) fMenuCreator.dispose(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 67dc42609..982c30164 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 @@ -25,7 +25,6 @@ import java.util.List; import java.util.ResourceBundle; import org.eclipse.core.commands.operations.IUndoContext; - import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -514,7 +513,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis */ public void dispose() { getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem); - DebugContextManager.getDefault().removeDebugContextListener(this, getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this); getSite().getWorkbenchWindow().removePerspectiveListener(this); DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); @@ -823,7 +822,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis getSite().setSelectionProvider(getVariablesViewSelectionProvider()); // listen to debug context - DebugContextManager.getDefault().addDebugContextListener(this, getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this); return variablesViewer; } @@ -1592,7 +1591,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis */ protected void becomesVisible() { super.becomesVisible(); - ISelection selection = DebugContextManager.getDefault().getActiveContext(getSite().getWorkbenchWindow()); + ISelection selection = DebugContextManager.getDefault().getContextService(getSite().getWorkbenchWindow()).getActiveContext(); contextActivated(selection, null); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java index bcbef008a..46a88d74f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java @@ -192,7 +192,7 @@ public class DebugUITools { public static IAdaptable getDebugContext() { IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow(); if (activeWindow != null) { - ISelection activeContext = DebugContextManager.getDefault().getActiveContext(activeWindow); + ISelection activeContext = DebugContextManager.getDefault().getContextService(activeWindow).getActiveContext(); if (activeContext instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) activeContext; if (!selection.isEmpty()) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java index 9467a7226..c7da8dc25 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java @@ -322,12 +322,12 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct if (fWindow != null) { - DebugContextManager.getDefault().removeDebugContextListener(fDebugContextListener, fWindow); + DebugContextManager.getDefault().getContextService(fWindow).removeDebugContextListener(fDebugContextListener); } if (window != null) { - DebugContextManager.getDefault().addDebugContextListener(fDebugContextListener, window); + DebugContextManager.getDefault().getContextService(window).addDebugContextListener(fDebugContextListener); } fWindow = window; } @@ -336,7 +336,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct fPart = part; if (fWindow != null) - setupActionDelegate(DebugContextManager.getDefault().getActiveContext(fWindow)); + setupActionDelegate(DebugContextManager.getDefault().getContextService(fWindow).getActiveContext()); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java index 1232c2000..de8ac8552 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java @@ -21,6 +21,7 @@ import org.eclipse.debug.internal.ui.actions.ActionMessages; import org.eclipse.debug.internal.ui.contexts.DebugContextManager; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; @@ -89,7 +90,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe * @see org.eclipse.ui.IActionDelegate2#dispose() */ public void dispose() { - DebugContextManager.getDefault().removeDebugContextListener(fContextListener, fActivePart.getSite().getWorkbenchWindow()); + DebugContextManager.getDefault().getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener); fActivePart = null; fPartTarget = null; @@ -180,13 +181,14 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe private void bindTo(IWorkbenchPart part) { IDebugContextManager manager = DebugContextManager.getDefault(); if (fActivePart != null && !fActivePart.equals(part)) { - manager.removeDebugContextListener(fContextListener, fActivePart.getSite().getWorkbenchWindow()); + manager.getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener); } fPartTarget = null; fActivePart = part; if (part != null) { IWorkbenchWindow workbenchWindow = part.getSite().getWorkbenchWindow(); - manager.addDebugContextListener(fContextListener, workbenchWindow); + IDebugContextService service = manager.getContextService(workbenchWindow); + service.addDebugContextListener(fContextListener); fPartTarget = (IRunToLineTarget) part.getAdapter(IRunToLineTarget.class); if (fPartTarget == null) { IAdapterManager adapterManager = Platform.getAdapterManager(); @@ -195,7 +197,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe fPartTarget = (IRunToLineTarget) adapterManager.loadAdapter(part, IRunToLineTarget.class.getName()); } } - ISelection activeContext = manager.getActiveContext(workbenchWindow); + ISelection activeContext = service.getActiveContext(); fContextListener.contextActivated(activeContext, part); } update(); |