01: package net.sourceforge.squirrel_sql.plugins.i18n;
02:
03: import java.awt.GridBagConstraints;
04: import java.awt.GridBagLayout;
05: import java.awt.Insets;
06:
07: import javax.swing.JButton;
08: import javax.swing.JLabel;
09: import javax.swing.JPanel;
10: import javax.swing.JTextField;
11:
12: import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
13: import net.sourceforge.squirrel_sql.fw.gui.MultipleLineLabel;
14: import net.sourceforge.squirrel_sql.fw.util.StringManager;
15: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
16:
17: public class DevelopersPanel extends JPanel {
18: private static final StringManager s_stringMgr = StringManagerFactory
19: .getStringManager(DevelopersPanel.class);
20:
21: JTextField txtSourceDir = new JTextField();
22: JButton btnChooseSourceDir;
23: JButton btnAppendI18nInCode;
24:
25: public DevelopersPanel(PluginResources resources) {
26: GridBagConstraints gbc;
27:
28: setLayout(new GridBagLayout());
29:
30: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
31: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
32: new Insets(5, 5, 5, 5), 0, 0);
33: // i18n[I18n.SourceDir=Source directory]
34: add(new JLabel(s_stringMgr.getString("I18n.SourceDir")), gbc);
35:
36: gbc = new GridBagConstraints(1, 0, 1, 1, 1, 0,
37: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
38: new Insets(5, 0, 0, 5), 0, 0);
39: add(txtSourceDir, gbc);
40:
41: btnChooseSourceDir = new JButton(resources.getIcon("Open"));
42: gbc = new GridBagConstraints(2, 0, 1, 1, 0, 0,
43: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
44: new Insets(5, 0, 0, 5), 0, 0);
45: add(btnChooseSourceDir, gbc);
46:
47: gbc = new GridBagConstraints(0, 1, 3, 1, 0, 0,
48: GridBagConstraints.NORTHWEST,
49: GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
50: 0, 0);
51: // i18n[I18n.appendCodeDescription=
52: // The Create/Append ... button will parse the Java files in the source directory
53: // for comments of the form // i18n[myKey=My text]] and generate a myKey=My text property in the
54: // I18nStrings.properties file in the same directory as the Java file.
55: // If the file doesn't exist it will be created.
56: // Such a comment may stretch over serveral subsequent lines.
57: // To have a ]] in a property use ]]]] in the comment. /* ... */ comments are not supported.\n\n
58: //The parser is also able to replace a string in the source code by the usual s_stringMgr.getString("key") if:\n
59: // - the string fits in none line\n
60: // - the i18n comment is placed in the line above the string\n
61: // - the string doesn't contain parameters]
62: MultipleLineLabel lblDescription = new MultipleLineLabel(
63: s_stringMgr.getString("I18n.appendCodeDescription"));
64: add(lblDescription, gbc);
65:
66: gbc = new GridBagConstraints(0, 2, 3, 1, 0, 0,
67: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
68: new Insets(5, 5, 5, 5), 0, 0);
69: // i18n[I18n.appendI18nStringsProps=Create/Append I18nString.properties files]
70: btnAppendI18nInCode = new JButton(s_stringMgr
71: .getString("I18n.appendI18nStringsProps"));
72: add(btnAppendI18nInCode, gbc);
73:
74: JPanel pnlDist = new JPanel();
75: gbc = new GridBagConstraints(0, 3, 3, 1, 1, 1,
76: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
77: new Insets(5, 5, 5, 5), 0, 0);
78: add(pnlDist, gbc);
79:
80: }
81:
82: }
|