Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.6 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.7 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.6 Wed Nov 7 10:21:44 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java Thu Nov 8 14:33:42 2007 @@ -34,6 +34,7 @@ import java.util.regex.Pattern; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; @@ -55,6 +56,7 @@ // Modification des clés dans le fichier protected List newKeys; + protected boolean needModifiedFile; protected String patternLeft; protected String patternRight; @@ -63,6 +65,7 @@ protected JLabel path = new JLabel(); protected JTextField key = new JTextField(); protected JTextField pattern = new JTextField(".*"); + protected JCheckBox onlyNewKey = new JCheckBox(); protected JButton next = new JButton("Next >>"); /** @@ -74,7 +77,7 @@ this.patternLeft = patternLeft; this.patternRight = patternRight; - setLayout(new GridLayout(8, 2, 10, 10)); + setLayout(new GridLayout(9, 2, 10, 10)); Container pane = getContentPane(); pane.add(new JLabel("--- File information ---")); @@ -98,6 +101,9 @@ pane.add(new JLabel("Pattern :")); pane.add(pattern); + pane.add(new JLabel("Only new key :")); + pane.add(onlyNewKey); + pane.add(new JLabel()); pane.add(next); @@ -105,7 +111,7 @@ addWindowListener(new EventWindows()); setTitle("Keys modifier"); - setSize(800, 300); + setSize(800, 400); // pack(); setVisible(true); } @@ -121,6 +127,7 @@ repaint(); newKeys = new ArrayList(); + needModifiedFile = false; } /* @@ -128,7 +135,7 @@ * @see org.codelutin.i18n.plugin.core.ParserEvent#eventNextFile(java.io.File) */ public void eventNextFile(File file) { - if(!newKeys.isEmpty()) { + if(needModifiedFile) { String content = ""; int region = 0; @@ -161,11 +168,11 @@ * (non-Javadoc) * @see org.codelutin.i18n.plugin.core.ParserEvent#eventChangeKey(java.lang.String) */ - public synchronized void eventChangeKey(String keyI18n) { + public synchronized void eventChangeKey(String keyI18n, boolean newKey) { key.setText(keyI18n); newKeys.add(key.getText()); repaint(); - if(isVisible() && keyI18n.matches(pattern.getText())) { + if(isVisible() && keyI18n.matches(pattern.getText()) && (!onlyNewKey.isSelected() || newKey)) { try { wait(); } catch (InterruptedException e) { @@ -180,6 +187,7 @@ */ public String eventGetRealKey() { newKeys.add(key.getText()); + needModifiedFile |= !newKeys.get(newKeys.size() - 1).equals(newKeys.get(newKeys.size() - 2)); return key.getText(); }