From: <kp...@us...> - 2012-06-27 08:49:49
|
Revision: 21881 http://jedit.svn.sourceforge.net/jedit/?rev=21881&view=rev Author: kpouer Date: 2012-06-27 08:49:43 +0000 (Wed, 27 Jun 2012) Log Message: ----------- Added an option to choose the language Modified Paths: -------------- plugins/VoxSpell/branches/branch_2.0/VoxSpell.props plugins/VoxSpell/branches/branch_2.0/voxspellcheck/VoxSpellOptionPane.java Modified: plugins/VoxSpell/branches/branch_2.0/VoxSpell.props =================================================================== --- plugins/VoxSpell/branches/branch_2.0/VoxSpell.props 2012-06-26 19:01:02 UTC (rev 21880) +++ plugins/VoxSpell/branches/branch_2.0/VoxSpell.props 2012-06-27 08:49:43 UTC (rev 21881) @@ -22,6 +22,7 @@ options.voxspellcheck.use_custom_color.title=Use custom underline color? options.voxspellcheck.default_language=en options.voxspellcheck.default_language.title=Default language +options.voxspellcheck.available_languages=en de fr pl plugin.voxspellcheck.VoxSpellPlugin.menu=voxspellcheck.start voxspellcheck.stop - \ voxspellcheck.addWord voxspellcheck.ignoreWord - voxspellcheck.reset - \ Modified: plugins/VoxSpell/branches/branch_2.0/voxspellcheck/VoxSpellOptionPane.java =================================================================== --- plugins/VoxSpell/branches/branch_2.0/voxspellcheck/VoxSpellOptionPane.java 2012-06-26 19:01:02 UTC (rev 21880) +++ plugins/VoxSpell/branches/branch_2.0/voxspellcheck/VoxSpellOptionPane.java 2012-06-27 08:49:43 UTC (rev 21881) @@ -1,4 +1,3 @@ - /* Copyright (C) 2008 Matthew Gilbert @@ -49,8 +48,10 @@ private JCheckBox start_checking_on_activate; private JCheckBox use_custom_color; private Color color; + + private JComboBox defaultLanguage; - private static String color_button_text = "Click here to select a new underline color"; + private static final String color_button_text = "Click here to select a new underline color"; private class CustomButton extends JButton { @@ -58,7 +59,7 @@ protected int width, height; protected int x, y; - public CustomButton(String title) + private CustomButton(String title) { super(title); @@ -74,10 +75,11 @@ Rectangle2D r = font.getStringBounds(color_button_text, new FontRenderContext(null, true, true)); width = (int)r.getWidth(); height = (int)r.getHeight(); - this.setSize((int)width + 10, getHeight()); + this.setSize(width + 10, getHeight()); } - protected void paintComponent(Graphics g) + @Override + protected void paintComponent(Graphics g) { Graphics2D gfx = (Graphics2D)g; @@ -101,12 +103,16 @@ super("VoxSpellOptionPane"); } - public void _init() + @Override + public void _init() { - String s; - boolean b; - s = jEdit.getProperty("options.voxspellcheck.all_text_modes"); - all_text_modes = new JTextField(s); + String property = jEdit.getProperty("options.voxspellcheck.available_languages"); + String[] languages = property.split(" "); + defaultLanguage = new JComboBox(languages); + defaultLanguage.setSelectedItem(jEdit.getProperty("options.voxspellcheck.default_language")); + addComponent(new JLabel("Default language:"), defaultLanguage); + String s = jEdit.getProperty("options.voxspellcheck.all_text_modes"); + all_text_modes = new JTextField(s); addComponent(new JLabel("Modes where all text is checked: "), all_text_modes); s = jEdit.getProperty("options.voxspellcheck.non_markup_modes"); @@ -114,14 +120,14 @@ addComponent(new JLabel("Modes where only plain text (not syntax highlighted) is checked: "), non_markup_modes); s = jEdit.getProperty("options.voxspellcheck.start_checking_on_activate"); - b = s.equals("true"); - s = jEdit.getProperty("options.voxspellcheck.start_checking_on_activate.title"); + boolean b = s.equals("true"); + s = jEdit.getProperty("options.voxspellcheck.start_checking_on_activate.title"); start_checking_on_activate = new JCheckBox(s, b); addComponent(start_checking_on_activate); JPanel panel = new JPanel(new FlowLayout()); s = jEdit.getProperty("options.voxspellcheck.use_custom_color"); - b = s.equals("true"); + b = "true".equals(s); s = jEdit.getProperty("options.voxspellcheck.use_custom_color.title"); use_custom_color = new JCheckBox(s, b); use_custom_color.setActionCommand("enable"); @@ -157,13 +163,13 @@ addComponent(panel); } - public void _save() + @Override + public void _save() { - String s; + + String s = all_text_modes.getText(); + jEdit.setProperty("options.voxspellcheck.all_text_modes", s); - s = all_text_modes.getText(); - jEdit.setProperty("options.voxspellcheck.all_text_modes", s); - s = non_markup_modes.getText(); jEdit.setProperty("options.voxspellcheck.non_markup_modes", s); @@ -174,5 +180,7 @@ jEdit.setProperty("options.voxspellcheck.use_custom_color", s); jEdit.setColorProperty("options.voxspellcheck.custom_color", color); + + jEdit.setProperty("options.voxspellcheck.default_language", defaultLanguage.getSelectedItem().toString()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |