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.core
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.core')
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java13
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java18
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java18
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java13
4 files changed, 43 insertions, 19 deletions
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
index 9e37e496a..5f4e4fbe6 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
@@ -13,7 +13,9 @@ package org.eclipse.debug.examples.core.midi.launcher;
import javax.sound.midi.MidiFileFormat;
import javax.sound.midi.Sequencer;
+import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.ISuspendResume;
@@ -139,6 +141,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
public void resume() throws DebugException {
getSequencer().start();
fireChanged();
+ fireEvent(new DebugEvent(getSequencer(), DebugEvent.RESUME, DebugEvent.CLIENT_REQUEST));
}
/* (non-Javadoc)
@@ -147,7 +150,15 @@ public class MidiLaunch extends Launch implements ISuspendResume {
public void suspend() throws DebugException {
getSequencer().stop();
fireChanged();
+ fireEvent(new DebugEvent(getSequencer(), DebugEvent.SUSPEND, DebugEvent.CLIENT_REQUEST));
}
-
+ /**
+ * Fires a debug event.
+ *
+ * @param event debug event to fire
+ */
+ protected void fireEvent(DebugEvent event) {
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
index 945036875..fcc56c97c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
@@ -109,4 +109,22 @@ public abstract class SequencerControl {
public void fireEvent(DebugEvent event) {
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj.getClass().equals(getClass())) {
+ return ((SequencerControl)obj).getSequencer().equals(getSequencer());
+
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return getSequencer().hashCode() + getClass().hashCode();
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
index f6cc7f2ad..feb3b32e4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
@@ -86,22 +86,4 @@ public class TempoControl extends SequencerControl {
}
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof TempoControl) {
- return ((TempoControl)obj).getSequencer().equals(getSequencer());
-
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getSequencer().hashCode() + getClass().hashCode();
- }
-
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
index 6f0be95e4..19200ba0e 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
@@ -52,10 +52,23 @@ public class TimeControl extends SequencerControl {
long position = getSequencer().getMicrosecondPosition();
int milli = (int) (position & 0x3F);
int sec = (int) (position / 1000000);
+ int min = sec / 60;
+ sec = sec % 60;
StringBuffer clock = new StringBuffer();
+ clock.append(min);
+ while (clock.length() < 2) {
+ clock.insert(0, 0);
+ }
+ clock.append(':');
clock.append(sec);
+ while (clock.length() < 5) {
+ clock.insert(3, 0);
+ }
clock.append(':');
clock.append(milli);
+ while (clock.length() < 8) {
+ clock.insert(6, 0);
+ }
return clock.toString();
}

Back to the top