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.3 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.4 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.3 Fri Nov 2 15:02:59 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java Fri Nov 2 15:20:04 2007 @@ -42,7 +42,7 @@ this.patternLeft = patternLeft; this.patternRight = patternRight; - setLayout(new GridLayout(7, 2, 10, 10)); + setLayout(new GridLayout(6, 2, 10, 10)); Container pane = getContentPane(); pane.add(new JLabel("--- File information ---")); @@ -82,30 +82,32 @@ } public void eventNextFile(File file) { - String content = ""; - int region = 0; + if(!newKeys.isEmpty()) { + String content = ""; + int region = 0; - try { - content = FileUtil.readAsString(file); - } catch (IOException e) { - throw new ParserException(e); - } + try { + content = FileUtil.readAsString(file); + } catch (IOException e) { + throw new ParserException(e); + } - for (Iterator iterator = newKeys.iterator(); iterator.hasNext();) { - String oldKey = iterator.next(); - String realKey = iterator.next(); - Pattern pattern = Pattern.compile("(" + patternLeft + ")(" + Pattern.quote(oldKey) + ")(" + patternRight + ")"); - Matcher matcher = pattern.matcher(content); - matcher.region(region, content.length()); - matcher.find(); - region = matcher.start(); - content = matcher.replaceFirst("$1" + realKey + "$3"); - } + for (Iterator iterator = newKeys.iterator(); iterator.hasNext();) { + String oldKey = iterator.next(); + String realKey = iterator.next(); + Pattern pattern = Pattern.compile("(" + patternLeft + ")(" + Pattern.quote(oldKey) + ")(" + patternRight + ")"); + Matcher matcher = pattern.matcher(content); + matcher.region(region, content.length()); + matcher.find(); + region = matcher.start(); + content = matcher.replaceFirst("$1" + realKey + "$3"); + } - try { - FileUtil.writeString(file, content); - } catch (IOException e) { - throw new ParserException(e); + try { + FileUtil.writeString(file, content); + } catch (IOException e) { + throw new ParserException(e); + } } }