Gave higher priority to the dictionary name specified in the properties file than to the dictionary name passed as an argument.

This commit is contained in:
amontano 2005-04-26 05:25:19 +00:00
parent 14ad55aa3f
commit e096aee67b
2 changed files with 42 additions and 37 deletions

View file

@ -209,9 +209,7 @@ public class SwingWindowScannerFilter extends WindowScannerFilter
break; break;
default: default:
System.out.println("Syntax error!"); System.out.println("Syntax error!");
System.out.println("Sintaxis: java SwingWindowScannerFilter [options] arch-dict"); System.out.println("Sintaxis: java SwingWindowScannerFilter [arch-dict]");
System.out.println("Options:");
System.out.println(" -simple: runs the non-swing version.");
System.out.println(TibetanScanner.copyrightASCII); System.out.println(TibetanScanner.copyrightASCII);
} }
} }

View file

@ -55,53 +55,60 @@ public abstract class WindowScannerFilter implements WindowListener, FocusListen
protected Frame mainWindow; protected Frame mainWindow;
/** This class is not meant to be called by itself */ /** This class is not meant to be called by itself */
public WindowScannerFilter() public WindowScannerFilter(String argument)
{ {
String response, dictType; String response, dictType;
WhichDictionaryFrame wdf; WhichDictionaryFrame wdf;
mainWindow = null;
response = ThdlOptions.getStringOption(defOpenOption); response = ThdlOptions.getStringOption(defOpenOption);
if (response==null || response.equals("")) if (response==null || response.equals(""))
{ {
mainWindow = new Frame("Tibetan Translation Tool"); if (argument!=null && !argument.equals(""))
mainWindow.show(); {
mainWindow.toFront(); response = argument;
}
else
{
mainWindow = new Frame("Tibetan Translation Tool");
mainWindow.show();
mainWindow.toFront();
wdf = getWhichDictionaryFrame(); wdf = getWhichDictionaryFrame();
response = wdf.getResponse(); response = wdf.getResponse();
wdf.dispose(); wdf.dispose();
if (response.equals("")) if (response.equals(""))
{ {
mainWindow.dispose(); mainWindow.dispose();
System.exit(0); System.exit(0);
} }
else else
{ {
dictType = wdf.getDictionaryType(); dictType = wdf.getDictionaryType();
mainWindow.setTitle("Tibetan Translation Tool: Connected to " + dictType + " database"); mainWindow.setTitle("Tibetan Translation Tool: Connected to " + dictType + " database");
if (wdf.getDefaultOption()) if (wdf.getDefaultOption())
{ {
ThdlOptions.setUserPreference(defOpenOption, response); ThdlOptions.setUserPreference(defOpenOption, response);
ThdlOptions.setUserPreference(dictOpenType, dictType); ThdlOptions.setUserPreference(dictOpenType, dictType);
try try
{ {
ThdlOptions.saveUserPreferences(); ThdlOptions.saveUserPreferences();
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
} }
}
} }
makeWindow (response); makeWindow (response);
} }
public WindowScannerFilter(String file) public WindowScannerFilter()
{ {
mainWindow = null; this(null);
makeWindow (file);
} }
protected abstract WhichDictionaryFrame getWhichDictionaryFrame(); protected abstract WhichDictionaryFrame getWhichDictionaryFrame();