Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2008-01-30 23:05:24 -0500
committerDarin Wright2008-01-30 23:05:24 -0500
commit88be86b9cff01c822c5bcdfb4114142d6350fca9 (patch)
tree616d138245ae9ebf4dc9eab81ad59f219734e63f /org.eclipse.debug.examples.ui/src/org
parente38ab94cf7e4bef9717a708786e94cca8eb9c1f5 (diff)
downloadeclipse.platform.debug-88be86b9cff01c822c5bcdfb4114142d6350fca9.tar.gz
eclipse.platform.debug-88be86b9cff01c822c5bcdfb4114142d6350fca9.tar.xz
eclipse.platform.debug-88be86b9cff01c822c5bcdfb4114142d6350fca9.zip
clock update
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org')
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java61
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java7
2 files changed, 68 insertions, 0 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java
index 3766b9025..9472914a9 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java
@@ -10,8 +10,12 @@
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
+import java.util.Timer;
+import java.util.TimerTask;
+
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch;
+import org.eclipse.debug.examples.core.midi.launcher.TimeControl;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler;
@@ -24,9 +28,17 @@ import org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler;
*/
public class ControlEventHandler extends DebugEventHandler {
+ /**
+ * Associated launch
+ */
private MidiLaunch fLaunch;
/**
+ * Timer used to update clock
+ */
+ private Timer fTimer;
+
+ /**
* @param proxy
*/
public ControlEventHandler(SequencerControlsModelProxy proxy) {
@@ -40,10 +52,59 @@ public class ControlEventHandler extends DebugEventHandler {
protected boolean handlesEvent(DebugEvent event) {
return true;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#dispose()
+ */
+ public synchronized void dispose() {
+ super.dispose();
+ if (fTimer != null) {
+ fTimer.cancel();
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#refreshRoot(org.eclipse.debug.core.DebugEvent)
+ */
protected void refreshRoot(DebugEvent event) {
ModelDelta delta = new ModelDelta(fLaunch, IModelDelta.CONTENT);
fireDelta(delta);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handleResume(org.eclipse.debug.core.DebugEvent)
+ */
+ protected void handleResume(DebugEvent event) {
+ super.handleResume(event);
+ startTimer();
+ }
+
+ /**
+ * Starts a timer to update the clock
+ */
+ private void startTimer() {
+ fTimer = new Timer(true);
+ fTimer.schedule(new TimerTask() {
+ public void run() {
+ ModelDelta delta = new ModelDelta(fLaunch, IModelDelta.NO_CHANGE);
+ delta = delta.addNode(new TimeControl(fLaunch), IModelDelta.STATE);
+ fireDelta(delta);
+ }
+ }, 0, 100);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handleSuspend(org.eclipse.debug.core.DebugEvent)
+ */
+ protected void handleSuspend(DebugEvent event) {
+ super.handleSuspend(event);
+ if (fTimer != null) {
+ fTimer.cancel();
+ fTimer = null;
+ }
+ }
+
+
+
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
index ec3439a10..ac0e0b3a7 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
+import javax.sound.midi.Sequencer;
+
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch;
import org.eclipse.debug.examples.core.midi.launcher.SequencerControl;
@@ -63,9 +65,14 @@ public class SequencerControlsModelProxy extends EventHandlerModelProxy {
if (event.getSource() instanceof SequencerControl) {
return ((SequencerControl)event.getSource()).getLaunch().equals(fLaunch);
}
+ if (event.getSource() instanceof Sequencer) {
+ return fLaunch.getSequencer().equals(event.getSource());
+ }
return false;
}
+
+
}

Back to the top