From e096aee67bdb0621ebf7919e54d9adb645439d8b Mon Sep 17 00:00:00 2001 From: amontano Date: Tue, 26 Apr 2005 05:25:19 +0000 Subject: [PATCH] Gave higher priority to the dictionary name specified in the properties file than to the dictionary name passed as an argument. --- .../tib/scanner/SwingWindowScannerFilter.java | 4 +- .../thdl/tib/scanner/WindowScannerFilter.java | 75 ++++++++++--------- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/source/org/thdl/tib/scanner/SwingWindowScannerFilter.java b/source/org/thdl/tib/scanner/SwingWindowScannerFilter.java index d7b8a4c..ea1649b 100644 --- a/source/org/thdl/tib/scanner/SwingWindowScannerFilter.java +++ b/source/org/thdl/tib/scanner/SwingWindowScannerFilter.java @@ -209,9 +209,7 @@ public class SwingWindowScannerFilter extends WindowScannerFilter break; default: System.out.println("Syntax error!"); - System.out.println("Sintaxis: java SwingWindowScannerFilter [options] arch-dict"); - System.out.println("Options:"); - System.out.println(" -simple: runs the non-swing version."); + System.out.println("Sintaxis: java SwingWindowScannerFilter [arch-dict]"); System.out.println(TibetanScanner.copyrightASCII); } } diff --git a/source/org/thdl/tib/scanner/WindowScannerFilter.java b/source/org/thdl/tib/scanner/WindowScannerFilter.java index ed58ee8..552b61a 100644 --- a/source/org/thdl/tib/scanner/WindowScannerFilter.java +++ b/source/org/thdl/tib/scanner/WindowScannerFilter.java @@ -55,53 +55,60 @@ public abstract class WindowScannerFilter implements WindowListener, FocusListen protected Frame mainWindow; /** This class is not meant to be called by itself */ - public WindowScannerFilter() + public WindowScannerFilter(String argument) { String response, dictType; WhichDictionaryFrame wdf; + mainWindow = null; response = ThdlOptions.getStringOption(defOpenOption); if (response==null || response.equals("")) { - mainWindow = new Frame("Tibetan Translation Tool"); - mainWindow.show(); - mainWindow.toFront(); - - wdf = getWhichDictionaryFrame(); - response = wdf.getResponse(); - wdf.dispose(); - - if (response.equals("")) - { - mainWindow.dispose(); - System.exit(0); - } - else - { - dictType = wdf.getDictionaryType(); - mainWindow.setTitle("Tibetan Translation Tool: Connected to " + dictType + " database"); - if (wdf.getDefaultOption()) - { - ThdlOptions.setUserPreference(defOpenOption, response); - ThdlOptions.setUserPreference(dictOpenType, dictType); - try - { - ThdlOptions.saveUserPreferences(); - } - catch (Exception e) - { - } - } - } + if (argument!=null && !argument.equals("")) + { + response = argument; + } + else + { + mainWindow = new Frame("Tibetan Translation Tool"); + mainWindow.show(); + mainWindow.toFront(); + + wdf = getWhichDictionaryFrame(); + response = wdf.getResponse(); + wdf.dispose(); + + if (response.equals("")) + { + mainWindow.dispose(); + System.exit(0); + } + else + { + dictType = wdf.getDictionaryType(); + mainWindow.setTitle("Tibetan Translation Tool: Connected to " + dictType + " database"); + if (wdf.getDefaultOption()) + { + ThdlOptions.setUserPreference(defOpenOption, response); + ThdlOptions.setUserPreference(dictOpenType, dictType); + try + { + ThdlOptions.saveUserPreferences(); + } + catch (Exception e) + { + } + } + } + } } makeWindow (response); } - public WindowScannerFilter(String file) + public WindowScannerFilter() { - mainWindow = null; - makeWindow (file); + this(null); } protected abstract WhichDictionaryFrame getWhichDictionaryFrame();