Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2010-12-02 13:34:44 -0500
committerPawel Piech2010-12-02 13:34:44 -0500
commit7549c7a81d6e70118ec63598ad218c08dfefac08 (patch)
tree9bde9d1fb0c6c72f1af2a1f695fa4a1ddc3abdcf
parentaf9751e6232940dc5de1046294a166b4a77a2cd9 (diff)
downloadeclipse.platform.debug-7549c7a81d6e70118ec63598ad218c08dfefac08.tar.gz
eclipse.platform.debug-7549c7a81d6e70118ec63598ad218c08dfefac08.tar.xz
eclipse.platform.debug-7549c7a81d6e70118ec63598ad218c08dfefac08.zip
Bug 327263 - Allow multiple debug views and multiple debug context providers
-rw-r--r--org.eclipse.debug.ui/plugin.xml5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java210
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java112
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider2.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextService.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java2
22 files changed, 469 insertions, 115 deletions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 57739e597..ded36e5bc 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -80,6 +80,7 @@
icon="$nl$/icons/full/eview16/breakpoint_view.gif"
category="org.eclipse.debug.ui"
class="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView"
+ allowMultiple="true"
id="org.eclipse.debug.ui.BreakpointView">
</view>
<view
@@ -87,6 +88,7 @@
icon="$nl$/icons/full/eview16/variable_view.gif"
category="org.eclipse.debug.ui"
class="org.eclipse.debug.internal.ui.views.variables.VariablesView"
+ allowMultiple="true"
id="org.eclipse.debug.ui.VariableView">
</view>
<view
@@ -94,6 +96,7 @@
icon="$nl$/icons/full/eview16/watchlist_view.gif"
category="org.eclipse.debug.ui"
class="org.eclipse.debug.internal.ui.views.expression.ExpressionView"
+ allowMultiple="true"
id="org.eclipse.debug.ui.ExpressionView">
</view>
<view
@@ -101,6 +104,7 @@
icon="$nl$/icons/full/eview16/register_view.gif"
category="org.eclipse.debug.ui"
class="org.eclipse.debug.internal.ui.views.registers.RegistersView"
+ allowMultiple="true"
id="org.eclipse.debug.ui.RegisterView">
</view>
<view
@@ -108,6 +112,7 @@
icon="$nl$/icons/full/eview16/module_view.gif"
category="org.eclipse.debug.ui"
class="org.eclipse.debug.internal.ui.views.modules.ModulesView"
+ allowMultiple="true"
id="org.eclipse.debug.ui.ModuleView">
</view>
<view
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 ffbd69851..7b700fea1 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
@@ -7,6 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Allow multiple debug views and
+ * multiple debug context providers (Bug 327263)
*******************************************************************************/
package org.eclipse.debug.internal.ui.contexts;
@@ -64,6 +66,20 @@ public class DebugContextManager implements IDebugContextManager {
}
public void addDebugContextListener(IDebugContextListener listener) {
}
+ public void addDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+
+ }
+ public void removeDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ }
+
+ public ISelection getActiveContext(String partId, String partSecondaryId) {
+ return null;
+ }
+ public void addPostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ }
+
+ public void removePostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ }
};
private class WindowListener implements IWindowListener {
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 6cc2f2c92..dcc731559 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
@@ -8,11 +8,15 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River - Pawel Piech - added an evaluation context source provider (bug 229219)
+ * Patrick Chuong (Texas Instruments) and Pawel Piech (Wind River) -
+ * Allow multiple debug views and multiple debug context providers (Bug 327263)
*******************************************************************************/
package org.eclipse.debug.internal.ui.contexts;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -23,10 +27,12 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
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.IDebugContextProvider2;
import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
@@ -69,7 +75,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
IWorkbenchPart part = provider.getPart();
String id = null;
if (part != null) {
- id = part.getSite().getId();
+ id = getCombinedPartId(part);
}
fProvidersByPartId.put(id, provider);
fProviders.add(provider);
@@ -90,7 +96,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
IWorkbenchPart part = provider.getPart();
String id = null;
if (part != null) {
- id = part.getSite().getId();
+ id = getCombinedPartId(part);
}
fProvidersByPartId.remove(id);
fProviders.remove(index);
@@ -158,48 +164,100 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
protected void notify(DebugContextEvent event) {
- notify(event, getListeners(null));
- IWorkbenchPart part = event.getDebugContextProvider().getPart();
- if (part != null) {
- notify(event, getListeners(part));
- }
- notify(event, getPostListeners(null));
- if (part != null) {
- notify(event, getPostListeners(part));
+ IDebugContextProvider provider = getActiveProvider();
+ if (provider != null) {
+ IWorkbenchPart part = event.getDebugContextProvider().getPart();
+
+ // Once for listeners
+ if (provider == event.getDebugContextProvider()) {
+ notify(event, getListeners(null));
+ }
+ if (part != null) {
+ notify(event, getListeners(part));
+ }
+
+ // Again for post-listeners
+ if (provider == event.getDebugContextProvider()) {
+ notify(event, getPostListeners(null));
+ }
+ if (part != null) {
+ notify(event, getPostListeners(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 {
- listener.debugContextChanged(event);
- }
- public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
- });
- }
+ protected void notify(final DebugContextEvent event, Object[] listeners) {
+ for (int i = 0; i < listeners.length; i++) {
+ final IDebugContextListener listener = (IDebugContextListener) listeners[i];
+ SafeRunner.run(new ISafeRunnable() {
+ public void run() throws Exception {
+ listener.debugContextChanged(event);
+ }
+ public void handleException(Throwable exception) {
+ DebugUIPlugin.log(exception);
+ }
+ });
}
}
- protected ListenerList getListeners(IWorkbenchPart part) {
- String id = null;
- if (part != null) {
- id = part.getSite().getId();
- }
- return (ListenerList) fListenersByPartId.get(id);
+ protected Object[] getListeners(IWorkbenchPart part) {
+ String id = null;
+ if (part != null) {
+ id = getCombinedPartId(part);
+ ListenerList listenerList = (ListenerList)fListenersByPartId.get(id);
+ return listenerList != null ? listenerList.getListeners() : new Object[0];
+ } else {
+ List retVal = new ArrayList();
+ retVal.addAll(Arrays.asList(((ListenerList)fListenersByPartId.get(null)).getListeners()) );
+ outer: for (Iterator itr = fListenersByPartId.keySet().iterator(); itr.hasNext();) {
+ String listenerPartId = (String)itr.next();
+ for (int i = 0; i < fProviders.size(); i++) {
+ String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
+ if ((listenerPartId == null && providerPartId == null) ||
+ (listenerPartId != null && listenerPartId.equals(providerPartId)))
+ {
+ continue outer;
+ }
+ }
+
+ List toAdd = Arrays.asList(((ListenerList)fListenersByPartId.get(listenerPartId)).getListeners());
+ for (Iterator addItr = toAdd.iterator(); addItr.hasNext();) {
+ Object element = addItr.next();
+ if (!retVal.contains(element)) retVal.add(element);
+
+ }
+ }
+ return retVal.toArray();
+ }
}
- protected ListenerList getPostListeners(IWorkbenchPart part) {
- String id = null;
- if (part != null) {
- id = part.getSite().getId();
- }
- return (ListenerList) fPostListenersByPartId.get(id);
+ protected Object[] getPostListeners(IWorkbenchPart part) {
+ String id = null;
+ if (part != null) {
+ id = getCombinedPartId(part);
+ ListenerList listenerList = (ListenerList)fPostListenersByPartId.get(id);
+ return listenerList != null ? listenerList.getListeners() : new Object[0];
+ } else {
+ List retVal = new ArrayList();
+ ListenerList postListenersList = (ListenerList)fPostListenersByPartId.get(null);
+ if (postListenersList != null) {
+ retVal.addAll( Arrays.asList(postListenersList.getListeners()) );
+ }
+
+ outer: for (Iterator itr = fPostListenersByPartId.keySet().iterator(); itr.hasNext();) {
+ String listenerPartId = (String)itr.next();
+ for (int i = 0; i < fProviders.size(); i++) {
+ String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
+ if ((listenerPartId == null && providerPartId == null) ||
+ (listenerPartId != null && listenerPartId.equals(providerPartId)))
+ {
+ continue outer;
+ }
+ }
+ retVal.addAll( Arrays.asList(((ListenerList)fPostListenersByPartId.get(listenerPartId)).getListeners()) );
+ }
+ return retVal.toArray();
+ }
}
/* (non-Javadoc)
@@ -221,6 +279,8 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
ListenerList list = (ListenerList) fListenersByPartId.get(partId);
if (list != null) {
list.remove(listener);
+ if (list.size() == 0)
+ fListenersByPartId.remove(partId);
}
}
@@ -232,7 +292,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
if (provider != null) {
return provider.getActiveContext();
}
- return null;
+ return getActiveContext();
}
/* (non-Javadoc)
@@ -251,7 +311,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
*
* @return active provider or <code>null</code>
*/
- protected IDebugContextProvider getActiveProvider() {
+ private IDebugContextProvider getActiveProvider() {
if (!fProviders.isEmpty()) {
return (IDebugContextProvider)fProviders.get(0);
}
@@ -264,11 +324,18 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
public void partActivated(IWorkbenchPartReference partRef) {
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(provider);
+ boolean canSetActive = true;
+ if (provider instanceof IDebugContextProvider2) {
+ canSetActive = ((IDebugContextProvider2) provider).isWindowContextProvider();
+ }
+
+ if (canSetActive) {
+ int index = fProviders.indexOf(provider);
+ if (index > 0) {
+ fProviders.remove(index);
+ fProviders.add(0, provider);
+ notify(provider);
+ }
}
}
@@ -319,13 +386,56 @@ 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 debugContextChanged(DebugContextEvent event) {
- if (!fProviders.isEmpty()) {
- IDebugContextProvider provider = (IDebugContextProvider) fProviders.get(0);
- if (provider == event.getDebugContextProvider()) {
- notify(event);
- }
- }
+ public void debugContextChanged(DebugContextEvent event) {
+ notify(event);
+ }
+
+ private String getCombinedPartId(IWorkbenchPart part) {
+ if (part.getSite() instanceof IViewSite) {
+ IViewSite site = (IViewSite)part.getSite();
+ return getCombinedPartId(site.getId(), site.getSecondaryId());
+
+ } else {
+ return part.getSite().getId();
+ }
+ }
+
+ private String getCombinedPartId(String id, String secondaryId) {
+ return id + (secondaryId != null ? ":" + secondaryId : ""); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextService2#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, java.lang.String, java.lang.String)
+ */
+ public void addDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ addDebugContextListener(listener, getCombinedPartId(partId, partSecondaryId));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextService2#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, java.lang.String, java.lang.String)
+ */
+ public void removeDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ removeDebugContextListener(listener, getCombinedPartId(partId, partSecondaryId));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextService2#addPostDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, java.lang.String, java.lang.String)
+ */
+ public void addPostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ addPostDebugContextListener(listener, getCombinedPartId(partId, partSecondaryId));
}
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextService2#removePostDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, java.lang.String, java.lang.String)
+ */
+ public void removePostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId) {
+ removePostDebugContextListener(listener, getCombinedPartId(partId, partSecondaryId));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextService2#getActiveContext(java.lang.String, java.lang.String)
+ */
+ public ISelection getActiveContext(String partId, String partSecondaryId) {
+ return getActiveContext(getCombinedPartId(partId, partSecondaryId));
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
index 781c36376..cecec5685 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
@@ -288,8 +288,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
private class RenderingGoToAddressAction extends GoToAddressAction
{
- public RenderingGoToAddressAction(AbstractBaseTableRendering rendering) {
- super(rendering);
+ public RenderingGoToAddressAction(IMemoryRenderingContainer container, AbstractBaseTableRendering rendering) {
+ super(container, rendering);
}
public void run() {
@@ -2038,7 +2038,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
protected void createActions() {
fCopyToClipboardAction = new AsyncCopyTableRenderingAction(this, fTableViewer);
- fGoToAddressAction = new RenderingGoToAddressAction(this);
+ fGoToAddressAction = new RenderingGoToAddressAction(getMemoryRenderingContainer(), this);
fResetMemoryBlockAction = new ResetToBaseAddressAction(this);
fPrintViewTabAction = new AsyncPrintTableRenderingAction(this, fTableViewer);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
index ab991f695..3ffc28db7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
@@ -35,7 +35,6 @@ class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate {
private String[] fLabels;
private FontData[] fFontDatas;
private TreeModelLabelProvider fProvider;
- private ITreeModelLabelProviderTarget fTreeViewer;
private int fNumColumns;
private IPresentationContext fContext;
private Object fViewerInput;
@@ -50,7 +49,7 @@ class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate {
* @param columnIds column identifiers or <code>null</code>
* @param context presentation context
*/
- public LabelUpdate(Object viewerInput, TreePath elementPath, TreeModelLabelProvider provider, ITreeModelLabelProviderTarget treeViewer, String[] columnIds, IPresentationContext context) {
+ public LabelUpdate(Object viewerInput, TreePath elementPath, TreeModelLabelProvider provider, String[] columnIds, IPresentationContext context) {
fContext = context;
fViewerInput = viewerInput;
fElementPath = elementPath;
@@ -61,7 +60,6 @@ class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate {
fNumColumns = columnIds.length;
}
fLabels = new String[fNumColumns];
- fTreeViewer = treeViewer;
}
/* (non-Javadoc)
@@ -155,9 +153,7 @@ class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate {
* Applies settings to viewer cell
*/
public void update() {
- fTreeViewer.setElementData(fElementPath, fNumColumns, fLabels, fImageDescriptors, fFontDatas, fForegrounds, fBackgrounds);
- if (fTreeViewer instanceof ITreeModelCheckProviderTarget)
- ((ITreeModelCheckProviderTarget) fTreeViewer).setElementChecked(fElementPath, fChecked, fGrayed);
+ fProvider.setElementData(fElementPath, fNumColumns, fLabels, fImageDescriptors, fFontDatas, fForegrounds, fBackgrounds, fChecked, fGrayed);
fProvider.updateComplete(this);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
index 2e3b7cac7..833124807 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
@@ -264,7 +264,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
updates = new LinkedList();
fPendingUpdates.put(presentation, updates);
}
- updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, fViewer, visibleColumns, fViewer.getPresentationContext()));
+ updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, visibleColumns, fViewer.getPresentationContext()));
if (fPendingUpdatesJob != null) {
fPendingUpdatesJob.cancel();
}
@@ -297,6 +297,22 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
}
+ /**
+ * Sets the element's display information in the viewer.
+ *
+ * @see ITreeModelLabelProviderTarget#setElementData(TreePath, int, String[], ImageDescriptor[], FontData[], RGB[], RGB[])
+ * @see ITreeModelCheckProviderTarget#setElementChecked(TreePath, boolean, boolean)
+ */
+ protected void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
+ FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds, boolean checked, boolean grayed)
+ {
+ fViewer.setElementData(path, numColumns, labels, images, fontDatas, foregrounds, backgrounds);
+
+ if (fViewer instanceof ITreeModelCheckProviderTarget)
+ ((ITreeModelCheckProviderTarget) fViewer).setElementChecked(path, checked, grayed);
+ }
+
+
private void startRequests(UIJob updateJob) {
// Avoid calling providers inside a synchronized section. Instead
// copy the updates map into a new variable.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
index cbaced58f..207cd4bad 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
@@ -42,6 +42,7 @@ import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.ui.IWorkbenchPartSite;
/**
* Drop Adapter allowing expressions, variables and text to be dropped in the Expression View.
@@ -54,7 +55,8 @@ import org.eclipse.swt.dnd.TransferData;
*/
public class ExpressionDropAdapter extends ViewerDropAdapter {
- private TransferData fCurrentTransferType = null;
+ private IWorkbenchPartSite fSite;
+ private TransferData fCurrentTransferType = null;
private boolean fInsertBefore;
private int fDropType;
@@ -67,8 +69,9 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
* Constructor takes the viewer this drop adapter applies to.
* @param viewer the viewer to add drop to
*/
- protected ExpressionDropAdapter(TreeModelViewer viewer) {
+ protected ExpressionDropAdapter(IWorkbenchPartSite site, TreeModelViewer viewer) {
super(viewer);
+ fSite = site;
setFeedbackEnabled(true);
setSelectionFeedbackEnabled(false);
setScrollExpandEnabled(false);
@@ -473,7 +476,7 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
*/
private IExpression createExpression(String exp) {
IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(exp);
- IAdaptable object = DebugUITools.getDebugContext();
+ IAdaptable object = DebugUITools.getPartDebugContext(fSite);
IDebugElement context = null;
if (object instanceof IDebugElement) {
context = (IDebugElement) object;
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 bcf9c86f0..984b37ede 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
@@ -155,7 +155,7 @@ public class ExpressionView extends VariablesView {
*/
protected void initDragAndDrop(TreeModelViewer viewer) {
viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
- viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(viewer));
+ viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(getSite(), viewer));
}
/* (non-Javadoc)
@@ -226,7 +226,7 @@ public class ExpressionView extends VariablesView {
// TODO: duplicate code from WatchExpressionAction
protected IDebugElement getContext() {
- IAdaptable object = DebugUITools.getDebugContext();
+ IAdaptable object = DebugUITools.getPartDebugContext(getSite());
IDebugElement context = null;
if (object instanceof IDebugElement) {
context = (IDebugElement) object;
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 6dad2ff78..791dd71ff 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
@@ -115,8 +115,8 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
addListeners();
- Object context = DebugUITools.getDebugContext();
- if (context != null)
+ Object context = DebugUITools.getPartDebugContext(fParent.getSite());
+ if (context != null)
{
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
if (retrieval != null)
@@ -132,7 +132,7 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
{
MemoryViewUtil.getMemoryBlockManager().addListener(this);
fParent.getViewSite().getPage().addSelectionListener(this);
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.addPartDebugContextListener(fParent.getSite(), this);
DebugPlugin.getDefault().addDebugEventListener(this);
}
@@ -140,8 +140,7 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
{
MemoryViewUtil.getMemoryBlockManager().removeListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
-
+ DebugUITools.removePartDebugContextListener(fParent.getSite(), this);
if (fStackLayout.topControl != null)
{
CTabFolder old = (CTabFolder)fStackLayout.topControl;
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 c0188450b..0ebcbb4f0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -104,11 +104,11 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".addMemoryMonitorAction_context"); //$NON-NLS-1$
- // listen for context changed
- DebugUITools.getDebugContextManager().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ // listen for context changed
+ DebugUITools.addPartDebugContextListener(fSite.getSite(), this);
// get current context
- fCurrentContext = DebugUITools.getDebugContext();
+ fCurrentContext = DebugUITools.getPartDebugContext(site.getSite());
// set up enablement based on current selection
updateAction(fCurrentContext);
@@ -127,7 +127,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
{
exit = true;
- Object elem = DebugUITools.getDebugContext();
+ Object elem = fCurrentContext;
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(elem);
@@ -347,7 +347,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
// remove listeners
DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugUITools.getDebugContextManager().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.removePartDebugContextListener(fSite.getSite(), this);
}
private void addDefaultRenderings(IMemoryBlock memoryBlock)
@@ -422,7 +422,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
*/
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = DebugUITools.getPartDebugContext(fSite.getSite());
updateAction(context);
fCurrentContext = context;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
index 3eef011ab..9e57d147b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -432,7 +432,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
if (element == null)
{
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = DebugUITools.getPartDebugContext(fSite.getSite());
if (context != null)
{
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 eeba2d96b..2e4179594 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -296,7 +296,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fPresentationContext = new MemoryViewPresentationContext(site, this, null);
fTreeViewer = new MemoryViewTreeViewer(parent, style, fPresentationContext);
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = DebugUITools.getPartDebugContext(fParent.getSite());
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
if (retrieval != null)
fTreeViewer.setInput(retrieval);
@@ -307,7 +307,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getPage().addSelectionListener(this);
fDebugContextListener = new TreeViewPaneContextListener();
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
+ DebugUITools.addPartDebugContextListener(fParent.getSite(), fDebugContextListener);
fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -342,7 +342,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
*/
private void updateRetrieval() {
- Object context = DebugUITools.getDebugContext();
+ Object context = DebugUITools.getPartDebugContext(fParent.getSite());
fRetrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
}
@@ -367,7 +367,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fParent.getViewSite().getSelectionProvider().removeSelectionChangedListener(this);
fParent.getViewSite().getPage().removeSelectionListener(this);
fAddMemoryBlockAction.dispose();
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
+ DebugUITools.removePartDebugContextListener(fParent.getSite(), fDebugContextListener);
fEvtHandler.dispose();
fPresentationContext.dispose();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
index 5e8333be2..bccacccaf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -352,7 +352,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
fAddHandler = new AbstractHandler() {
public Object execute(ExecutionEvent event) throws ExecutionException {
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = DebugUITools.getPartDebugContext(getSite());
if (context != null && MemoryViewUtil.isValidSelection(new StructuredSelection(context)))
{
RetargetAddMemoryBlockAction action = new RetargetAddMemoryBlockAction(MemoryView.this);
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 137e5b004..d45f55b35 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
@@ -821,7 +821,7 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
if (memoryBlock == null)
{
// get a memory block from current debug context
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = DebugUITools.getPartDebugContext(fParent.getSite());
if (context != null)
{
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
index dfa60c091..a0667815d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -45,7 +45,7 @@ public class RetargetAddMemoryBlockAction extends AddMemoryBlockAction {
public void run() {
// get current selection from Debug View
- Object debugContext = DebugUITools.getDebugContext();
+ Object debugContext = DebugUITools.getPartDebugContext(fSite.getSite());
IAddMemoryBlocksTarget target = getAddMemoryBlocksTarget(debugContext);
if (target != null)
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 a6d135739..3ce617599 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -74,7 +74,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
*/
public IStatus runInUIThread(IProgressMonitor monitor) {
if (fAction != null) {
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = getDebugContext();
if (context != null) {
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
@@ -229,7 +229,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
// get selection from memory view
IMemoryBlock memoryBlock = getCurrentMemoryBlock();
- Object context = DebugUITools.getDebugContext();
+ Object context = getDebugContext();
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
if (retrieval != null) {
allMemoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval);
@@ -299,7 +299,7 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
}
private void switchToNext() {
- IAdaptable context = DebugUITools.getDebugContext();
+ IAdaptable context = getDebugContext();
if (context instanceof IDebugElement) {
IDebugElement debugContext = (IDebugElement)context;
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(debugContext);
@@ -407,4 +407,11 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
return label;
}
+ private IAdaptable getDebugContext() {
+ if (fView != null) {
+ return DebugUITools.getPartDebugContext(fView.getSite());
+ } else {
+ return DebugUITools.getDebugContext();
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
index c078b7a20..690b788ca 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -28,6 +28,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering;
+import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.jface.action.Action;
@@ -43,11 +44,13 @@ import org.eclipse.ui.PlatformUI;
*/
public class GoToAddressAction extends Action
{
+ private IMemoryRenderingContainer fContainer;
private IRepositionableMemoryRendering fRendering;
- public GoToAddressAction(IRepositionableMemoryRendering rendering)
+ public GoToAddressAction(IMemoryRenderingContainer container, IRepositionableMemoryRendering rendering)
{
super(DebugUIMessages.GoToAddressAction_title);
+ fContainer = container;
setToolTipText(DebugUIMessages.GoToAddressAction_title);
fRendering = rendering;
@@ -166,7 +169,7 @@ public class GoToAddressAction extends Action
private void addNewMemoryBlock(String expression, IMemoryBlockRetrievalExtension retrieval)
{
- Object elem = DebugUITools.getDebugContext();
+ Object elem = DebugUITools.getPartDebugContext(fContainer.getMemoryRenderingSite().getSite());
if (!(elem instanceof IDebugElement))
return;
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 1473e28e2..e8d826dfe 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
@@ -14,6 +14,8 @@
* Wind River - Pawel Piech - Fix viewer input race condition (Bug 234908)
* Wind River - Anton Leherbauer - Fix selection provider (Bug 254442)
* Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
+ * Patrick Chuong (Texas Instruments) and Pawel Piech (Wind River) -
+ * Allow multiple debug views and multiple debug context providers (Bug 327263)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables;
@@ -64,6 +66,7 @@ import org.eclipse.debug.ui.IDebugModelPresentation;
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.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -418,7 +421,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.removePartDebugContextListener(getSite(), this);
getSite().getWorkbenchWindow().removePerspectiveListener(this);
DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getFontRegistry().removeListener(this);
@@ -696,17 +699,39 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
});
variablesViewer.addPostSelectionChangedListener(getTreeSelectionChangedListener());
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugUITools.addPartDebugContextListener(getSite(), this);
+
return variablesViewer;
}
/**
+ * Returns the active debug context for this view based on the view's
+ * site IDs.
+ *
+ * @since 3.7
+ */
+ protected ISelection getDebugContext() {
+ IViewSite site = (IViewSite)getSite();
+ IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ return contextService.getActiveContext(site.getId(), site.getSecondaryId());
+ }
+
+ /**
* Returns the presentation context id for this view.
*
* @return context id
*/
protected String getPresentationContextId() {
return IDebugUIConstants.ID_VARIABLE_VIEW;
+ }
+
+ /**
+ * Returns the presentation context secondary id for this view.
+ *
+ * @return context secondary id.
+ */
+ protected String getPresentationContextSecondaryId() {
+ return ((IViewSite)getSite()).getSecondaryId();
}
/**
@@ -1291,7 +1316,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
protected void becomesVisible() {
super.becomesVisible();
- ISelection selection = DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).getActiveContext();
+ ISelection selection = getDebugContext();
contextActivated(selection);
}
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 e7cac3bb7..c8e35ea43 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -49,7 +49,9 @@ 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.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextManager;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.sourcelookup.ISourceContainerBrowser;
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
@@ -62,7 +64,9 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -184,10 +188,9 @@ public class DebugUITools {
}
/**
- * Returns the currently selected element in the
- * debug view of the current workbench page,
- * or <code>null</code> if there is no current
- * debug context.
+ * Returns the element of the currently selected context in the
+ * active workbench window. Returns <code>null</code> if there is no
+ * current debug context.
* <p>
* This method used to return <code>null</code> when called from a non-UI thread,
* but since 3.1, this methods also works when called from a non-UI thread.
@@ -199,19 +202,100 @@ public class DebugUITools {
IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow();
if (activeWindow != null) {
ISelection activeContext = DebugUITools.getDebugContextManager().getContextService(activeWindow).getActiveContext();
- if (activeContext instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) activeContext;
- if (!selection.isEmpty()) {
- Object firstElement = selection.getFirstElement();
- if (firstElement instanceof IAdaptable) {
- return (IAdaptable) firstElement;
- }
- }
- }
+ return getDebugContextElementForSelection(activeContext);
}
return null;
}
+ /**
+ * Returns the currently active context for the given workbench part.
+ * Returns <code>null</code> if there is no current debug context.
+ * </p>
+ * @param site Workbench part site where to look up the active context.
+ * @return the currently active debug context in the given part, or
+ * <code>null</code>
+ * @since 3.7
+ */
+ public static IAdaptable getPartDebugContext(IWorkbenchPartSite site) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = null;
+ String secondaryId = null;
+ id = site.getId();
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ ISelection activeContext = service.getActiveContext(id, secondaryId);
+ return getDebugContextElementForSelection(activeContext);
+ }
+
+ /**
+ * Adds the given debug context listener as a listener to the debug context
+ * changed events, in the context of the given workbench part.
+ * <p>
+ * This method is a utility method which ultimately calls
+ * {@link IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)}
+ * using the part id parameters extracted from the given part parameter.
+ * </p>
+ *
+ * @param part Workbench part to get the part ID and part secondary ID from.
+ * @param listener Debug context listener to add.
+ *
+ * @see IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)
+ * @see IDebugContextManager#addDebugContextListener(IDebugContextListener)
+ * @since 3.7
+ */
+ public static void addPartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = site.getId();
+ String secondaryId = null;
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ service.addDebugContextListener(listener, id, secondaryId);
+ }
+
+ /**
+ * Removes the given debug context listener as a listener to the debug
+ * context changed events, in the context of the given workbench part.
+ * <p>
+ * This method is a utility method which ultimately calls
+ * {@link IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)}
+ * using the part id parameters extracted from the given part parameter.
+ * </p>
+ *
+ * @param part Workbench part to get the part ID and part secondary ID from.
+ * @param listener Debug context listener to remove.
+ *
+ * @see IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)
+ * @see IDebugContextManager#removeDebugContextListener(IDebugContextListener)
+ * @since 3.7
+ */
+ public static void removePartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = site.getId();
+ String secondaryId = null;
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ service.removeDebugContextListener(listener, id, secondaryId);
+ }
+
+ /**
+ * Extracts the first element from the given selection and casts it to IAdaptable.
+ */
+ private static IAdaptable getDebugContextElementForSelection(ISelection activeContext) {
+ if (activeContext instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) activeContext;
+ if (!selection.isEmpty()) {
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof IAdaptable) {
+ return (IAdaptable) firstElement;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Returns the currently selected resource in the active workbench window,
* or <code>null</code> if none. If an editor is active, the resource adapter
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider2.java
new file mode 100644
index 000000000..7c093f306
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider2.java
@@ -0,0 +1,33 @@
+/*****************************************************************
+ * Copyright (c) 2010 Texas Instruments 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:
+ * Patrick Chuong (Texas Instruments) - Allow multiple debug views and
+ * multiple debug context providers (Bug 327263)
+ *****************************************************************/
+package org.eclipse.debug.ui.contexts;
+
+/**
+ * IDebugContextProvider extension.
+ *
+ * @since 3.7
+ */
+public interface IDebugContextProvider2 extends IDebugContextProvider {
+ /**
+ * Return whether the provider can be set a an active provider for the
+ * window.
+ * <p>
+ * If <code>true</code> then upon the provider's part is
+ * activation this provider will become the active debug context provider
+ * for the whole window. If <code>false</code>, then this provider will
+ * only set the active context in a given workbench part.
+ *
+ * @return <code>true</code> if capable to be the active debug context
+ * provider for a window.
+ */
+ boolean isWindowContextProvider();
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextService.java
index 0d2eac26c..7b2a5d7fa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -7,6 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Allow multiple debug views and
+ * multiple debug context providers (Bug 327263)
*******************************************************************************/
package org.eclipse.debug.ui.contexts;
@@ -124,4 +126,59 @@ public interface IDebugContextService {
*/
public void removeDebugContextProvider(IDebugContextProvider provider);
+ /**
+ * Returns the active context in the specified part of this service's window
+ * or <code>null</code> if none.
+ *
+ * @param partId part identifier
+ * @param partSecondaryId part secondary identifier
+ * @return active context or <code>null</code>
+ * @since 3.7
+ */
+ ISelection getActiveContext(String partId, String partSecondaryId);
+
+ /**
+ * Registers for the given debug context listener for context notification
+ * from the specified part in this service's window.
+ *
+ * @param listener debug context listener
+ * @param partId part identifier
+ * @param partSecondaryId part secondary identifier
+ * @since 3.7
+ */
+ void addDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId);
+
+ /**
+ * Unregisters the given debug context listener for context change notification
+ * from the specified part in this service's window.
+ *
+ * @param listener debug context listener
+ * @param partId part identifier
+ * @param partSecondaryId part secondary identifier
+ * @since 3.7
+ */
+ void removeDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId);
+
+ /**
+ * Registers the given debug context listener for post context change notification
+ * in the specified part of this service's window. Post listeners are notified of
+ * context changes after all non-post listeners are notified.
+ *
+ * @param listener debug context listener
+ * @param partSecondaryId part secondary identifier
+ * @param partId part identifier
+ * @since 3.7
+ */
+ void addPostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId);
+
+ /**
+ * Unregisters the given debug context listener for post context change notification
+ * in the specified part of this service's window.
+ *
+ * @param listener debug context listener
+ * @param partSecondaryId part secondary identifier
+ * @param partId part identifier
+ * @since 3.7
+ */
+ void removePostDebugContextListener(IDebugContextListener listener, String partId, String partSecondaryId);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index c1283d3ff..8d7399f63 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -2485,7 +2485,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
protected void createActions() {
fCopyToClipboardAction = new CopyTableRenderingToClipboardAction(this, fTableViewer);
- fGoToAddressAction = new GoToAddressAction(this);
+ fGoToAddressAction = new GoToAddressAction(getMemoryRenderingContainer(), this);
fResetMemoryBlockAction = new ResetToBaseAddressAction(this);
fPrintViewTabAction = new PrintTableRenderingAction(this, fTableViewer);

Back to the top