[Squirrel-sql-commits] sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n I18NStrings.
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
Update of /cvsroot/squirrel-sql/sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30359/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n Modified Files: I18NStrings.properties I18nBundle.java TranslatorsController.java TranslatorsPanel.java Log Message: New native2Ascii handling Index: TranslatorsPanel.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsPanel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TranslatorsPanel.java 13 Mar 2006 21:14:06 -0000 1.8 --- TranslatorsPanel.java 20 Mar 2006 08:14:43 -0000 1.9 *************** *** 31,53 **** JButton btnChooseEditorCommand; JTable tblBundels = new JTable(); ! public TranslatorsPanel(PluginResources resources) ! { ! setLayout(new GridLayout(1,1)); ! add(tabTranlators); ! JPanel translationsPanel = getTranslationsPanel(resources); ! // i18n[I18n.tranlations=Translations] ! tabTranlators.addTab(s_stringMgr.getString("I18n.tranlations"), translationsPanel); ! // i18n[I18n.info=Info] ! tabTranlators.addTab(s_stringMgr.getString("I18n.info"), new JScrollPane(new MultipleLineLabel(infoText))); ! } private JPanel getTranslationsPanel(PluginResources resources) --- 31,56 ---- JButton btnChooseEditorCommand; + JTextField txtNativeToAsciiOutDir = new JTextField(); + JButton btnChooseNativeToAsciiOutDir; + JTable tblBundels = new JTable(); ! public TranslatorsPanel(PluginResources resources) ! { ! setLayout(new GridLayout(1,1)); ! add(tabTranlators); ! JPanel translationsPanel = getTranslationsPanel(resources); ! // i18n[I18n.tranlations=Translations] ! tabTranlators.addTab(s_stringMgr.getString("I18n.tranlations"), translationsPanel); ! // i18n[I18n.info=Info] ! tabTranlators.addTab(s_stringMgr.getString("I18n.info"), new JScrollPane(new MultipleLineLabel(infoText))); ! } private JPanel getTranslationsPanel(PluginResources resources) *************** *** 82,85 **** --- 85,89 ---- + gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0); // i18n[I18n.EditorCommand=Editor command] *************** *** 93,112 **** ret.add(btnChooseEditorCommand, gbc); gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0); // i18n[I18n.NativeToAscii=Path to native to Unicode converter (JDK's native2ascii)] ret.add(new MultipleLineLabel(s_stringMgr.getString("I18n.NativeToAscii")), gbc); ! gbc = new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0); ret.add(txtNativeToAsciiCommand, gbc); btnChooseNativeToAsciiCommand = new JButton(resources.getIcon("Open")); ! gbc = new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0); ret.add(btnChooseNativeToAsciiCommand, gbc); ! gbc = new GridBagConstraints(0, 4, 3, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0); // i18n[I18n.bundles=Bundles] ret.add(new JLabel(s_stringMgr.getString("I18n.bundles")), gbc); ! gbc = new GridBagConstraints(0, 5, 3, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 0, 5), 0, 0); ret.add(new JScrollPane(tblBundels), gbc); --- 97,132 ---- ret.add(btnChooseEditorCommand, gbc); + + gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0); // i18n[I18n.NativeToAscii=Path to native to Unicode converter (JDK's native2ascii)] ret.add(new MultipleLineLabel(s_stringMgr.getString("I18n.NativeToAscii")), gbc); ! gbc = new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0); ret.add(txtNativeToAsciiCommand, gbc); btnChooseNativeToAsciiCommand = new JButton(resources.getIcon("Open")); ! gbc = new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0); ret.add(btnChooseNativeToAsciiCommand, gbc); ! ! gbc = new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0); ! // i18n[I18n.NativeToAsciiOutDir=native2Ascii output dir] ! ret.add(new JLabel(s_stringMgr.getString("I18n.NativeToAsciiOutDir")), gbc); ! ! gbc = new GridBagConstraints(1, 4, 1, 1, 1, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 0, 5), 0, 0); ! ret.add(txtNativeToAsciiOutDir, gbc); ! ! btnChooseNativeToAsciiOutDir = new JButton(resources.getIcon("Open")); ! gbc = new GridBagConstraints(2, 4, 1, 1, 0, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0); ! ret.add(btnChooseNativeToAsciiOutDir, gbc); ! ! ! ! gbc = new GridBagConstraints(0, 5, 3, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0); // i18n[I18n.bundles=Bundles] ret.add(new JLabel(s_stringMgr.getString("I18n.bundles")), gbc); ! gbc = new GridBagConstraints(0, 6, 3, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 0, 5), 0, 0); ret.add(new JScrollPane(tblBundels), gbc); Index: I18nBundle.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n/I18nBundle.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** I18nBundle.java 12 Oct 2005 20:25:26 -0000 1.8 --- I18nBundle.java 20 Mar 2006 08:14:43 -0000 1.9 *************** *** 10,14 **** import java.io.IOException; import java.util.Properties; - import java.util.Enumeration; import java.util.Locale; import java.util.Arrays; --- 10,13 ---- *************** *** 59,63 **** if(null != _workDir) { ! File pathInWorkDir = getPathInWorkDir(_workDir); if(pathInWorkDir.exists()) { --- 58,62 ---- if(null != _workDir) { ! File pathInWorkDir = getPathRelativeTo(_workDir); if(pathInWorkDir.exists()) { *************** *** 97,101 **** Properties propsToAppend = _defaultProps.getTranslateableProperties(); ! File toAppendTo = getPathInWorkDir(workDir); if(toAppendTo.exists()) { --- 96,100 ---- Properties propsToAppend = _defaultProps.getTranslateableProperties(); ! File toAppendTo = getPathRelativeTo(workDir); if(toAppendTo.exists()) { *************** *** 169,175 **** } ! File getPathInWorkDir(File workDir) { ! File toAppendTo = new File(workDir.getPath() + File.separator + getName()); String localizedFileName = _defaultProps.getLocalizedFileName(_locale); toAppendTo = new File(toAppendTo.getParent() + File.separator + localizedFileName); --- 168,174 ---- } ! File getPathRelativeTo(File parentDir) { ! File toAppendTo = new File(parentDir.getPath() + File.separator + getName()); String localizedFileName = _defaultProps.getLocalizedFileName(_locale); toAppendTo = new File(toAppendTo.getParent() + File.separator + localizedFileName); Index: I18NStrings.properties =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n/I18NStrings.properties,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** I18NStrings.properties 13 Mar 2006 21:14:04 -0000 1.18 --- I18NStrings.properties 20 Mar 2006 08:14:43 -0000 1.19 *************** *** 20,26 **** i18n.noEditorCommand=Can not open files without an editor command. ! i18n.noNativeToAsciiCommand=Can not convert files without a nativeToAscii command. ! i18n.notGeneratedInWorkDir=File {0} has not been generated and can not be opened. ! i18n.noFilesOpened=No file could be opened.\nSee message panel for details. i18n.executingCommand=Executing command: {0} i18n.executingCommandFailed=Execution failed with error: {0} --- 20,26 ---- i18n.noEditorCommand=Can not open files without an editor command. ! i18n.noNativeToAsciiCommand=Cannot convert files without a native2Ascii command. ! i18n.notGeneratedInWorkDir=File {0} has not been generated. Cannot continue. ! i18n.noFilesOpened=No file found.\nSee message panel for details. i18n.executingCommand=Executing command: {0} i18n.executingCommandFailed=Execution failed with error: {0} *************** *** 98,100 **** I18n.NativeToAscii=Path to native to Unicode converter (JDK's native2ascii) ! I18n.ExecuteNativeToAscii=Execute nativeToAscii \ No newline at end of file --- 98,108 ---- I18n.NativeToAscii=Path to native to Unicode converter (JDK's native2ascii) ! I18n.ExecuteNativeToAscii=Execute nativeToAscii ! ! I18n.NativeToAsciiOutDir=native2Ascii output dir ! ! i18n.noNativeToAsciiOutDir=Cannot convert files without a native2Ascii output dir. ! ! i18n.noNativeToAsciiOutDirNoDir=native2Ascii output dir is not a directory. native2Ascii will not be executed. ! ! i18n.noNativeToAsciiOutDirNotCreated=Could not create native2Ascii output dir. native2Ascii will not be executed. \ No newline at end of file Index: TranslatorsController.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/plugins/i18n/src/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsController.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TranslatorsController.java 13 Mar 2006 21:14:06 -0000 1.4 --- TranslatorsController.java 20 Mar 2006 08:14:43 -0000 1.5 *************** *** 31,34 **** --- 31,36 ---- private static final String PREF_KEY_EDITOR_COMMAND = "SquirrelSQL.i18n.editorCommand"; private static final String PREF_KEY_SELECTED_LOCALE = "SquirrelSQL.i18n.selectedLocale"; + private static final String PREF_KEY_NATIVE2ASCII_COMMAND = "SquirrelSQL.i18n.native2AsciiCommand"; + private static final String PREF_KEY_NATIVE2ASCII_OUT_DIR = "SquirrelSQL.i18n.native2AsciiOutDir"; *************** *** 90,93 **** --- 92,102 ---- }); + _panel.btnChooseNativeToAsciiOutDir.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + onChooseNativeToAsciiOutDir(); + } + }); *************** *** 173,176 **** --- 182,193 ---- _panel.txtEditorCommand.setText(editorCommand); + + String nativeToAsciiCommand = Preferences.userRoot().get(PREF_KEY_NATIVE2ASCII_COMMAND, null); + _panel.txtNativeToAsciiCommand.setText(nativeToAsciiCommand); + + String nativeToAsciiOutDir = Preferences.userRoot().get(PREF_KEY_NATIVE2ASCII_OUT_DIR, null); + _panel.txtNativeToAsciiOutDir.setText(nativeToAsciiOutDir); + + } *************** *** 222,225 **** --- 239,255 ---- } + private void onChooseNativeToAsciiOutDir() + { + JFileChooser chooser = new JFileChooser(System.getProperties().getProperty("user.home")); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.showOpenDialog(_app.getMainFrame()); + + if(null != chooser.getSelectedFile()) + { + _panel.txtNativeToAsciiOutDir.setText(chooser.getSelectedFile().getPath()); + } + } + + private void onExecuteNativeToAscii() { *************** *** 228,232 **** if(null == nativeToAsciiCommmand || 0 == nativeToAsciiCommmand.length()) { ! // i18n[i18n.noNativeToAsciiCommand=Can not convert files without a nativeToAscii command.] String msg = s_stringMgr.getString("i18n.noNativeToAsciiCommand"); JOptionPane.showMessageDialog(_app.getMainFrame(), msg); --- 258,262 ---- if(null == nativeToAsciiCommmand || 0 == nativeToAsciiCommmand.length()) { ! // i18n[i18n.noNativeToAsciiCommand=Cannot convert files without a native2Ascii command.] String msg = s_stringMgr.getString("i18n.noNativeToAsciiCommand"); JOptionPane.showMessageDialog(_app.getMainFrame(), msg); *************** *** 234,239 **** } ! executeCommand(nativeToAsciiCommmand, true); } --- 264,289 ---- } + String nativeToAsciiOutDir = _panel.txtNativeToAsciiOutDir.getText(); ! if(null == nativeToAsciiOutDir || 0 == nativeToAsciiOutDir.length()) ! { ! // i18n[i18n.noNativeToAsciiOutDir=Cannot convert files without a native2Ascii output dir.] ! String msg = s_stringMgr.getString("i18n.noNativeToAsciiOutDir"); ! JOptionPane.showMessageDialog(_app.getMainFrame(), msg); ! return; ! } ! ! File outDir = new File(nativeToAsciiOutDir); ! outDir.mkdirs(); ! ! if(false == outDir.isDirectory()) ! { ! // i18n[i18n.noNativeToAsciiOutDirNoDir=native2Ascii output dir is not a directory. native2Ascii will not be executed.] ! String msg = s_stringMgr.getString("i18n.noNativeToAsciiOutDirNoDir"); ! JOptionPane.showMessageDialog(_app.getMainFrame(), msg); ! return; ! } ! ! executeCommand(nativeToAsciiCommmand, true, outDir); } *************** *** 254,261 **** ! executeCommand(editorCommmand, false); } ! private void executeCommand(String command, boolean nativeToAscii) { File workDir = getWorkDir(true); --- 304,311 ---- ! executeCommand(editorCommmand, false, null); } ! private void executeCommand(String command, boolean nativeToAscii, File native2AsciiOutDir) { File workDir = getWorkDir(true); *************** *** 274,278 **** for (int i = 0; i < selBundles.length; i++) { ! File f = selBundles[i].getPathInWorkDir(workDir); if(f.exists()) --- 324,328 ---- for (int i = 0; i < selBundles.length; i++) { ! File f = selBundles[i].getPathRelativeTo(workDir); if(f.exists()) *************** *** 280,284 **** if(nativeToAscii) { ! commands.add(command + " " + f.getPath() + " " + f.getPath()); } else --- 330,336 ---- if(nativeToAscii) { ! File outFile = selBundles[i].getPathRelativeTo(native2AsciiOutDir); ! outFile.getParentFile().mkdirs(); ! commands.add(command + " " + f.getPath() + " " + outFile.getPath()); } else *************** *** 296,301 **** else { String msg = s_stringMgr.getString("i18n.notGeneratedInWorkDir", f.getPath()); - // i18n[i18n.notGeneratedInWorkDir=File {0} has not been generated and can not be opened.] _app.getMessageHandler().showMessage(msg); } --- 348,353 ---- else { + // i18n[i18n.notGeneratedInWorkDir=File {0} has not been generated. Cannot continue.] String msg = s_stringMgr.getString("i18n.notGeneratedInWorkDir", f.getPath()); _app.getMessageHandler().showMessage(msg); } *************** *** 304,309 **** if(false == filesFound) { String msg = s_stringMgr.getString("i18n.noFilesOpened"); - // i18n[i18n.noFilesOpened=No file could be opened.\nSee message panel for details.] JOptionPane.showMessageDialog(_app.getMainFrame(), msg); return; --- 356,361 ---- if(false == filesFound) { + // i18n[i18n.noFilesOpened=No file found.\nSee message panel for details.] String msg = s_stringMgr.getString("i18n.noFilesOpened"); JOptionPane.showMessageDialog(_app.getMainFrame(), msg); return; *************** *** 335,341 **** public void uninitialize() { Preferences.userRoot().put(PREF_KEY_WORK_DIR, _panel.txtWorkingDir.getText()); Preferences.userRoot().put(PREF_KEY_EDITOR_COMMAND, _panel.txtEditorCommand.getText()); ! Preferences.userRoot().put(PREF_KEY_SELECTED_LOCALE, "" + _panel.cboLocales.getSelectedItem()); } --- 387,395 ---- public void uninitialize() { + Preferences.userRoot().put(PREF_KEY_SELECTED_LOCALE, "" + _panel.cboLocales.getSelectedItem()); Preferences.userRoot().put(PREF_KEY_WORK_DIR, _panel.txtWorkingDir.getText()); Preferences.userRoot().put(PREF_KEY_EDITOR_COMMAND, _panel.txtEditorCommand.getText()); ! Preferences.userRoot().put(PREF_KEY_NATIVE2ASCII_COMMAND, _panel.txtNativeToAsciiCommand.getText()); ! Preferences.userRoot().put(PREF_KEY_NATIVE2ASCII_OUT_DIR, _panel.txtNativeToAsciiOutDir.getText()); } |