| 1 | package de.ugoe.cs.eventbench;
|
|---|
| 2 |
|
|---|
| 3 | import de.ugoe.cs.eventbench.swt.MainWindow;
|
|---|
| 4 | import de.ugoe.cs.util.console.CommandExecuter;
|
|---|
| 5 | import de.ugoe.cs.util.console.Console;
|
|---|
| 6 | import de.ugoe.cs.util.console.TextConsole;
|
|---|
| 7 |
|
|---|
| 8 | /**
|
|---|
| 9 | * <p>
|
|---|
| 10 | * Start-up class of the application.
|
|---|
| 11 | * </p>
|
|---|
| 12 | * <p>
|
|---|
| 13 | * It sets up and starts the {@link Console}.
|
|---|
| 14 | * </p>
|
|---|
| 15 | *
|
|---|
| 16 | * @author Steffen Herbold
|
|---|
| 17 | * @version 1.0
|
|---|
| 18 | */
|
|---|
| 19 | public class Runner {
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * <p>
|
|---|
| 23 | * Main method of the application.
|
|---|
| 24 | * </p>
|
|---|
| 25 | *
|
|---|
| 26 | * @param args
|
|---|
| 27 | * if parameters are defined, they are interpreted as commands
|
|---|
| 28 | * for the {@link Console} and executed before the user can use
|
|---|
| 29 | * the console; can be used to perform batch operations
|
|---|
| 30 | */
|
|---|
| 31 | public static void main(String[] args) {
|
|---|
| 32 | CommandExecuter.getInstance().addCommandPackage(
|
|---|
| 33 | "de.ugoe.cs.eventbench.commands");
|
|---|
| 34 | CommandExecuter.getInstance().addCommandPackage(
|
|---|
| 35 | "de.ugoe.cs.eventbench.windows.commands");
|
|---|
| 36 | CommandExecuter.getInstance().addCommandPackage(
|
|---|
| 37 | "de.ugoe.cs.eventbench.web.commands");
|
|---|
| 38 | CommandExecuter.getInstance().addCommandPackage(
|
|---|
| 39 | "de.ugoe.cs.eventbench.efg.commands");
|
|---|
| 40 | TextConsole textConsole = new TextConsole();
|
|---|
| 41 | boolean swtGuiRunning = false;
|
|---|
| 42 | if (args.length >= 1) {
|
|---|
| 43 | if( args[0].equals("-swt") ) {
|
|---|
| 44 | MainWindow mainWindow = new MainWindow();
|
|---|
| 45 | mainWindow.open();
|
|---|
| 46 | swtGuiRunning = true;
|
|---|
| 47 | } else {
|
|---|
| 48 | for (String command : args) {
|
|---|
| 49 | CommandExecuter.getInstance().exec(command);
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
| 52 | }
|
|---|
| 53 | if( !swtGuiRunning ) {
|
|---|
| 54 | textConsole.run(true);
|
|---|
| 55 | }
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|