diff options
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java')
-rw-r--r-- | org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java deleted file mode 100644 index 6ea60ef96..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import javax.sound.midi.MidiEvent; -import javax.sound.midi.MidiMessage; -import javax.sound.midi.ShortMessage; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.viewers.TreePath; - -/** - * Provides labels for MIDI tracks. - * - * @since 1.0 - */ -public class MidiEventLabelProvider extends ElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { - MidiEvent event = (MidiEvent) elementPath.getLastSegment(); - MidiMessage message = event.getMessage(); - if (TrackColumnPresentation.COL_TICK.equals(columnId)) { - return Long.toString(event.getTick()); - } else if (TrackColumnPresentation.COL_BYTES.equals(columnId)) { - byte[] bytes = message.getMessage(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < message.getLength(); i++) { - buffer.append(' '); - appendByte(buffer, bytes[i]); - } - return buffer.toString(); - } else if (TrackColumnPresentation.COL_COMMAND.equals(columnId)) { - if (message instanceof ShortMessage) { - ShortMessage sm = (ShortMessage) message; - StringBuffer buf = new StringBuffer(); - appendByte(buf, (byte)sm.getCommand()); - return buf.toString(); - } - } else if (TrackColumnPresentation.COL_CHANNEL.equals(columnId)) { - if (message instanceof ShortMessage) { - return Integer.toString(((ShortMessage)message).getChannel()); - } - } - return ""; - } - - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getChecked(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - public boolean getChecked(TreePath path, IPresentationContext presentationContext) throws CoreException { - Boolean result = (Boolean) MidiEventModelProxy.gChecked.get(path); - return result == null ? false : result.booleanValue(); - } - - /** - * Appends a byte to the buffer with 2 hex characters. - * - * @param buffer - * @param b - */ - private void appendByte(StringBuffer buffer, byte b) { - String hex = Integer.toHexString(b & 0xFF).toUpperCase(); - for (int i = hex.length(); i < 2; i++) { - buffer.append('0'); - } - buffer.append(hex); - } - -} |