diff options
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java')
-rw-r--r-- | org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java new file mode 100644 index 000000000..d258abf7d --- /dev/null +++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2008 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 + *******************************************************************************/ +package org.eclipse.debug.examples.ui.midi.detailpanes; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.debug.examples.core.midi.launcher.TempoControl; +import org.eclipse.debug.ui.IDetailPane; +import org.eclipse.debug.ui.IDetailPaneFactory; +import org.eclipse.jface.viewers.IStructuredSelection; + +/** + * Creates detail panes for sequencer controls. + * + * @since 1.0 + */ +public class ControlDetailPaneFactory implements IDetailPaneFactory { + + /** + * Identifier for the tempo slider detail pane + */ + public static final String ID_TEMPO_SLIDER = "TEMPO_SLIDER"; + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPaneFactory#createDetailPane(java.lang.String) + */ + public IDetailPane createDetailPane(String paneID) { + if (ID_TEMPO_SLIDER.equals(paneID)) { + return new TempoSliderDetailPane(); + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(org.eclipse.jface.viewers.IStructuredSelection) + */ + public String getDefaultDetailPane(IStructuredSelection selection) { + if (selection.size() == 1) { + Object element = selection.getFirstElement(); + if (element instanceof TempoControl) { + return ID_TEMPO_SLIDER; + } + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneDescription(java.lang.String) + */ + public String getDetailPaneDescription(String paneID) { + if (ID_TEMPO_SLIDER.equals(paneID)) { + return "Tempo Slider"; + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneName(java.lang.String) + */ + public String getDetailPaneName(String paneID) { + if (ID_TEMPO_SLIDER.equals(paneID)) { + return "Tempo Slider"; + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneTypes(org.eclipse.jface.viewers.IStructuredSelection) + */ + public Set getDetailPaneTypes(IStructuredSelection selection) { + Set set = new HashSet(); + if (selection.size() == 1) { + Object element = selection.getFirstElement(); + if (element instanceof TempoControl) { + set.add(ID_TEMPO_SLIDER); + } + } + return set; + } + +} |