Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-09-13 18:24:47 +0000
committereutarass2011-09-13 18:24:47 +0000
commitb09479647a76f3589babc75c0ddcb707ada31fde (patch)
treecdc6a03fbf6516b7332a411fc9c9b30504883759 /plugins
parent99f575fe1a32f7a5d8d1a8740062b98a0cc1f62e (diff)
downloadorg.eclipse.tcf-b09479647a76f3589babc75c0ddcb707ada31fde.tar.gz
org.eclipse.tcf-b09479647a76f3589babc75c0ddcb707ada31fde.tar.xz
org.eclipse.tcf-b09479647a76f3589babc75c0ddcb707ada31fde.zip
TCF Debugger: added handling of invalid selection in the Debug view.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelSelectionPolicy.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelSelectionPolicy.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelSelectionPolicy.java
index f8457bc61..d860fdd7e 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelSelectionPolicy.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelSelectionPolicy.java
@@ -15,6 +15,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
import org.eclipse.tm.tcf.services.IRunControl;
import org.eclipse.tm.tcf.util.TCFDataCache;
@@ -108,7 +109,21 @@ class TCFModelSelectionPolicy implements IModelSelectionPolicy {
return true;
}
- public ISelection replaceInvalidSelection(ISelection invalid_selection, ISelection new_selection) {
- return new_selection;
+ public ISelection replaceInvalidSelection(ISelection existing, ISelection candidate) {
+ if (existing instanceof IStructuredSelection && candidate instanceof IStructuredSelection) {
+ Object el_existing = ((IStructuredSelection)existing).getFirstElement();
+ Object el_candidate = ((IStructuredSelection)candidate).getFirstElement();
+ if (el_candidate == null) {
+ if (el_existing == null) return new StructuredSelection(model.getLaunch());
+ if (el_existing instanceof TCFNode) {
+ TCFNode node = (TCFNode)el_existing;
+ if (node.parent == null || node.parent instanceof TCFNodeLaunch) {
+ return new StructuredSelection(model.getLaunch());
+ }
+ return new StructuredSelection(node.parent);
+ }
+ }
+ }
+ return candidate;
}
}

Back to the top