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

Last change on this file since 363 was 240, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 1.7 KB
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import org.eclipse.swt.SWT;
7import org.eclipse.swt.widgets.Shell;
8
9import de.ugoe.cs.eventbench.CommandHelpers;
10import de.ugoe.cs.eventbench.SequenceInstanceOf;
11import de.ugoe.cs.eventbench.data.GlobalDataContainer;
12import de.ugoe.cs.eventbench.swt.SequencesDialog;
13import de.ugoe.cs.util.console.Command;
14import de.ugoe.cs.util.console.Console;
15
16/**
17 * <p>
18 * Command to show sequences.
19 * </p>
20 *
21 * @author Jeffrey Hall, Steffen Herbold
22 */
23public class CMDshowSequences implements Command {
24
25        /*
26         * (non-Javadoc)
27         *
28         * @see de.ugoe.cs.util.console.Command#help()
29         */
30        @Override
31        public void help() {
32                Console.println("Usage: showSequences <sequencesName>");
33        }
34
35        /*
36         * (non-Javadoc)
37         *
38         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
39         */
40        @Override
41        public void run(List<Object> parameters) {
42                String sequencesName;
43                try {
44                        sequencesName = (String) parameters.get(0);
45                } catch (Exception e) {
46                        throw new InvalidParameterException();
47                }
48
49                Object dataObject = GlobalDataContainer.getInstance().getData(
50                                sequencesName);
51                if (dataObject == null) {
52                        CommandHelpers.objectNotFoundMessage(sequencesName);
53                        return;
54                }
55                if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
56                        CommandHelpers.objectNotType(sequencesName,
57                                        "Collection<List<Event<?>>>");
58                        return;
59                }
60
61                Shell shell = new Shell(SWT.NONE);
62                shell.open();
63                shell.layout();
64                shell.setSize(0, 0);
65                SequencesDialog sequencesDialog = new SequencesDialog(shell, SWT.NONE);
66                sequencesDialog.open(sequencesName);
67                shell.dispose();
68        }
69}
Note: See TracBrowser for help on using the repository browser.