Make GUI request errors clean

If you don't request a specific GUI, we try SWT and then Swing.  Okay.
But if you do, we don't even try to see if it works—we just assume SWT
works.  If the user requested Swing, we just unconditionally spit out an
error message and try to start the GUI anyway.  Let's make the errors
conditional on the GUIs being unavailable.

Note, a Swing GUI is available.  It is just incomplete and doesn't work
very well.  :)
This commit is contained in:
T. Joseph Carter 2017-11-11 19:43:11 -08:00
parent 4f2facf541
commit 44fd1cb010
2 changed files with 11 additions and 3 deletions

View File

@ -58,10 +58,17 @@ public class AppleCommander {
String[] extraArgs = new String[args.length - 1];
System.arraycopy(args, 1, extraArgs, 0, extraArgs.length);
if ("-swt".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
launchSwtAppleCommander(args);
if (isSwtAvailable()) {
launchSwtAppleCommander(args);
} else {
System.err.println(textBundle.get("SwtVersionNotAvailable")); //$NON-NLS-1$
}
} else if ("-swing".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
launchSwingAppleCommander(args);
if (isSwingAvailable()) {
launchSwingAppleCommander(args);
} else {
System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
}
} else if ("-command".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
System.err.println(textBundle.get("CommandLineNotAvailable")); //$NON-NLS-1$
} else if ("-help".equalsIgnoreCase(args[0]) //$NON-NLS-1$

View File

@ -110,6 +110,7 @@ CommandLineDC42Bad = Unable to interpret this DiskCopy 42 image.
UserPreferencesComment = AppleCommander user preferences
# AppleCommander
SwtVersionNotAvailable = Sorry, the SWT GUI is not available.
SwingVersionNotAvailable = Sorry, the Swing GUI is not available.
CommandLineNotAvailable = Sorry, the command line user interface is not available.
AppleCommanderHelp = AppleCommander general options:\n-swt will launch the SWT version of AppleCommander.\n This requires the SWT jar and dll files to be present.\n-swing will launch the Swing version of AppleCommander.\n (This is not implemented yet.)\n-command will enter command interpreter mode. (This is also\n not implemented yet.)\n-help will show this help text.