Do not hardcode the value on main function

This commit is contained in:
Laurent Clouet
2015-04-08 20:32:24 +01:00
parent 53d4d005fe
commit 3226d188af
4 changed files with 8 additions and 4 deletions

View File

@@ -82,7 +82,7 @@ public class Worker {
private String extras = null;
@Option(name = "-ui", usage = "Specify the user interface to use, default 'swing', available 'oneline', 'text', 'swing' (graphical)", required = false)
private String ui_type = "swing";
private String ui_type = GuiSwing.type;
@Option(name = "-config", usage = "Specify the configuration file", required = false)
private String config_file = null;
@@ -261,7 +261,6 @@ public class Worker {
config.setComputeMethod(compute_method);
if (config_file != null) {
if (new File(config_file).exists() == false) {
System.err.println("Configuration file not found.");
@@ -275,14 +274,14 @@ public class Worker {
Gui gui;
switch (ui_type) {
case "oneline":
case GuiTextOneLine.type:
if (config.getPrintLog()) {
System.out.println("OneLine UI can not be used if verbose mode is enabled");
System.exit(2);
}
gui = new GuiTextOneLine();
break;
case "swing":
case GuiSwing.type:
if (java.awt.GraphicsEnvironment.isHeadless()) {
System.out.println("Graphical ui can not be launch.");
System.out.println("You should set a DISPLAY or use a text ui (via -ui oneline or -ui text).");