Révision 1330

tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 1330)
644 644
		ArrayList<String> lines = IOUtils.getLines(javaMessageFile, "UFT-8");
645 645
		TreeSet<String> oldKeys = new TreeSet<String>(IOUtils.findWithGroup(javaMessageFile, "public static String ([^\"=;]+);"));
646 646
		TreeSet<String> newKeys = new TreeSet<String>(messageKeys);
647
		TreeSet<String> writtenKeys = new TreeSet<String>();
648
		
647 649
		newKeys.removeAll(oldKeys);
648 650
		newKeys.removeAll(keyModifications.values()); // now contains only the very newly created keys
649 651

  
......
671 673
					out.println("\t");
672 674
				}
673 675
				for (String key : newKeys) {
676
					if (writtenKeys.contains(key)) continue; // key already written
674 677
					out.println("\tpublic static String "+key+";");
678
					writtenKeys.add(key);
675 679
				}
676 680
			} else if (l.startsWith("public static String") && l.endsWith(";") && !l.contains("=") && !l.contains("\"")) {
677 681

  
678 682
				String key = l.substring(21, l.length() -1);
679 683
				if (messageKeys.contains(key)) {
684
					if (writtenKeys.contains(key)) continue; // key already written
680 685
					out.println(line); // keep the line
686
					writtenKeys.add(key);
681 687
				} else if (keyModifications.containsKey(key)){
682 688
					// the key has been renamed
689
					if (writtenKeys.contains(keyModifications.get(key))) continue; // key already written
683 690
					out.println("\tpublic static String "+keyModifications.get(key)+"; "+comments);
691
					writtenKeys.add(keyModifications.get(key));
684 692
				} else {
685 693
					// the key has been removed
686 694
				}
......
910 918

  
911 919
		// test to find files using the specified key
912 920
		/*
913
		String key = "TXMCoreMessages.Base_0";
921
		String key = "TXMCoreMessages.binaryDirectory";
914 922
		TreeSet<File> files = pmManager.getFilesUsingKey(key);
915 923
		System.out.println("getFilesUsingKey: files using key: " + key);
916 924
		for(File file : files)	{

Formats disponibles : Unified diff