Révision 2426

tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 2426)
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...
tmp/org.txm.core/src/java/org/txm/utils/LogMonitor.java (revision 2426)
12 12
 *
13 13
 */
14 14
public class LogMonitor implements IProgressMonitor {
15

  
15
	
16 16
	String monitorName;
17
	
17 18
	boolean cancel = false;
18 19
	
19 20
	/**
20 21
	 * Un-named monitor
21 22
	 */
22 23
	public LogMonitor() {
23
		this.monitorName = "M"+UUID.randomUUID();
24
		this("M" + UUID.randomUUID());
24 25
	}
25 26
	
26 27
	/**
......
34 35
	
35 36
	@Override
36 37
	public void beginTask(String name, int totalWork) {
37
		Log.fine(this.monitorName+" -> "+name+" "+totalWork);
38
		Log.fine(this.monitorName + " -> " + name + " " + totalWork);
38 39
	}
39

  
40
	
40 41
	@Override
41 42
	public void done() {
42 43
		// TODO Auto-generated method stub
43 44
		
44 45
	}
45

  
46
	
46 47
	@Override
47 48
	public void internalWorked(double work) {
48 49
		// TODO Auto-generated method stub
49 50
		
50 51
	}
51

  
52
	
52 53
	@Override
53 54
	public boolean isCanceled() {
54 55
		return cancel;
55 56
	}
56

  
57
	
57 58
	@Override
58 59
	public void setCanceled(boolean value) {
59 60
		this.cancel = value;
60 61
	}
61

  
62
	
62 63
	@Override
63 64
	public void setTaskName(String name) {
64
		Log.fine(this.monitorName+" -> task "+name);
65
		Log.fine(this.monitorName + " -> task " + name);
65 66
	}
66

  
67
	
67 68
	@Override
68 69
	public void subTask(String name) {
69
		Log.fine(this.monitorName+" -> subTask "+name);
70
		Log.fine(this.monitorName + " -> subTask " + name);
70 71
		
71 72
	}
72

  
73
	
73 74
	@Override
74 75
	public void worked(int work) {
75 76
		// TODO Auto-generated method stub

Formats disponibles : Unified diff