diff options
author | Uwe Stieber | 2013-10-17 13:58:35 +0000 |
---|---|---|
committer | Uwe Stieber | 2013-10-17 13:58:35 +0000 |
commit | 00f7c65d9fa10c845b5ca8a48e734f04514191e4 (patch) | |
tree | cca12c9b26b8b8857141ab621c4a35cd8dda1dc2 /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core | |
parent | c2ac8b11f40f1f28ab4154a3fb5a59730d1f849d (diff) | |
download | org.eclipse.tcf-00f7c65d9fa10c845b5ca8a48e734f04514191e4.tar.gz org.eclipse.tcf-00f7c65d9fa10c845b5ca8a48e734f04514191e4.tar.xz org.eclipse.tcf-00f7c65d9fa10c845b5ca8a48e734f04514191e4.zip |
Target Explorer: Fix auto-refresh in system monitor has no effect
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java index c8bc0c169..07c161af6 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java @@ -196,22 +196,13 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo // Get the auto-refresh started if not yet scheduled if (interval != 0 && timer == null) { // Create the timer task to schedule - final TimerTask task = new TimerTask() { + TimerTask task = new TimerTask() { @Override public void run() { // Drop out of the interval has been set to 0 in the meanwhile if (RuntimeModel.this.interval == 0) return; - final TimerTask task = this; - // Refresh the model - RuntimeModel.this.getService(IModelRefreshService.class).refresh(new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - // Re-schedule ourself if the interval is still > 0 - if (RuntimeModel.this.interval > 0 && timer != null) { - timer.schedule(task, RuntimeModel.this.interval); - } - } - }); + // Do the auto refresh + doAutoRefresh(); } }; @@ -236,14 +227,35 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo return interval; } - protected void startAutoRefresh() { - - } - /** - * Stops the auto-refresh if scheduled. + * Execute the auto refresh of the model and reschedule until stopped. */ - protected void stopAutoRefresh() { + /* default */ void doAutoRefresh() { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + // Refresh the model + RuntimeModel.this.getService(IModelRefreshService.class).refresh(new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + // Re-schedule ourself if the interval is still > 0 + if (RuntimeModel.this.interval > 0 && timer != null) { + // Create the timer task to schedule + TimerTask task = new TimerTask() { + @Override + public void run() { + // Drop out of the interval has been set to 0 in the meanwhile + if (RuntimeModel.this.interval == 0) return; + // Do the auto refresh + doAutoRefresh(); + } + }; + timer.schedule(task, RuntimeModel.this.interval); + } + } + }); + } + }); } } |