package de.ugoe.cs.quest.ui; import java.io.File; import java.io.IOException; import java.util.List; import joptsimple.OptionException; import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.OptionSpec; import de.ugoe.cs.quest.log4j.Log4JLogger; import de.ugoe.cs.quest.plugin.PluginLoader; import de.ugoe.cs.quest.plugin.QuestPlugin; import de.ugoe.cs.quest.ui.swt.MainWindow; import de.ugoe.cs.util.console.CommandExecuter; import de.ugoe.cs.util.console.Console; import de.ugoe.cs.util.console.TextConsole; /** *
* Start-up class of the application. *
** It sets up and starts the {@link Console}. *
* * @author Steffen Herbold * @version 1.0 */ public class Runner { public enum UITYPE { text, swt }; public enum LOG4JTYPE { enable, disable } /** ** Main method of the application. *
* * @param args * if parameters are defined, they are interpreted as commands for the * {@link Console} and executed before the user can use the console; can be used to * perform batch operations */ public static void main(String[] args) { CommandExecuter.getInstance().addCommandPackage("de.ugoe.cs.quest.ui.commands"); CommandExecuter.getInstance().addCommandPackage("de.ugoe.cs.quest.ui.swt.commands"); // The following four command packages are added automatically, once the // plugin-mechanism works correctly. Hence, these calls should be // removed then. /* * CommandExecuter.getInstance().addCommandPackage( "de.ugoe.cs.quest.plugin.mfc.commands"); * CommandExecuter.getInstance().addCommandPackage( "de.ugoe.cs.quest.plugin.php.commands"); * CommandExecuter.getInstance().addCommandPackage( * "de.ugoe.cs.quest.plugin.guitar.commands"); * CommandExecuter.getInstance().addCommandPackage( "de.ugoe.cs.quest.plugin.jfc.commands"); */ PluginLoader pluginLoader = new PluginLoader(new File("lib")); pluginLoader.load(); for (QuestPlugin plugin : pluginLoader.getPlugins()) { for (String commandPackage : plugin.getCommandPackages()) { CommandExecuter.getInstance().addCommandPackage(commandPackage); } } OptionParser parser = new OptionParser(); OptionSpec