Révision 1249
| tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/WorkspaceMessagesManager.java (revision 1249) | ||
|---|---|---|
| 113 | 113 |
} |
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 |
/** |
|
| 117 |
* Save modifications of keys of all known PluginMessages in all known source files |
|
| 118 |
*/ |
|
| 119 |
public void saveKeyModificationsInSources() {
|
|
| 120 |
HashMap<String, String> modifications = new HashMap<String, String>(); |
|
| 121 |
|
|
| 122 |
// stores all modifications |
|
| 123 |
for (PluginMessages pm : pluginsMessagesPerProject.values()) {
|
|
| 124 |
HashMap<String, String> modifs = pm.getKeyModifications(); |
|
| 125 |
String name = pm.getMessageClassName(); |
|
| 126 |
for (String old : modifs.keySet()) {
|
|
| 127 |
modifications.put(name+"."+old, name+"."+modifs.get(old)); // prefix the key with class name: Key -> XXXMessages.Key used in sources |
|
| 128 |
} |
|
| 129 |
} |
|
| 130 |
|
|
| 131 |
// update source files |
|
| 132 |
ArrayList<String> updated = new ArrayList<String>(); |
|
| 133 |
for (PluginMessages pm : pluginsMessagesPerProject.values()) {
|
|
| 134 |
HashMap<String, TreeSet<File>> index = pm.getUsedKeysFilesIndex(); |
|
| 135 |
for (String oldKey : modifications.keySet()) {
|
|
| 136 |
if (index.containsKey(oldKey)) {
|
|
| 137 |
System.out.println("REPLACE IN SOURCE FILE THE KEY="+oldKey+" BY KEY="+modifications.get(oldKey));
|
|
| 138 |
updated.add(oldKey); |
|
| 139 |
} |
|
| 140 |
} |
|
| 141 |
|
|
| 142 |
// remove saved modifications |
|
| 143 |
for (String oldKey : updated) {
|
|
| 144 |
modifications.remove(oldKey); |
|
| 145 |
} |
|
| 146 |
} |
|
| 147 |
} |
|
| 148 |
|
|
| 116 | 149 |
public LinkedHashMap<File, PluginMessages> getPluginMessages() {
|
| 117 | 150 |
return pluginsMessagesPerProject; |
| 118 | 151 |
} |
Formats disponibles : Unified diff