source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowSequences.java @ 229

Last change on this file since 229 was 229, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 1.6 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.Collection;
5import java.util.List;
6
7import de.ugoe.cs.eventbench.swing.DlgSequences;
8import de.ugoe.cs.util.console.Command;
9import de.ugoe.cs.util.console.Console;
10import de.ugoe.cs.eventbench.data.GlobalDataContainer;
11import de.ugoe.cs.eventbench.data.Event;
12
13/**
14 * <p>
15 * Command to show sequences.
16 * </p>
17 *
18 * @author Jeffrey Hall, Steffen Herbold
19 */
20public class CMDshowSequences implements Command {
21
22        /*
23         * (non-Javadoc)
24         *
25         * @see de.ugoe.cs.util.console.Command#help()
26         */
27        @Override
28        public void help() {
29                Console.println("Usage: showSequences");
30        }
31
32        /*
33         * (non-Javadoc)
34         *
35         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
36         */
37        @SuppressWarnings("unchecked")
38        @Override
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");
51                }
52
53                if (containedSequences == null) {
54                        Console.printerrln("No sequences found.");
55                } else {
56
57                        // TODO use SWT-GUI instead
58                        DlgSequences.showDialog();
59
60                        synchronized (Console.getInstance()) {
61                                try {
62                                        Console.getInstance().wait();
63                                } catch (InterruptedException e) {
64                                        e.printStackTrace();
65                                }
66                        }
67                }
68        }
69}
Note: See TracBrowser for help on using the repository browser.