Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-06-20 15:47:29 -0400
committereutarass2011-06-20 15:47:29 -0400
commit14ebb9c053ceadf10d46cb98643d54423dc5257a (patch)
treeb928c97d1d9c18480d625d93e8c629f6e3032f5d /plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse
parentc2101475b4ae4e435d4ada7c25839f1a8c9df229 (diff)
downloadorg.eclipse.tcf-14ebb9c053ceadf10d46cb98643d54423dc5257a.tar.gz
org.eclipse.tcf-14ebb9c053ceadf10d46cb98643d54423dc5257a.tar.xz
org.eclipse.tcf-14ebb9c053ceadf10d46cb98643d54423dc5257a.zip
TCF Debugger: implemented "Refresh" menu commands in debugger views.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java44
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java4
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java50
4 files changed, 93 insertions, 23 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
new file mode 100644
index 000000000..4e781c5c8
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
@@ -0,0 +1,44 @@
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
+import org.eclipse.tm.tcf.util.TCFTask;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+public class RefreshCommand extends AbstractActionDelegate {
+
+ @Override
+ protected void selectionChanged() {
+ getAction().setEnabled(getRootNode() != null);
+ }
+
+ @Override
+ protected void run() {
+ final TCFNode n = getRootNode();
+ if (n == null) return;
+ new TCFTask<Object>(n.getChannel()) {
+ public void run() {
+ n.refresh(getView());
+ done(null);
+ }
+ }.getE();
+ }
+
+ private TCFNode getRootNode() {
+ IViewPart view = getView();
+ if (view == null) return null;
+ IWorkbenchPartSite site = view.getSite();
+ if (site != null && IDebugUIConstants.ID_DEBUG_VIEW.equals(site.getId())) {
+ TCFNode n = getSelectedNode();
+ if (n == null) return null;
+ return n.getModel().getRootNode();
+ }
+ if (view instanceof IDebugView) {
+ Object input = ((IDebugView)view).getViewer().getInput();
+ if (input instanceof TCFNode) return (TCFNode)input;
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
index 2ec3b71d5..827347d04 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
@@ -742,6 +742,10 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
mem_retrieval.remove(id);
}
+ void flushAllCaches() {
+ for (TCFNode n : id2node.values()) n.flushAllCaches();
+ }
+
IExpressionManager getExpressionManager() {
return expr_manager;
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
index 89648fa9c..039de334d 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
@@ -20,11 +20,13 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpd
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.Protocol;
import org.eclipse.tm.tcf.util.TCFDataCache;
+import org.eclipse.ui.IViewPart;
/**
@@ -104,6 +106,14 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
}
/**
+ * Flush (reset) all node data caches.
+ */
+ void flushAllCaches() {
+ if (caches == null) return;
+ for (TCFDataCache<?> c : caches) c.reset();
+ }
+
+ /**
* Dispose this node and its children. The node is removed from the model.
*/
void dispose() {
@@ -375,6 +385,14 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
/*--------------------------------------------------------------------------------------*/
/* Misc */
+ public void refresh(IViewPart view) {
+ model.flushAllCaches();
+ for (TCFModelProxy p : model.getModelProxies()) {
+ if (p.getPresentationContext().getPart() != view) continue;
+ p.addDelta(this, IModelDelta.STATE | IModelDelta.CONTENT);
+ }
+ }
+
public int compareTo(TCFNode n) {
return id.compareTo(n.id);
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
index 76210252d..e473a38e7 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
@@ -740,7 +740,8 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@Override
protected boolean getData(IChildrenCountUpdate result, Runnable done) {
TCFChildren children = null;
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(result.getPresentationContext().getId())) {
+ String view_id = result.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) {
@@ -765,22 +766,22 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
children = children_exec;
}
}
- else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_regs;
}
- else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_exps;
}
- else if (TCFModel.ID_EXPRESSION_HOVER.equals(result.getPresentationContext().getId())) {
+ else if (TCFModel.ID_EXPRESSION_HOVER.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_hover_exps;
}
- else if (IDebugUIConstants.ID_MODULE_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_MODULE_VIEW.equals(view_id)) {
if (!mem_context.validate(done)) return false;
IMemory.MemoryContext ctx = mem_context.getData();
if (ctx != null) children = children_modules;
@@ -799,7 +800,8 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@Override
protected boolean getData(IChildrenUpdate result, Runnable done) {
TCFChildren children = null;
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(result.getPresentationContext().getId())) {
+ String view_id = result.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) {
@@ -831,22 +833,22 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
children = children_exec;
}
}
- else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_regs;
}
- else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_exps;
}
- else if (TCFModel.ID_EXPRESSION_HOVER.equals(result.getPresentationContext().getId())) {
+ else if (TCFModel.ID_EXPRESSION_HOVER.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_hover_exps;
}
- else if (IDebugUIConstants.ID_MODULE_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_MODULE_VIEW.equals(view_id)) {
if (!mem_context.validate(done)) return false;
IMemory.MemoryContext ctx = mem_context.getData();
if (ctx != null) children = children_modules;
@@ -862,7 +864,8 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@Override
protected boolean getData(IHasChildrenUpdate result, Runnable done) {
TCFChildren children = null;
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(result.getPresentationContext().getId())) {
+ String view_id = result.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) {
@@ -887,22 +890,22 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
children = children_exec;
}
}
- else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_regs;
}
- else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_exps;
}
- else if (TCFModel.ID_EXPRESSION_HOVER.equals(result.getPresentationContext().getId())) {
+ else if (TCFModel.ID_EXPRESSION_HOVER.equals(view_id)) {
if (!run_context.validate(done)) return false;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) children = children_hover_exps;
}
- else if (IDebugUIConstants.ID_MODULE_VIEW.equals(result.getPresentationContext().getId())) {
+ else if (IDebugUIConstants.ID_MODULE_VIEW.equals(view_id)) {
if (!mem_context.validate(done)) return false;
IMemory.MemoryContext ctx = mem_context.getData();
if (ctx != null) children = children_modules;
@@ -920,6 +923,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@Override
protected boolean getData(ILabelUpdate result, Runnable done) {
+ result.getViewerInput();
if (!run_context.validate(done)) return false;
String image_name = null;
boolean suspended_by_bp = false;
@@ -1035,13 +1039,13 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@Override
protected boolean getData(IViewerInputUpdate result, Runnable done) {
result.setInputElement(result.getElement());
- String id = result.getPresentationContext().getId();
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id)) {
+ String view_id = result.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(view_id)) {
if (!children_stack.validate(done)) return false;
TCFNodeStackFrame frame = children_stack.getTopFrame();
if (frame != null) result.setInputElement(frame);
}
- else if (IDebugUIConstants.ID_MODULE_VIEW.equals(id)) {
+ else if (IDebugUIConstants.ID_MODULE_VIEW.equals(view_id)) {
TCFDataCache<TCFNodeExecContext> mem = model.searchMemoryContext(this);
if (mem == null) return true;
if (!mem.validate(done)) return false;
@@ -1075,11 +1079,11 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
private void postContentChangedDelta() {
for (TCFModelProxy p : model.getModelProxies()) {
int flags = 0;
- String id = p.getPresentationContext().getId();
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(id)) flags |= IModelDelta.CONTENT;
- if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
- IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id) ||
- TCFModel.ID_EXPRESSION_HOVER.equals(id)) {
+ String view_id = p.getPresentationContext().getId();
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(view_id)) flags |= IModelDelta.CONTENT;
+ if (IDebugUIConstants.ID_REGISTER_VIEW.equals(view_id) ||
+ IDebugUIConstants.ID_EXPRESSION_VIEW.equals(view_id) ||
+ TCFModel.ID_EXPRESSION_HOVER.equals(view_id)) {
if (p.getInput() == this) flags |= IModelDelta.CONTENT;
}
if (flags == 0) continue;

Back to the top