diff options
author | eutarass | 2011-08-03 22:27:10 +0000 |
---|---|---|
committer | eutarass | 2011-08-03 22:27:10 +0000 |
commit | 6cff684926058cde262b77b30dbb89550aa49924 (patch) | |
tree | 78c08a3395aec952884892df678f1931953fc71a /plugins/org.eclipse.tm.tcf.debug.ui/src/org | |
parent | 8e89b1f6fffdacc46b6123e3f95abf7dd7bf3457 (diff) | |
download | org.eclipse.tcf-6cff684926058cde262b77b30dbb89550aa49924.tar.gz org.eclipse.tcf-6cff684926058cde262b77b30dbb89550aa49924.tar.xz org.eclipse.tcf-6cff684926058cde262b77b30dbb89550aa49924.zip |
TCF Debugger: improved timing of view updates.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org')
6 files changed, 38 insertions, 26 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java index b1579410b..051883bc8 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java @@ -29,9 +29,7 @@ public class BackResumeCommand extends StepCommand { @Override protected boolean canExecute(IRunControl.RunControlContext ctx) { - if (ctx == null) return false; - if (ctx.canResume(IRunControl.RM_REVERSE_RESUME)) return true; - return false; + return ctx.canResume(IRunControl.RM_REVERSE_RESUME); } @Override diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java index d837b96a3..5400baae8 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java @@ -31,8 +31,7 @@ public class ResumeCommand extends StepCommand implements IResumeHandler { @Override protected boolean canExecute(IRunControl.RunControlContext ctx) { - if (ctx.canResume(IRunControl.RM_RESUME)) return true; - return false; + return ctx.canResume(IRunControl.RM_RESUME); } @Override diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java index 4d8cd9abb..bd652f7d1 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java @@ -40,7 +40,7 @@ abstract class StepCommand implements IDebugCommandHandler { protected abstract void execute(IDebugCommandRequest monitor, IRunControl.RunControlContext ctx, boolean src_step, Runnable done); - private boolean getContextSet(Object[] elements, Set<IRunControl.RunControlContext> set, Runnable done) { + private boolean getContextSet(boolean exec, Object[] elements, Set<IRunControl.RunControlContext> set, Runnable done) { for (int i = 0; i < elements.length; i++) { TCFNode node = null; if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i]; @@ -57,7 +57,7 @@ abstract class StepCommand implements IDebugCommandHandler { } else { int action_cnt = model.getLaunch().getContextActionsCount(ctx.getID()); - if (action_cnt >= MAX_ACTION_CNT) break; + if (exec && action_cnt >= MAX_ACTION_CNT) break; if (action_cnt == 0 && !ctx.isContainer()) { TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState(); if (!state_cache.validate(done)) return false; @@ -78,10 +78,12 @@ abstract class StepCommand implements IDebugCommandHandler { new TCFRunnable(monitor) { public void run() { if (done) return; - Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>(); - if (!getContextSet(monitor.getElements(), set, this)) return; - monitor.setEnabled(set.size() > 0); - monitor.setStatus(Status.OK_STATUS); + if (!monitor.isCanceled()) { + Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>(); + if (!getContextSet(false, monitor.getElements(), set, this)) return; + monitor.setEnabled(set.size() > 0); + monitor.setStatus(Status.OK_STATUS); + } done(); } }; @@ -92,7 +94,7 @@ abstract class StepCommand implements IDebugCommandHandler { public void run() { if (done) return; Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>(); - if (!getContextSet(monitor.getElements(), set, this)) return; + if (!getContextSet(true, monitor.getElements(), set, this)) return; if (set.size() == 0) { monitor.setStatus(Status.OK_STATUS); monitor.done(); diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java index f0d95c746..cf63fcb10 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFAnnotationManager.java @@ -532,14 +532,15 @@ public class TCFAnnotationManager { } } - private void updateAnnotations() { - final int cnt = ++update_unnotations_cnt; + private void updateAnnotations(final int cnt) { displayExec(new Runnable() { public void run() { - TCFNode node = null; - if (cnt != update_unnotations_cnt) return; + synchronized (TCFAnnotationManager.this) { + if (cnt != update_unnotations_cnt) return; + } for (IWorkbenchWindow window : windows.keySet()) { if (dirty_windows.contains(null) || dirty_windows.contains(window)) { + TCFNode node = null; try { ISelection active_context = DebugUITools.getDebugContextManager() .getContextService(window).getActiveContext(); @@ -557,8 +558,9 @@ public class TCFAnnotationManager { } } catch (Throwable x) { - if (node != null && node.isDisposed()) return; - Activator.log("Cannot update editor annotations", x); + if (node == null || !node.isDisposed()) { + Activator.log("Cannot update editor annotations", x); + } } } } @@ -571,12 +573,13 @@ public class TCFAnnotationManager { }); } - void updateAnnotations(final IWorkbenchWindow window, final TCFLaunch launch) { + synchronized void updateAnnotations(final IWorkbenchWindow window, final TCFLaunch launch) { + final int cnt = ++update_unnotations_cnt; displayExec(new Runnable() { public void run() { dirty_windows.add(window); dirty_launches.add(launch); - updateAnnotations(); + updateAnnotations(cnt); } }); } 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 9020c655c..368aa181e 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 @@ -353,7 +353,10 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, ((TCFNodeExecContext)node).onContextSuspended(pc, reason, params); } launch_node.onAnyContextSuspendedOrChanged(); - if (action_cnt == 0) setDebugViewSelection(node, reason); + if (action_cnt == 0) { + setDebugViewSelection(node, reason); + annotation_manager.updateAnnotations(null, launch); + } action_results.remove(context); } @@ -414,7 +417,10 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, exe.onContextSuspended(pc, reason, params); } launch_node.onAnyContextSuspendedOrChanged(); - if (active_actions.get(id) == null) setDebugViewSelection(node, reason); + if (active_actions.get(id) == null) { + setDebugViewSelection(node, reason); + annotation_manager.updateAnnotations(null, launch); + } onMemoryChanged(id); } }; @@ -525,6 +531,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, } setDebugViewSelection(id2node.get(id), "Action"); for (TCFModelProxy p : model_proxies.values()) p.post(); + annotation_manager.updateAnnotations(null, launch); } }; @@ -1176,7 +1183,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, } } final Object element = model_element; - Protocol.invokeLater(new Runnable() { + Protocol.invokeLater(25, new Runnable() { public void run() { if (cnt != display_source_generation) return; TCFNodeStackFrame stack_frame = null; diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelProxy.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelProxy.java index 54a332674..d4f346eee 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelProxy.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModelProxy.java @@ -252,6 +252,7 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru * @param node - a model node that will become new selection. */ void setSelection(TCFNode node) { + if (selection.size() > 0 && selection.getLast() == node) return; selection.add(node); expand(node.getParent(getPresentationContext())); } @@ -324,7 +325,8 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru if ((flags & IModelDelta.REMOVED) != 0 && (flags & (IModelDelta.INSERTED|IModelDelta.ADDED)) != 0) return null; if (node == selection) { // Bug in Eclipse 3.6.1: SELECT delta has no effect without STATE - flags |= IModelDelta.REVEAL | IModelDelta.SELECT | IModelDelta.STATE; + flags |= IModelDelta.SELECT | IModelDelta.STATE; + if (this.selection.size() <= 1) flags |= IModelDelta.REVEAL; } if (node.parent == null) { // The node is TCF launch node @@ -403,6 +405,7 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru private void postDelta(final ModelDelta root) { assert pending_node == null; if (root.getFlags() != 0 || root.getChildDeltas().length > 0) { + last_update_time = System.currentTimeMillis(); asyncExec(new Runnable() { public void run() { sortDeltaChildren(root); @@ -426,8 +429,9 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru found = ((ITreeModelContentProviderTarget)getViewer()).findElementIndex(TreePath.EMPTY, launch) >= 0; Protocol.invokeLater(new Runnable() { public void run() { + if (disposed) return; if (found) realized = true; - else last_update_time = System.currentTimeMillis(); + else last_update_time = System.currentTimeMillis() + 20; post(); } }); @@ -470,7 +474,6 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru if (pending_node == null) { node2flags.clear(); postDelta(root); - last_update_time = System.currentTimeMillis(); } } node2delta.clear(); |