1 | package de.ugoe.cs.eventbench.commands;
|
---|
2 |
|
---|
3 | import java.security.InvalidParameterException;
|
---|
4 | import java.util.Collection;
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | import de.ugoe.cs.eventbench.swing.DlgSequences;
|
---|
8 | import de.ugoe.cs.util.console.Command;
|
---|
9 | 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 | public class CMDshowSequences implements Command {
|
---|
14 |
|
---|
15 | public void help() {
|
---|
16 | Console.println("Usage: showSequences");
|
---|
17 | }
|
---|
18 |
|
---|
19 | @SuppressWarnings("unchecked")
|
---|
20 | public void run(List<Object> parameters) {
|
---|
21 |
|
---|
22 | if (parameters.size() > 0)
|
---|
23 | throw new InvalidParameterException();
|
---|
24 |
|
---|
25 | Collection<List<Event<?>>> containedSequences = null;
|
---|
26 |
|
---|
27 | try {
|
---|
28 | containedSequences = (Collection<List<Event<?>>>) GlobalDataContainer
|
---|
29 | .getInstance().getData("sequences");
|
---|
30 | } catch (ClassCastException e) {
|
---|
31 | Console.println("Not able to cast Data in GlobalDataContainer to List of Sequences");
|
---|
32 | }
|
---|
33 |
|
---|
34 | if (containedSequences == null) {
|
---|
35 | Console.printerrln("No sequences found.");
|
---|
36 | } else {
|
---|
37 |
|
---|
38 | DlgSequences.showDialog();
|
---|
39 |
|
---|
40 | synchronized (Console.getInstance()) {
|
---|
41 | try {
|
---|
42 | Console.getInstance().wait();
|
---|
43 | } catch (InterruptedException e) {
|
---|
44 | e.printStackTrace();
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|