| 72 |
72 |
/**
|
| 73 |
73 |
* Alternative nodes to look up when getting a preference.
|
| 74 |
74 |
*/
|
| 75 |
|
public static ArrayList<String> alternativeNodesQualifiers = new ArrayList<String>();
|
|
75 |
public static ArrayList<String> alternativeNodesQualifiers = new ArrayList<>();
|
| 76 |
76 |
|
| 77 |
77 |
|
| 78 |
78 |
// TXMResult internal parameters, essentially for Links and Persistence
|
| ... | ... | |
| 1286 |
1286 |
|
| 1287 |
1287 |
public static HashMap<String, Object> getKeysAndValuesAsMap(IScopeContext scope, String nodePath) {
|
| 1288 |
1288 |
|
| 1289 |
|
HashMap<String, Object> str = new HashMap<String, Object>();
|
|
1289 |
HashMap<String, Object> str = new HashMap<>();
|
| 1290 |
1290 |
|
| 1291 |
1291 |
IEclipsePreferences preferences = scope.getNode(nodePath);
|
| 1292 |
1292 |
|
| ... | ... | |
| 1367 |
1367 |
}
|
| 1368 |
1368 |
|
| 1369 |
1369 |
|
| 1370 |
|
/**
|
| 1371 |
|
* Saves the local preferences to file.
|
| 1372 |
|
*
|
| 1373 |
|
* @param result
|
| 1374 |
|
*/
|
| 1375 |
|
public static void flush(TXMResult result) {
|
| 1376 |
|
Log.finest("TXMPreferences.flush(): Local preferences for object " + result.getParametersNodePath() + " saved to file.");
|
| 1377 |
|
flush(result.getParametersNodePath());
|
| 1378 |
|
}
|
| 1379 |
1370 |
|
| 1380 |
1371 |
/**
|
| 1381 |
|
* Saves the local preferences to file.
|
| 1382 |
|
*
|
| 1383 |
|
* @param result
|
| 1384 |
|
*/
|
| 1385 |
|
public static void flush(String nodePath) {
|
| 1386 |
|
try {
|
| 1387 |
|
preferencesRootNode.node(nodePath).flush();
|
| 1388 |
|
}
|
| 1389 |
|
catch (BackingStoreException e) {
|
| 1390 |
|
e.printStackTrace();
|
| 1391 |
|
Log.severe(e.getMessage());
|
| 1392 |
|
}
|
| 1393 |
|
}
|
| 1394 |
|
|
| 1395 |
|
public void flush() {
|
| 1396 |
|
TXMPreferences.flush(this.commandPreferencesNodeQualifier);
|
| 1397 |
|
}
|
| 1398 |
|
|
| 1399 |
|
|
| 1400 |
|
/**
|
| 1401 |
1372 |
* Deletes the local node if exists and the associated .prefs persistence file.
|
| 1402 |
1373 |
*
|
| 1403 |
1374 |
* @param result
|
| ... | ... | |
| 1467 |
1438 |
public static ArrayList<String> getAllResultsNodePaths(String rootPath) {
|
| 1468 |
1439 |
Log.finest("TXMPreferences.getAllResultsNodePaths(): looking for nodes in path \"" + preferencesRootNode.node(rootPath) + "\".");
|
| 1469 |
1440 |
|
| 1470 |
|
ArrayList<String> nodePaths = new ArrayList<String>();
|
|
1441 |
ArrayList<String> nodePaths = new ArrayList<>();
|
| 1471 |
1442 |
|
| 1472 |
1443 |
try {
|
| 1473 |
1444 |
String[] nodesNames = preferencesRootNode.node(rootPath).childrenNames();
|
| ... | ... | |
| 1844 |
1815 |
return false;
|
| 1845 |
1816 |
}
|
| 1846 |
1817 |
|
|
1818 |
|
|
1819 |
/**
|
|
1820 |
* Saves the preference node of the specified result into file.
|
|
1821 |
*
|
|
1822 |
* @param result
|
|
1823 |
*/
|
|
1824 |
public static void flush(TXMResult result) {
|
|
1825 |
Log.finest("TXMPreferences.flush(): Local preferences for object " + result.getParametersNodePath() + " saved to file.");
|
|
1826 |
flush(result.getParametersNodePath());
|
|
1827 |
}
|
|
1828 |
|
|
1829 |
/**
|
|
1830 |
* Saves the specified node into file.
|
|
1831 |
*
|
|
1832 |
* @param result
|
|
1833 |
*/
|
|
1834 |
public static void flush(String nodePath) {
|
|
1835 |
try {
|
|
1836 |
preferencesRootNode.node(nodePath).flush();
|
|
1837 |
}
|
|
1838 |
catch (BackingStoreException e) {
|
|
1839 |
e.printStackTrace();
|
|
1840 |
Log.severe(e.getMessage());
|
|
1841 |
}
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
/**
|
|
1845 |
* Saves the preference node of the current instance into file.
|
|
1846 |
* Generally the bundle id node path.
|
|
1847 |
*/
|
|
1848 |
public void flush() {
|
|
1849 |
TXMPreferences.flush(this.commandPreferencesNodeQualifier);
|
|
1850 |
}
|
|
1851 |
|
|
1852 |
|
| 1847 |
1853 |
// FIXME: this code is dedicated to dynamically retrieve the static field PREFERENCES_NODE of the runtime subclass and use it super class to avoid to pass it to all methods.
|
| 1848 |
1854 |
// eg. to use ProgressionPreferences.getBoolean("test") instead of TXMPreferences.getBoolean(ProgressionPreferences.PREFERENCES_NODE, "test")
|
| 1849 |
1855 |
// but it doesn"t work, need to continue the tests...
|