package de.ugoe.cs.eventbench.commands; import java.security.InvalidParameterException; import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; import de.ugoe.cs.eventbench.SequenceInstanceOf; import de.ugoe.cs.eventbench.data.GlobalDataContainer; import de.ugoe.cs.eventbench.swt.SequencesDialog; import de.ugoe.cs.util.console.Command; import de.ugoe.cs.util.console.Console; /** *

* Command to show sequences. *

* * @author Jeffrey Hall, Steffen Herbold */ public class CMDshowSequences implements Command { /* * (non-Javadoc) * * @see de.ugoe.cs.util.console.Command#help() */ @Override public void help() { Console.println("Usage: showSequences "); } /* * (non-Javadoc) * * @see de.ugoe.cs.util.console.Command#run(java.util.List) */ @Override public void run(List parameters) { String sequencesName; try { sequencesName = (String) parameters.get(0); } catch (Exception e) { throw new InvalidParameterException(); } Object dataObject = GlobalDataContainer.getInstance().getData( sequencesName); if (dataObject == null) { Console.println("Object " + sequencesName + " not found in storage."); return; } if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { Console.println("Object " + sequencesName + "not of type Collection>>."); return; } Shell shell = new Shell(SWT.NONE); shell.open(); shell.layout(); shell.setSize(0, 0); SequencesDialog sequencesDialog = new SequencesDialog(shell, SWT.NONE); sequencesDialog.open(sequencesName); shell.dispose(); } }