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

Last change on this file since 138 was 137, checked in by jhall, 13 years ago

Console waits for DlgSequences? being disposed to avoid inconsistent data

  • Property svn:mime-type set to text/plain
File size: 1.3 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5import java.util.concurrent.Semaphore;
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
13public 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                List<List<Event<?>>> containedSequences = null;
26
27                try {
28                        containedSequences = (List<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}
Note: See TracBrowser for help on using the repository browser.