Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2005-11-19 22:29:18 -0500
committerDarin Wright2005-11-19 22:29:18 -0500
commitab02eb2aface148e389f01c2deeb5eb1efd025bb (patch)
tree3101d398b0b29e0e2e7894fa8122e3a7078cc89c
parent3519890d27cc3005ed13a75137b643d87aecbb23 (diff)
downloadeclipse.platform.debug-async_viewer_branch_2.tar.gz
eclipse.platform.debug-async_viewer_branch_2.tar.xz
eclipse.platform.debug-async_viewer_branch_2.zip
Bug 117095 - [flex-hierarchy] resuming one thread does not select next suspended threadasync_viewer_branch_2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTreeViewer.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/RemoveRequestMonitor.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java51
4 files changed, 60 insertions, 8 deletions
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 77f6f37b1..90ec23ea5 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
@@ -936,6 +936,16 @@ public class AsynchronousTreeViewer extends AsynchronousViewer {
}
}
+ synchronized void remove(final Widget widget) {
+ preservingSelection(new Runnable() {
+ public void run() {
+ Object element = widget.getData();
+ unmap(element, widget);
+ widget.dispose();
+ }
+ });
+ }
+
void setLabels(Widget widget, String[] text, ImageDescriptor[] image) {
if (widget instanceof TreeItem) {
TreeItem item = (TreeItem) widget;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/RemoveRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/RemoveRequestMonitor.java
index 989b618b0..33b004951 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/RemoveRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/RemoveRequestMonitor.java
@@ -33,10 +33,7 @@ class RemoveRequestMonitor extends AbstractAddRemoveRequestMonitor {
* @see org.eclipse.debug.internal.ui.viewers.AsynchronousRequestMonitor#performUpdate()
*/
protected void performUpdate() {
- Widget widget = getWidget();
- Object element = widget.getData();
- getViewer().unmap(element, widget);
- widget.dispose();
+ ((AsynchronousTreeViewer)getViewer()).remove(getWidget());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
index 68db30414..516e298e3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
@@ -83,7 +83,7 @@ public class DefaultSelectionPolicy implements IModelSelectionPolicy {
if (existing instanceof IStackFrame && candidate instanceof IStackFrame) {
IStackFrame curr = (IStackFrame) existing;
IStackFrame next = (IStackFrame) candidate;
- return curr.getThread().equals(next.getThread());
+ return curr.getThread().equals(next.getThread()) || !isSticky(existing);
}
return !isSticky(existing);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
index e6e44054a..ef540778a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
@@ -11,7 +11,9 @@
package org.eclipse.debug.internal.ui.viewers.update;
import java.util.HashMap;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
@@ -27,6 +29,13 @@ import org.eclipse.debug.internal.ui.viewers.IModelProxy;
*/
public class ThreadEventHandler extends DebugEventHandler {
+ /**
+ * Queue of suspended threads to choose from when needing
+ * to select a thread when another is resumed. Threads
+ * are added in the order they suspend.
+ */
+ private Set fThreadQueue = new LinkedHashSet();
+
/**
* Map of previous TOS per thread
*/
@@ -44,6 +53,9 @@ public class ThreadEventHandler extends DebugEventHandler {
synchronized (fLastTopFrame) {
fLastTopFrame.clear();
}
+ synchronized (fThreadQueue) {
+ fThreadQueue.clear();
+ }
super.dispose();
}
@@ -59,6 +71,7 @@ public class ThreadEventHandler extends DebugEventHandler {
} catch (DebugException e) {
}
} else {
+ queueSuspendedThread(event);
fireDeltaUpdatingTopFrame(thread, IModelDelta.NOCHANGE);
}
}
@@ -74,7 +87,12 @@ public class ThreadEventHandler extends DebugEventHandler {
}
protected void handleResume(DebugEvent event) {
- fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.CHANGED | IModelDelta.STATE | IModelDelta.CONTENT);
+ IThread thread = removeSuspendedThread(event);
+ fireDeltaAndClearTopFrame(thread, IModelDelta.CHANGED | IModelDelta.STATE | IModelDelta.CONTENT);
+ thread = getNextSuspendedThread();
+ if (thread != null) {
+ fireDeltaUpdatingTopFrame(thread, IModelDelta.NOCHANGE);
+ }
}
protected void handleCreate(DebugEvent event) {
@@ -90,11 +108,13 @@ public class ThreadEventHandler extends DebugEventHandler {
}
protected void handleLateSuspend(DebugEvent suspend, DebugEvent resume) {
- fireDeltaUpdatingTopFrame((IThread) suspend.getSource(), IModelDelta.CHANGED | IModelDelta.CONTENT | IModelDelta.EXPAND);
+ IThread thread = queueSuspendedThread(suspend);
+ fireDeltaUpdatingTopFrame(thread, IModelDelta.CHANGED | IModelDelta.CONTENT | IModelDelta.EXPAND);
}
protected void handleSuspendTimeout(DebugEvent event) {
- fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.CHANGED | IModelDelta.CONTENT);
+ IThread thread = removeSuspendedThread(event);
+ fireDeltaAndClearTopFrame(thread, IModelDelta.CHANGED | IModelDelta.CONTENT);
}
private IModelDeltaNode buildBaseDelta(ModelDelta delta, IThread thread) {
@@ -143,5 +163,30 @@ public class ThreadEventHandler extends DebugEventHandler {
protected boolean handlesEvent(DebugEvent event) {
return event.getSource() instanceof IThread;
}
+
+ protected IThread queueSuspendedThread(DebugEvent event) {
+ IThread thread = (IThread) event.getSource();
+ synchronized (fThreadQueue) {
+ fThreadQueue.add(thread);
+ }
+ return thread;
+ }
+
+ protected IThread removeSuspendedThread(DebugEvent event) {
+ IThread thread = (IThread)event.getSource();
+ synchronized (fThreadQueue) {
+ fThreadQueue.remove(thread);
+ }
+ return thread;
+ }
+
+ protected IThread getNextSuspendedThread() {
+ synchronized (fThreadQueue) {
+ if (!fThreadQueue.isEmpty()) {
+ return (IThread) fThreadQueue.iterator().next();
+ }
+ }
+ return null;
+ }
}

Back to the top