Changeset 235
- Timestamp:
- 10/05/11 00:59:21 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowSequences.java
r229 r235 1 1 package de.ugoe.cs.eventbench.commands; 2 2 3 import java.security.InvalidParameterException;4 import java.util.Collection;5 3 import java.util.List; 6 4 7 import de.ugoe.cs.eventbench.swing.DlgSequences; 5 import org.eclipse.swt.SWT; 6 import org.eclipse.swt.widgets.Shell; 7 8 import de.ugoe.cs.eventbench.SequenceInstanceOf; 9 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 10 import de.ugoe.cs.eventbench.swt.SequencesDialog; 8 11 import de.ugoe.cs.util.console.Command; 9 12 import de.ugoe.cs.util.console.Console; 10 import de.ugoe.cs.eventbench.data.GlobalDataContainer;11 import de.ugoe.cs.eventbench.data.Event;12 13 13 14 /** … … 27 28 @Override 28 29 public void help() { 29 Console.println("Usage: showSequences ");30 Console.println("Usage: showSequences <sequencesName>"); 30 31 } 31 32 … … 35 36 * @see de.ugoe.cs.util.console.Command#run(java.util.List) 36 37 */ 37 @SuppressWarnings("unchecked")38 38 @Override 39 39 public void run(List<Object> parameters) { 40 41 if (parameters.size() > 0) 42 throw new InvalidParameterException(); 43 44 Collection<List<Event<?>>> containedSequences = null; 45 46 try { 47 containedSequences = (Collection<List<Event<?>>>) GlobalDataContainer 48 .getInstance().getData("sequences"); 49 } catch (ClassCastException e) { 50 Console.println("Unable to cast Data in GlobalDataContainer to List of Sequences"); 40 String sequencesName = "sequences"; 41 if (parameters.size() == 1) { 42 sequencesName = (String) parameters.get(0); 51 43 } 52 44 53 if (containedSequences == null) { 54 Console.printerrln("No sequences found."); 55 } else { 45 Object dataObject = GlobalDataContainer.getInstance().getData( 46 sequencesName); 47 if (dataObject == null) { 48 Console.println("Object " + sequencesName 49 + " not found in storage."); 50 return; 51 } 52 if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 53 Console.println("Object " + sequencesName 54 + "not of type Collection<List<Event<?>>>."); 55 return; 56 } 56 57 57 // TODO use SWT-GUI instead 58 DlgSequences.showDialog(); 59 58 // TODO use SWT-GUI instead 59 SequencesDialog sequencesDialog = new SequencesDialog(new Shell(), SWT.NONE); 60 sequencesDialog.open(sequencesName); 61 /* 60 62 synchronized (Console.getInstance()) { 61 63 try { … … 64 66 e.printStackTrace(); 65 67 } 66 } 67 } 68 }*/ 68 69 } 69 70 }
Note: See TracChangeset
for help on using the changeset viewer.