1 | package de.ugoe.cs.eventbench.commands;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
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;
|
---|
11 | import de.ugoe.cs.util.console.Command;
|
---|
12 | import de.ugoe.cs.util.console.Console;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * <p>
|
---|
16 | * Command to show sequences.
|
---|
17 | * </p>
|
---|
18 | *
|
---|
19 | * @author Jeffrey Hall, Steffen Herbold
|
---|
20 | */
|
---|
21 | public class CMDshowSequences implements Command {
|
---|
22 |
|
---|
23 | /*
|
---|
24 | * (non-Javadoc)
|
---|
25 | *
|
---|
26 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
27 | */
|
---|
28 | @Override
|
---|
29 | public void help() {
|
---|
30 | Console.println("Usage: showSequences <sequencesName>");
|
---|
31 | }
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * (non-Javadoc)
|
---|
35 | *
|
---|
36 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
37 | */
|
---|
38 | @Override
|
---|
39 | public void run(List<Object> parameters) {
|
---|
40 | String sequencesName = "sequences";
|
---|
41 | if (parameters.size() == 1) {
|
---|
42 | sequencesName = (String) parameters.get(0);
|
---|
43 | }
|
---|
44 |
|
---|
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 | }
|
---|
57 |
|
---|
58 | // TODO use SWT-GUI instead
|
---|
59 | SequencesDialog sequencesDialog = new SequencesDialog(new Shell(), SWT.NONE);
|
---|
60 | sequencesDialog.open(sequencesName);
|
---|
61 | /*
|
---|
62 | synchronized (Console.getInstance()) {
|
---|
63 | try {
|
---|
64 | Console.getInstance().wait();
|
---|
65 | } catch (InterruptedException e) {
|
---|
66 | e.printStackTrace();
|
---|
67 | }
|
---|
68 | }*/
|
---|
69 | }
|
---|
70 | }
|
---|