Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2008-04-24 12:25:52 -0400
committerDarin Wright2008-04-24 12:25:52 -0400
commite9b86ae00d49cb4c30caeb9bb5a632f70e908488 (patch)
tree75b5bf93f4129ae74c9cdbc353f86ad44e678f5d
parent1ee5ed9a04ad5984c6f8df9c04f09de3da5c4263 (diff)
downloadeclipse.platform.debug-e9b86ae00d49cb4c30caeb9bb5a632f70e908488.tar.gz
eclipse.platform.debug-e9b86ae00d49cb4c30caeb9bb5a632f70e908488.tar.xz
eclipse.platform.debug-e9b86ae00d49cb4c30caeb9bb5a632f70e908488.zip
Bug 224477 - resume, suspend and step not enabled/disabled during stepping
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java51
1 files changed, 39 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
index 27b5ac470..3bc86c822 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
@@ -12,6 +12,7 @@
package org.eclipse.debug.internal.ui.views.launch;
+import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
@@ -75,8 +76,10 @@ import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
@@ -155,17 +158,16 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
class Visitor implements IModelDeltaVisitor {
public boolean visit(IModelDelta delta, int depth) {
- Object element = delta.getElement();
if ((delta.getFlags() & (IModelDelta.STATE | IModelDelta.CONTENT)) > 0) {
// state and/or content change
if ((delta.getFlags() & IModelDelta.SELECT) == 0) {
// no select flag
if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
// content has changed without select >> possible re-activation
- possibleChange(element, DebugContextEvent.ACTIVATED);
+ possibleChange(getViewerTreePath(delta), DebugContextEvent.ACTIVATED);
} else if ((delta.getFlags() & IModelDelta.STATE) > 0) {
// state has changed without select >> possible state change of active context
- possibleChange(element, DebugContextEvent.STATE);
+ possibleChange(getViewerTreePath(delta), DebugContextEvent.STATE);
}
}
}
@@ -173,6 +175,24 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
}
}
+ /**
+ * Returns a tree path for the node, *not* including the root element.
+ *
+ * @param node
+ * model delta
+ * @return corresponding tree path
+ */
+ private TreePath getViewerTreePath(IModelDelta node) {
+ ArrayList list = new ArrayList();
+ IModelDelta parentDelta = node.getParentDelta();
+ while (parentDelta != null) {
+ list.add(0, node.getElement());
+ node = parentDelta;
+ parentDelta = node.getParentDelta();
+ }
+ return new TreePath(list.toArray());
+ }
+
public ContextProvider(TreeModelViewer viewer) {
super(LaunchView.this);
fViewer = viewer;
@@ -198,18 +218,25 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi
fire(new DebugContextEvent(this, selection, DebugContextEvent.ACTIVATED));
}
- protected void possibleChange(Object element, int type) {
+ protected void possibleChange(TreePath element, int type) {
DebugContextEvent event = null;
synchronized (this) {
- if (fContext instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) fContext;
- if (!(ss.size() == 1 && ss.getFirstElement().equals(element))) {
- return;
+ if (fContext instanceof ITreeSelection) {
+ ITreeSelection ss = (ITreeSelection) fContext;
+ if (ss.size() == 1) {
+ TreePath current = ss.getPaths()[0];
+ if (current.startsWith(element, null)) {
+ if (type == DebugContextEvent.STATE || current.getSegmentCount() == element.getSegmentCount()) {
+ // update when a parent of the selected child changes state OR when
+ // the change is for the current context
+ event = new DebugContextEvent(this, fContext, type);
+ }
+ }
}
- } else {
- return;
- }
- event = new DebugContextEvent(this, fContext, type);
+ }
+ }
+ if (event == null) {
+ return;
}
if (getControl().getDisplay().getThread() == Thread.currentThread()) {
fire(event);

Back to the top