Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-05-18 15:19:55 +0000
committerDarin Wright2006-05-18 15:19:55 +0000
commitaa63df39a6cd7d1290cbcb28a559b8335bd0be3a (patch)
tree3f58987b1622f8bc8a9f128485c44b2dc26208f9 /org.eclipse.debug.ui/ui/org
parent015094fd16efad5314329d2b0004ab0cd5fa6edd (diff)
downloadeclipse.platform.debug-aa63df39a6cd7d1290cbcb28a559b8335bd0be3a.tar.gz
eclipse.platform.debug-aa63df39a6cd7d1290cbcb28a559b8335bd0be3a.tar.xz
eclipse.platform.debug-aa63df39a6cd7d1290cbcb28a559b8335bd0be3a.zip
Bug 139839 - [source lookup] disconnect from PDE source locator
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java8
4 files changed, 60 insertions, 3 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
index 29cbe612b..e84654638 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
@@ -172,6 +172,9 @@ public class InstructionPointerManager {
// Remove all annotations for the thread
removeAnnotations(thread, threadMap);
+ if (threadMap.isEmpty()) {
+ fDebugTargetMap.remove(debugTarget);
+ }
}
/**
@@ -206,4 +209,15 @@ public class InstructionPointerManager {
}
}
+ /**
+ * Returns the number of targets with cached instruction pointers.
+ * Used by the test suite.
+ *
+ * @return the number of targets with cached instruction pointers
+ * @since 3.2
+ */
+ public int getCachedTargetCount() {
+ return fDebugTargetMap.size();
+ }
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
index 0acee0d9b..2181d1fb5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameSourceDisplayAdapter.java
@@ -96,14 +96,14 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplayAdapter {
IStackFrame lookupFrame = fTarget;
ISourceLocator lookupLocator = fLocator;
- if (lookupFrame != null && lookupLocator != null) {
+ if (lookupFrame != null && lookupLocator != null && !lookupFrame.isTerminated()) {
ISourceLookupResult result = null;
result = DebugUITools.lookupSource(lookupFrame, lookupLocator);
synchronized (StackFrameSourceDisplayAdapter.this) {
fPrevResult = (SourceLookupResult)result;
fPrevFrame = lookupFrame;
}
- if (!monitor.isCanceled() && fPage != null) {
+ if (!monitor.isCanceled() && fPage != null && !lookupFrame.isTerminated()) {
fSourceDisplayJob.setDisplayInfo(result, fPage);
fSourceDisplayJob.schedule();
}
@@ -141,6 +141,13 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplayAdapter {
public synchronized IStatus runInUIThread(IProgressMonitor monitor) {
if (!monitor.isCanceled() && fResult != null && fPage != null) {
DebugUITools.displaySource(fResult, fPage);
+ // termination may have occurred while displaying source
+ if (monitor.isCanceled()) {
+ Object artifact = fResult.getArtifact();
+ if (artifact instanceof IStackFrame) {
+ clearSourceSelection(((IStackFrame)artifact).getThread());
+ }
+ }
}
setDisplayInfo(null, null);
return Status.OK_STATUS;
@@ -161,7 +168,6 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplayAdapter {
fSourceLookupJob.setLookupInfo(frame, frame.getLaunch().getSourceLocator(), page);
fSourceLookupJob.schedule();
}
-
}
/**
@@ -196,6 +202,7 @@ public class StackFrameSourceDisplayAdapter implements ISourceDisplayAdapter {
if (fPrevFrame.getDebugTarget().equals(target)) {
fPrevFrame = null;
fPrevResult = null;
+ fSourceDisplayJob.cancel();
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java
index 151706d30..248a816aa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java
@@ -1629,8 +1629,36 @@ public class AsynchronousTreeViewer extends AsynchronousViewer {
} else {
return ((TreeItem)parent).indexOf((TreeItem)child);
}
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.AsynchronousViewer#selectionExists(org.eclipse.jface.viewers.ISelection)
+ */
+ protected boolean selectionExists(ISelection selection) {
+ if (!selection.isEmpty() && selection instanceof TreeSelection) {
+ TreeSelection ts = (TreeSelection) selection;
+ TreePath[] paths = ts.getPaths();
+ int matchingPaths = 0;
+ for (int i = 0; i < paths.length; i++) {
+ TreePath path = paths[i];
+ Object element = path.getLastSegment();
+ ModelNode[] nodes = getModel().getNodes(element);
+ if (nodes != null) {
+ for (int j = 0; j < nodes.length; j++) {
+ ModelNode node = nodes[j];
+ if (node.getTreePath().equals(path)) {
+ matchingPaths++;
+ break;
+ }
+ }
+ }
+ }
+ return matchingPaths == paths.length;
+ }
+ return super.selectionExists(selection);
}
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
index 0a4b7828c..a146581d0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
@@ -749,6 +749,14 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
ISelection remaining = doAttemptSelectionToWidget(oldSelection, false);
// send out notification if old and new differ
fCurrentSelection = newSelectionFromWidget();
+ if (!selectionExists(fCurrentSelection)) {
+ if (selectionExists(oldSelection)) {
+ // old selection exists in the model, but not widget
+ fCurrentSelection = oldSelection;
+ } else {
+ fCurrentSelection = getEmptySelection();
+ }
+ }
if (!fCurrentSelection.equals(oldSelection)) {
handleInvalidSelection(oldSelection, fCurrentSelection);
// if the remaining selection still exists in the model, make it pending

Back to the top