Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2001-09-19 18:14:50 +0000
committerDarin Wright2001-09-19 18:14:50 +0000
commit0d5c7b29a136f482448c209576849049dfdc346c (patch)
tree8e7ef33334f528e32c3b5484cd2bad03f8cda02f
parent38c1eb20b0c76277fb4cb707e8b94b79d0295637 (diff)
downloadeclipse.platform.debug-0d5c7b29a136f482448c209576849049dfdc346c.tar.gz
eclipse.platform.debug-0d5c7b29a136f482448c209576849049dfdc346c.tar.xz
eclipse.platform.debug-0d5c7b29a136f482448c209576849049dfdc346c.zip
API Changes: Debug model navigation
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java93
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java20
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java24
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java21
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java35
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyVariablesToClipboardActionDelegate.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java69
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java100
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java23
17 files changed, 277 insertions, 306 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
index b3a587b33..9a8bc48ae 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
@@ -76,21 +76,6 @@ public interface IDebugElement extends IAdaptable {
public static final int VALUE= 0x0012;
/**
- * Returns the children of this debug element, or an empty collection
- * if this element has no children.
- *
- * @return array of debug elements
- * @exception DebugException if unable to retrieve this element's children
- * from the target
- */
- IDebugElement[] getChildren() throws DebugException;
- /**
- * Returns the debug target this element originated from.
- *
- * @return a debug target
- */
- IDebugTarget getDebugTarget();
- /**
* Returns the type of this element, encoded as an integer - one
* of the constants defined in this interface.
*
@@ -98,76 +83,26 @@ public interface IDebugElement extends IAdaptable {
*/
int getElementType();
/**
- * Returns the launch this element originated from, or
- * <code>null</code> if this element is not registered with
- * a launch. This is a convenience method for
- * <code>ILaunchManager.findLaunch(getDebugTarget())</code>.
- *
- * @return this element's launch, or <code>null</code> if not registered
- */
- ILaunch getLaunch();
- /**
- * Returns the name of this element. Name format is debug model
- * specific, and should be specified by a debug model.
- *
- * @return this element's name
- * @exception DebugException if unable to retrieve this element's name from
- * the target
- */
- String getName() throws DebugException;
- /**
- * Returns the parent of this debug element, or <code>null</code>
- * if this element has no parent.
- *
- * @return this element's parent, or <code>null</code> if none
- */
- IDebugElement getParent();
- /**
- * Returns the process associated with this debug element,
- * or <code>null</code> if no process is associated with this element.
- * This is a convenience method - it returns the process associated with
- * this element's debug target, if any.
- *
- * @return this element's process, or <code>null</code> if none
- */
- IProcess getProcess();
- /**
- * Returns the source locator that can be used to locate source elements
- * associated with this element or <code>null</code> if source lookup
- * is not supported. This is a convenience method - it
- * returns the source locator associated with this element's launch.
- *
- * @return this element's source locator, or <code>null</code> if none
- */
- ISourceLocator getSourceLocator();
- /**
- * Returns the stack frame containing this element,
- * or <code>null</code> if this element is not contained in a stack frame.
- *
- * @return this element's stack frame, or <code>null</code> if none
- */
- IStackFrame getStackFrame();
- /**
- * Returns the thread containing this element,
- * or <code>null</code> if this element is not contained in a thread.
- *
- * @return this element's thread, or <code>null</code> if none
- */
- IThread getThread();
- /**
- * Returns whether this element has children.
- *
- * @return whether this element has children
- * @exception DebugException if unable to determine if this element has children
- */
- boolean hasChildren() throws DebugException;
- /**
* Returns the unique identifier of the plug-in
* this debug element originated from.
*
* @return plug-in identifier
*/
String getModelIdentifier();
+ /**
+ * Returns the debug target this element is contained in.
+ *
+ * @return debug target
+ */
+ IDebugTarget getDebugTarget();
+ /**
+ * Returns the launch this target is contained in,
+ * or <code>null</code> if not yet registered with
+ * a launch.
+ *
+ * @return launch or <code>null</code>
+ */
+ ILaunch getLaunch();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
index f2545624b..8ba6a801d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
@@ -5,6 +5,7 @@ package org.eclipse.debug.core.model;
* All Rights Reserved.
*/
+import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.IBreakpointListener;
/**
@@ -45,6 +46,25 @@ public interface IDebugTarget extends IDebugElement, ITerminate, ISuspendResume,
* this debug target.
*/
IProcess getProcess();
+ /**
+ * Returns the threads contained in this debug target. An
+ * empty collection is returned if this debug target contains
+ * no threads.
+ *
+ * @return a collection of threads
+ * @exception DebugException if unable to retrieve threads
+ * from the target
+ */
+ IThread[] getThreads() throws DebugException;
+ /**
+ * Returns the name of this debug target. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this target's name
+ * @exception DebugException if unable to retrieve this element's name from
+ * the target
+ */
+ String getName() throws DebugException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
index 9665a190e..3490ace42 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
@@ -48,6 +48,21 @@ import org.eclipse.debug.core.DebugException;
*/
public interface IStackFrame extends IDebugElement, IStep, ISuspendResume, ITerminate {
/**
+ * Returns the thread this stack frame is contained in.
+ *
+ * @return thread
+ */
+ IThread getThread();
+ /**
+ * Returns the visible variables in this stack frame. An empty
+ * collection is returned if there are no visible variables.
+ *
+ * @return collection of visible variables
+ * @exception DebugException if unable to retrieve variables
+ * from the target
+ */
+ IVariable[] getVariables() throws DebugException;
+ /**
* Returns the line number of the instruction pointer in
* this stack frame that corresponds to a line in an associated source
* element, or <code>-1</code> if line number information
@@ -58,4 +73,13 @@ public interface IStackFrame extends IDebugElement, IStep, ISuspendResume, ITerm
* from the target
*/
int getLineNumber() throws DebugException;
+ /**
+ * Returns the name of this stack frame. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this frame's name
+ * @exception DebugException if unable to retrieve this element's name from
+ * the target
+ */
+ String getName() throws DebugException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
index 75d77556e..0129b4a8a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
@@ -36,6 +36,18 @@ import org.eclipse.debug.core.DebugException;
public interface IThread extends IDebugElement, ISuspendResume, IStep, ITerminate {
/**
+ * Returns the stack frames contained in this thread. An
+ * empty collection is returned if this thread contains
+ * no stack frames, or is not currently suspended. Stack frames
+ * are returned in top down order.
+ *
+ * @return a collection of stack frames
+ * @exception DebugException
+ * @exception DebugException if unable to retrieve stack frames
+ * from the target
+ */
+ IStackFrame[] getStackFrames() throws DebugException;
+ /**
* Returns the priority of this thread. The meaning of this
* number is operating-system dependent.
*
@@ -53,4 +65,13 @@ public interface IThread extends IDebugElement, ISuspendResume, IStep, ITerminat
* from the target
*/
IStackFrame getTopStackFrame() throws DebugException;
+ /**
+ * Returns the name of this thread. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this thread's name
+ * @exception DebugException if unable to retrieve this element's name from
+ * the target
+ */
+ String getName() throws DebugException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
index 9e81b6de9..8d3297e12 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
@@ -59,31 +59,7 @@ public interface IValue extends IDebugElement {
* from the target
*/
String getValueString() throws DebugException;
-
- /**
- * Returns the name of this element. Implementations of <code>IValue</code>
- * return <code>null</code>. Values do not have names.
- *
- * @return <code>null</code>
- */
- String getName();
-
- /**
- * Returns the variable this value is bound to, or <code>null</code>
- * if this value is not bound to a variable.
- *
- * @return a variable, or <code>null</code> if none
- */
- IVariable getVariable();
-
- /**
- * Returns the parent of this element. Implementations of <code>IVariable</code>
- * return <code>null</code>. Values do not have parents.
- *
- * @return <code>null</code>
- */
- IDebugElement getParent();
-
+
/**
* Returns whether this value is currently allocated.
* <p>
@@ -96,4 +72,13 @@ public interface IValue extends IDebugElement {
* allocated on the target
*/
boolean isAllocated() throws DebugException;
+ /**
+ * Returns the visible variables in this value. An empty
+ * collection is returned if there are no visible variables.
+ *
+ * @return collection of visible variables
+ * @exception DebugException if unable to retrieve variables
+ * from the target
+ */
+ IVariable[] getVariables() throws DebugException;
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
index 513c17800..d3840daba 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
@@ -44,17 +44,6 @@ import org.eclipse.debug.core.DebugException;
*/
public interface IVariable extends IDebugElement, IValueModification {
/**
- * Returns the children of this elemnet. Implementations of
- * <code>IVariable</code> return an empty collection.
- *
- * @return an empty collection
- * @see IDebugElement
- * @exception DebugException if an unable to retrieve children from
- * the target
- */
- IDebugElement[] getChildren() throws DebugException;
-
- /**
* Returns the value of this variable.
*
* @return variable value
@@ -62,7 +51,15 @@ public interface IVariable extends IDebugElement, IValueModification {
* from the target
*/
IValue getValue() throws DebugException;
-
+ /**
+ * Returns the name of this variable. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this variable's name
+ * @exception DebugException if unable to retrieve this element's name from
+ * the target
+ */
+ String getName() throws DebugException;
/**
* Returns a description of the type of data this variable is
* declared to reference. Note that the type of a variable
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java
index 4e367204a..327b04cb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java
@@ -111,5 +111,12 @@ public abstract class BasicContentProvider implements IStructuredContentProvider
protected abstract void doHandleDebugEvent(DebugEvent event);
protected abstract Object[] doGetChildren(Object parent);
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public boolean hasChildren(Object item) {
+ return doGetChildren(item).length > 0;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
index e02f9709a..cde878b71 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
@@ -78,10 +78,7 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
buffer.append(System.getProperty("line.separator"));
if (shouldAppendChildren(e)) {
Object[] children= new Object[0];
- try {
- children= getChildren(e);
- } catch (DebugException de) {
- }
+ children= getChildren(e);
for (int i = 0;i < children.length; i++) {
Object de= children[i];
append(de, buffer, lp, indent + 1);
@@ -93,9 +90,26 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
return IDebugHelpContextIds.COPY_TO_CLIPBOARD_ACTION;
}
- protected Object[] getChildren(Object e) throws DebugException {
- return ((IDebugElement)e).getChildren();
+ protected Object getParent(Object e) {
+ return ((ITreeContentProvider) fViewer.getContentProvider()).getParent(e);
}
+
+ /**
+ * Returns the children of the parent after applying the filters
+ * that are present in the viewer.
+ */
+ protected Object[] getChildren(Object parent) {
+ Object[] children= ((ITreeContentProvider)fViewer.getContentProvider()).getChildren(parent);
+ ViewerFilter[] filters= ((StructuredViewer)fViewer).getFilters();
+ if (filters != null) {
+ for (int i= 0; i < filters.length; i++) {
+ ViewerFilter f = filters[i];
+ children = f.filter(fViewer, parent, children);
+ }
+ }
+ return children;
+ }
+
/**
* Do the specific action using the current selection.
*/
@@ -143,10 +157,7 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
* element is already contained in the collection.
*/
protected boolean walkHierarchy(Object element, List elements) {
- Object parent= null;
- if (element instanceof IDebugElement) {
- parent= ((IDebugElement)element).getParent();
- }
+ Object parent= getParent(element);
if (parent == null) {
return true;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyVariablesToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyVariablesToClipboardActionDelegate.java
index 8448aeaf5..b73fb3475 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyVariablesToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyVariablesToClipboardActionDelegate.java
@@ -7,6 +7,7 @@ package org.eclipse.debug.internal.ui;
import java.util.Iterator;
import java.util.List;
+
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.*;
import org.eclipse.jface.action.IAction;
@@ -47,22 +48,6 @@ public class CopyVariablesToClipboardActionDelegate extends CopyToClipboardActio
}
/**
- * Returns the children of the parent after applying the filters
- * that are present in the viewer.
- */
- protected Object[] getChildren(Object parent) {
- Object[] children= ((BasicContentProvider)fViewer.getContentProvider()).getChildren(parent);
- ViewerFilter[] filters= ((StructuredViewer)fViewer).getFilters();
- if (filters != null) {
- for (int i= 0; i < filters.length; i++) {
- ViewerFilter f = filters[i];
- children = f.filter(fViewer, parent, children);
- }
- }
- return children;
- }
-
- /**
* @see ControlActionDelegate
*/
public boolean isEnabledFor(Object element) {
@@ -70,37 +55,6 @@ public class CopyVariablesToClipboardActionDelegate extends CopyToClipboardActio
}
/**
- * Returns whether the parent of the specified
- * element is already contained in the collection.
- */
- protected boolean walkHierarchy(Object element, List elements) {
- IDebugElement parent= null;
- if (element instanceof IVariable) {
- parent= ((IVariable)element).getParent();
- }
- if (parent == null || parent.getElementType() == IDebugElement.STACK_FRAME) {
- return true;
- }
- Iterator i= elements.iterator();
- while (i.hasNext()) {
- Object o= i.next();
- try {
- if (o instanceof IVariable
- && ((IVariable)o).getValue().equals(parent)) {
- return false;
- }
- if (o instanceof InspectItem
- && ((InspectItem)o).getValue().equals(parent)) {
- return false;
- }
- } catch (DebugException e) {
- }
- }
-
- return walkHierarchy(((IValue)parent).getVariable(), elements);
- }
-
- /**
* @see IActionDelegate
*/
public void selectionChanged(IAction action, ISelection s) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java
index a2224f9ad..58708b58c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java
@@ -29,22 +29,22 @@ public class DebugContentProvider extends BasicContentProvider implements IDebug
* @see BasicContentProvider#doGetChildren(Object)
*/
protected Object[] doGetChildren(Object parent) {
- if (parent instanceof IDebugElement) {
- IDebugElement de= (IDebugElement) parent;
- if (de.getElementType() < IDebugElement.STACK_FRAME) {
- try {
- return de.getChildren();
- } catch (DebugException e) {
- DebugUIUtils.logError(e);
- }
+ try {
+ if (parent instanceof IDebugTarget) {
+ return ((IDebugTarget)parent).getThreads();
}
- } else
- if (parent instanceof ILaunch) {
- return ((ILaunch)parent).getChildren();
- } else
- if (parent instanceof ILaunchManager) {
- return ((ILaunchManager) parent).getLaunches();
- }
+ if (parent instanceof IThread) {
+ return ((IThread)parent).getStackFrames();
+ }
+ } catch (DebugException e) {
+ DebugUIUtils.logError(e);
+ }
+ if (parent instanceof ILaunch) {
+ return ((ILaunch)parent).getChildren();
+ }
+ if (parent instanceof ILaunchManager) {
+ return ((ILaunchManager) parent).getLaunches();
+ }
return new Object[0];
}
@@ -63,20 +63,22 @@ public class DebugContentProvider extends BasicContentProvider implements IDebug
*/
public Object getParent(Object item) {
Object parent= null;
- if (item instanceof IDebugElement) {
- IDebugElement de= (IDebugElement) item;
- parent= de.getParent();
- if (parent == null) {
- parent= de.getLaunch();
- }
- } else
- if (item instanceof IProcess) {
- parent= ((IProcess) item).getLaunch();
- } else
- if (item instanceof ILaunch) {
- parent= DebugPlugin.getDefault().getLaunchManager();
- }
- return parent;
+ if (item instanceof IStackFrame) {
+ return ((IStackFrame)item).getThread();
+ }
+ if (item instanceof IThread) {
+ return ((IThread)item).getDebugTarget();
+ }
+ if (item instanceof IDebugTarget) {
+ return ((IDebugElement)item).getLaunch();
+ }
+ if (item instanceof IProcess) {
+ return ((IProcess)item).getLaunch();
+ }
+ if (item instanceof ILaunch) {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+ return null;
}
/**
@@ -198,10 +200,7 @@ public class DebugContentProvider extends BasicContentProvider implements IDebug
// No children shown for IStackFrames in this view (see the variables view instead).
} else
if (item instanceof IDebugElement) {
- try {
- return ((IDebugElement) item).hasChildren();
- } catch (DebugException de) {
- }
+ return doGetChildren(item).length > 0;
} else
if (item instanceof ILaunch) {
return true;
@@ -225,9 +224,9 @@ public class DebugContentProvider extends BasicContentProvider implements IDebug
if (targets.length > 0) {
IDebugTarget target= targets[targets.length - 1];
try {
- IDebugElement[] threads= target.getChildren();
+ IThread[] threads= target.getThreads();
for (int i=0; i < threads.length; i++) {
- if (((IThread)threads[i]).isSuspended()) {
+ if (threads[i].isSuspended()) {
((LaunchesViewer)fViewer).autoExpand(threads[i], false);
return;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 6e2bef878..f52022f55 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -932,7 +932,7 @@ public static Object createExtension(final IConfigurationElement element, final
}
} else
if (input instanceof IDebugElement) {
- processInput= ((IDebugElement) input).getProcess();
+ processInput= ((IDebugElement) input).getDebugTarget().getProcess();
}
if ((processInput == null) || (processInput.getLaunch() == null)) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java
index 9035b425e..6a915413d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java
@@ -5,7 +5,21 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import org.eclipse.core.resources.*; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.*; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.action.*; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.viewers.*; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.*; import org.eclipse.ui.help.ViewContextComputer; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.*;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.*;
+import org.eclipse.ui.help.ViewContextComputer;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.texteditor.ITextEditor;
public class DebugView extends LaunchesView implements IPartListener {
@@ -190,7 +204,11 @@ public class DebugView extends LaunchesView implements IPartListener {
IStackFrame stackFrame= (IStackFrame) debugElement;
// Get the corresponding element.
- ISourceLocator locator= stackFrame.getSourceLocator();
+ ILaunch launch = stackFrame.getLaunch();
+ if (launch == null) {
+ return;
+ }
+ ISourceLocator locator= launch.getSourceLocator();
if (locator == null) {
return;
}
@@ -440,7 +458,7 @@ public class DebugView extends LaunchesView implements IPartListener {
if (dt != null) {
selectee= dt;
try {
- children= dt.getChildren();
+ children= dt.getThreads();
} catch (DebugException de) {
DebugUIUtils.logError(de);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
index 4f2091fe8..042bd5fc7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -205,7 +205,18 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
public String getDefaultText(Object element) {
if (element instanceof IDebugElement) {
try {
- return ((IDebugElement) element).getName();
+ switch (((IDebugElement) element).getElementType()) {
+ case IDebugElement.DEBUG_TARGET:
+ return ((IDebugTarget)element).getName();
+ case IDebugElement.THREAD:
+ return ((IThread)element).getName();
+ case IDebugElement.STACK_FRAME:
+ return ((IStackFrame)element).getName();
+ case IDebugElement.VARIABLE:
+ return ((IVariable)element).getName();
+ default:
+ return "";
+ }
} catch (DebugException de) {
}
} else
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java
index 0b263788a..b34fc83e8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java
@@ -5,7 +5,11 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import java.util.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; import org.eclipse.jface.viewers.*;
+import java.util.*;
+
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jface.viewers.*;
public class InspectorContentProvider extends BasicContentProvider implements ITreeContentProvider, IDebugEventListener {
@@ -19,10 +23,7 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
*/
protected RemoveAllFromInspectorAction fRemoveAllFromInspectorAction;
- /**
- * A table of root values in the inspector
- */
- protected Hashtable fRootValuesTable;
+ protected HashMap fParentCache;
/**
* Constructs a new inspector content provider
@@ -30,7 +31,7 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
public InspectorContentProvider(RemoveAllFromInspectorAction action) {
fRemoveAllFromInspectorAction= action;
fInspectorList = new InspectorList(3);
- fRootValuesTable = new Hashtable(3);
+ fParentCache = new HashMap(10);
DebugPlugin.getDefault().addDebugEventListener(this);
enableRemoveAllFromInspectorAction();
}
@@ -39,64 +40,42 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
* @see ITreeContentProvider
*/
public Object getParent(Object child) {
- if (fInspectorList == child) {
- return null;
- } else if (child instanceof InspectItem) {
+ if (child instanceof InspectItem) {
return fInspectorList;
- } else if (child instanceof IVariable) {
- Object parent = ((IVariable)child).getParent();
- if (parent instanceof IValue) {
- IValue value = (IValue)parent;
- Object inspectItem = fRootValuesTable.get(value);
- if (inspectItem != null) {
- return inspectItem;
- } else {
- return value.getVariable();
- }
- } else {
- return null;
- }
- } else {
- return null;
}
+ return fParentCache.get(child);
+
}
/**
* @see BasicContentProvider#doGetChildren(Object)
*/
protected Object[] doGetChildren(Object parent) {
+ Object[] children= null;
if (parent == fInspectorList) {
- return fInspectorList.getList().toArray();
- }
- try {
- if (parent instanceof IVariable) {
- return ((IVariable)parent).getValue().getChildren();
- }
- if (parent instanceof InspectItem) {
- return ((InspectItem)parent).getValue().getChildren();
- }
- } catch (DebugException de) {
- DebugUIUtils.logError(de);
- }
- return new Object[0];
- }
+ children = fInspectorList.getList().toArray();
+ } else {
+ try {
+ if (parent instanceof InspectItem) {
+ children = ((InspectItem)parent).getValue().getVariables();
+ } else if (parent instanceof IVariable) {
+ children = ((IVariable)parent).getValue().getVariables();
+ }
- /**
- * @see ITreeContentProvider
- */
- public boolean hasChildren(Object parent) {
- if (parent == fInspectorList) {
- return !fInspectorList.isEmpty();
- }
- try {
- if (parent instanceof InspectItem) {
- return ((InspectItem)parent).getValue().hasChildren();
- } else{
- return ((IVariable)parent).getValue().hasChildren();
+ } catch (DebugException de) {
+ DebugUIUtils.logError(de);
}
- } catch (DebugException de) {
- return false;
}
+
+ if (children == null) {
+ return new Object[0];
+ }
+
+ for (int i = 0; i < children.length; i++) {
+ fParentCache.put(children[i], parent);
+ }
+ return children;
+
}
/**
@@ -113,6 +92,7 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
super.dispose();
fInspectorList = new InspectorList(0);
DebugPlugin.getDefault().removeDebugEventListener(this);
+ fParentCache= null;
}
/**
@@ -140,7 +120,7 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
}
if (!allocated) {
itr.remove();
- fRootValuesTable.remove(item.getValue());
+ clearCache(item);
}
}
refresh();
@@ -206,7 +186,6 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
public void addToInspector(InspectItem item) {
List inspectorList = getInspectorList().getList();
if (!inspectorList.contains(item)) {
- fRootValuesTable.put(item.getValue(), item);
inspectorList.add(item);
insert(item);
}
@@ -217,7 +196,7 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
*/
public void removeFromInspector(InspectItem item) {
getInspectorList().getList().remove(item);
- fRootValuesTable.remove(item.getValue());
+ clearCache(item);
remove(item);
}
@@ -229,4 +208,15 @@ public class InspectorContentProvider extends BasicContentProvider implements IT
boolean enable= getInspectorList().isEmpty() ? false : true;
fRemoveAllFromInspectorAction.setEnabled(enable);
}
+
+ protected void clearCache(Object parent) {
+ Iterator iter = ((HashMap)fParentCache.clone()).keySet().iterator();
+ while (iter.hasNext()) {
+ Object child = iter.next();
+ if (parent.equals(fParentCache.get(child))) {
+ fParentCache.remove(child);
+ clearCache(child);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
index 63f23f5cb..c84ec56ab 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
@@ -34,8 +34,7 @@ public class TerminateAndRemoveActionDelegate extends ControlActionDelegate {
if (element instanceof ILaunch) {
launch= (ILaunch) element;
} else if (element instanceof IDebugElement) {
- IDebugElement de= (IDebugElement) element;
- launch= de.getLaunch();
+ launch= ((IDebugElement) element).getLaunch();
} else if (element instanceof IProcess) {
launch= ((IProcess) element).getLaunch();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java
index a43ee77f2..e73e3e204 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java
@@ -5,34 +5,42 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
+import java.util.HashMap;
+
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.ui.internal.IPreferenceConstants;
/**
* Provide the contents for a variables viewer.
*/
public class VariablesContentProvider extends BasicContentProvider implements IDebugEventListener, ITreeContentProvider {
+
+ protected HashMap fParentCache;
+
/**
* Constructs a new provider
*/
public VariablesContentProvider() {
DebugPlugin.getDefault().addDebugEventListener(this);
+ fParentCache = new HashMap(10);
}
/**
* @see BasicContentProvider#doGetChildren(Object)
*/
protected Object[] doGetChildren(Object parent) {
+ Object[] children= null;
try {
- if (parent instanceof IStackFrame || parent instanceof IValue) {
- return ((IDebugElement) parent).getChildren();
+ if (parent instanceof IStackFrame) {
+ children = ((IStackFrame)parent).getVariables();
} else if (parent instanceof IVariable) {
- return ((IVariable)parent).getValue().getChildren();
+ children = ((IVariable)parent).getValue().getVariables();
+ }
+ for (int i = 0; i < children.length; i++) {
+ fParentCache.put(children[i], parent);
}
+ return children;
} catch (DebugException de) {
DebugUIUtils.logError(de);
}
@@ -50,14 +58,7 @@ public class VariablesContentProvider extends BasicContentProvider implements ID
* @see ITreeContentProvider
*/
public Object getParent(Object item) {
- Object parent = null;
- if (item instanceof IVariable) {
- parent = ((IVariable) item).getParent();
- }
- if (parent instanceof IValue) {
- parent = ((IValue)parent).getVariable();
- }
- return parent;
+ return fParentCache.get(item);
}
/**
@@ -73,27 +74,17 @@ public class VariablesContentProvider extends BasicContentProvider implements ID
}
/**
- * @see ITreeContentProvider
- */
- public boolean hasChildren(Object item) {
- try {
- if (item instanceof IVariable) {
- return ((IVariable)item).getValue().hasChildren();
- } else {
- return ((IDebugElement) item).hasChildren();
- }
- } catch (DebugException de) {
- return false;
- }
- }
-
- /**
* Unregisters this content provider from the debug plugin so that
* this object can be garbage-collected.
*/
public void dispose() {
super.dispose();
DebugPlugin.getDefault().removeDebugEventListener(this);
+ fParentCache=null;
+ }
+
+ protected void clearCache() {
+ fParentCache.clear();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java
index b47c7347e..6594a6be5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java
@@ -5,7 +5,15 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.*; import org.eclipse.ui.help.ViewContextComputer; import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.*;
+import org.eclipse.ui.help.ViewContextComputer;
+import org.eclipse.ui.help.WorkbenchHelp;
/**
* This view shows variables and their values for a particular stack frame
@@ -52,24 +60,25 @@ public class VariablesView extends AbstractDebugView implements ISelectionListen
}
protected void setViewerInput(IStructuredSelection ssel) {
- IDebugElement de= null;
+ IStackFrame frame= null;
if (ssel.size() == 1) {
Object input= ssel.getFirstElement();
- if (input != null && input instanceof IDebugElement) {
- de= ((IDebugElement) input).getStackFrame();
+ if (input != null && input instanceof IStackFrame) {
+ frame= (IStackFrame)input;
}
}
Object current= fViewer.getInput();
- if (current == null && de == null) {
+ if (current == null && frame == null) {
return;
}
- if (current != null && current.equals(de)) {
+ if (current != null && current.equals(frame)) {
return;
}
- fViewer.setInput(de);
+ ((VariablesContentProvider)fViewer.getContentProvider()).clearCache();
+ fViewer.setInput(frame);
}
/**
* @see IWorkbenchPart

Back to the top