Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindUnusedTranslations.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindUnusedTranslations.java	(revision 1231)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindUnusedTranslations.java	(revision 1232)
@@ -1,5 +1,40 @@
 package org.txm.rcp.translate.devtools;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+
+import org.txm.rcp.translate.i18n.PluginMessages;
+import org.txm.rcp.translate.i18n.WorkspaceMessagesManager;
+import org.txm.utils.BiHashMap;
+
 public class FindUnusedTranslations {
+	public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, IOException {
+		WorkspaceMessagesManager wmm = new WorkspaceMessagesManager();
+		LinkedHashMap<File, PluginMessages> h = wmm.getPluginMessages();
 
-}
+		String langs[] = {"", "_fr", "_ru"};
+
+		for (File project : h.keySet()) {
+
+			PluginMessages messages = h.get(project);
+			LinkedHashSet<String> keys = messages.getMessageKeys();
+			for (String lang : langs) {
+				BiHashMap<String, String> lmessages = messages.getMessagesForLang(lang);
+				if (lmessages == null) continue;
+				
+				for (String k : lmessages.getKeys()) {
+					if (!keys.contains(k)) {
+						System.out.println(" Remove key="+k);
+						lmessages.removeByKey(k);
+					}
+				}
+			}
+			
+			// messages.saveChanges();
+		}
+	}
+}
\ No newline at end of file
Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindMessagesToBind.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindMessagesToBind.java	(revision 0)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindMessagesToBind.java	(revision 1232)
@@ -0,0 +1,115 @@
+package org.txm.rcp.translate.devtools;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+import org.txm.rcp.translate.i18n.PluginMessages;
+import org.txm.rcp.translate.i18n.WorkspaceMessagesManager;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.io.IOUtils;
+
+/**
+ * 
+ * Finds duplicated messages in all core and rcp plug-ins.
+ * Merges them in a new key and move them to org.txm.core or org.txm.rcp.
+ *
+ */
+public class FindMessagesToBind {
+
+	private void processSourceFile(File sourceFile) {
+
+		//BufferedReader reader = IOUtils.getReader(sourceFile)
+		//String line = reader.readLine();
+		boolean ignore = false;
+		ArrayList<String> lines = IOUtils.getLines(sourceFile, "UTF-8");
+		
+		for (String line : lines) {
+			//println ""+line
+			String l = line.trim();
+
+			if (ignore) {
+				if (l.startsWith("*/") || l.endsWith("*/")) {
+					ignore = false;
+				}
+			} else {
+				if (l.startsWith("//") || l.startsWith("@")) {
+					// ignore
+				} else if (l.startsWith("/*")) {
+					ignore = true;
+					if (l.endsWith("*/")) ignore=false;
+				} else {
+					ArrayList<String> strings = getLineStrings(l);
+					if (strings.size() > 0) {
+						System.out.println(strings);
+					}
+				}
+			}
+
+		}
+	}
+
+	private ArrayList<String> getLineStrings(String l) {
+		ArrayList<String> strings = new ArrayList<String>();
+		boolean inS = false;
+		int start = 0;
+		int comment = 0;
+		for(int i = 0 ; i < l.length() ; i++) {
+			String c = ""+l.charAt(i);
+			if (inS) {
+				comment = 0;
+				if (c.equals("\\")) {
+					i++;
+				} else if (c.equals("\"")) {
+					inS = false;
+					strings.add(l.substring(start, i+1));
+				}
+			} else {
+				if (c.equals("\"")) {
+					inS = true;
+					start = i;
+					comment = 0;
+				} else if (c.equals("/")) {
+					comment++;
+					if (comment == 2) break;
+				} else {
+					comment = 0;
+				}
+			}
+		}
+		return strings;
+	}
+
+	public void run() throws UnsupportedEncodingException, FileNotFoundException, IOException {
+		WorkspaceMessagesManager wmm = new WorkspaceMessagesManager();
+		LinkedHashMap<File, PluginMessages> h = wmm.getPluginMessages();
+
+		for (File project : h.keySet()) {
+
+			System.out.println("Project: "+project);
+
+			File srcDir = new File(project, "src/java");
+			if (!srcDir.exists())  srcDir = new File(project, "src");
+			if (!srcDir.exists()) continue; // no Java sources
+
+			ArrayList<File> files = DeleteDir.scanDirectory(srcDir, true);
+			for (File javaFile : files) {
+
+				if (!javaFile.getName().endsWith(".java")) continue;
+				if (javaFile.getName().endsWith("Messages.java")) continue;
+
+				System.out.println(" File: "+javaFile);
+				processSourceFile(javaFile);
+			}
+		}
+	}
+
+	public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, IOException {
+
+		new FindMessagesToBind().run();
+	}
+}

Property changes on: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindMessagesToBind.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ImportFromOneFile.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ImportFromOneFile.java	(revision 1231)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ImportFromOneFile.java	(revision 1232)
@@ -68,6 +68,11 @@
 			}
 			total_update += update;
 		}
+		
+		for (File project : h.keySet()) {
+			//h.get(project).saveChanges();
+		}
+		
 		if (total_update == 0) {
 			System.out.println("Done, no update done.");
 		} else {
Index: tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessages.java
===================================================================
--- tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessages.java	(revision 1231)
+++ tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessages.java	(revision 1232)
@@ -70,6 +70,11 @@
 		}
 	}
 	
+	public BiHashMap<String, String> getMessagesForLang(String lang) {
+		File p = new File(messageFile.getParentFile(), "messages"+lang+".properties");
+		return langs.get(p);
+	}
+	
 	public void put(String lang, String key, String message) {
 		messageKeys.add(key);
 		
@@ -138,23 +143,32 @@
 //		return missing
 //	}
 	
-	public void saveChanges() throws UnsupportedEncodingException, FileNotFoundException {
+	public void saveChanges() throws IOException {
 
 		//Write prop File
 		for (File propFile : langs.keySet()) {
-			String name = propFile.getName();
-			if (!name.endsWith(".properties")) continue;
+
+			Properties props = new Properties();
+			BiHashMap<String, String> h = langs.get(propFile);
+			for (String k : h.getKeys()) {
+				props.setProperty(k, h.get(k));
+			}
 			
-			File oldFile = new File(propFile.getParentFile(), propFile.getName()+".cpy");
-			propFile.renameTo(oldFile);
+			if (propFile.exists()) {
+				File oldFile = new File(propFile.getParentFile(), propFile.getName()+".old");
+				if (oldFile.exists()) {
+					oldFile.delete();
+				}
+				propFile.renameTo(oldFile);
+			}
 			
-			Properties props = new Properties();
+			props.store(IOUtils.getWriter(propFile, encoding),  "TXM messages generated by the PluginMessages class");
 		}
 		
 		// write message File
 		if (messageFile == null) return;
 		
-		File oldFile2 = new File(messageFile.getParentFile(), messageFile.getName()+".cpy");
+		File oldFile2 = new File(messageFile.getParentFile(), messageFile.getName()+".old");
 		messageFile.renameTo(oldFile2); // back up
 		
 		String className = getMessageClassName();
