Revision 2517

tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 2517)
478 478
		
479 479
		nodePath = findNodePath(nodePath, result, key);
480 480
		
481
		defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getBoolean(key, defaultValue);
481
		// defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getBoolean(key, defaultValue);
482 482
		return preferencesRootNode.node(nodePath).getBoolean(key, defaultValue);
483 483
	}
484 484
	
......
774 774
	 * @param key
775 775
	 * @return
776 776
	 */
777
	public static int getInt(String key, TXMResult result, String nodePath) {
777
	public static int getInt(String key, TXMResult result, String nodePath, int defaultValue) {
778 778
		nodePath = findNodePath(nodePath, result, key);
779 779
		
780
		int defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getInt(key, 0);
780
		// int defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getInt(key, 0);
781 781
		return preferencesRootNode.node(nodePath).getInt(key, defaultValue);
782 782
		
783 783
	}
784 784
	
785 785
	/**
786
	 * 
787
	 * @param key
788
	 * @param result
789
	 * @param nodePath
790
	 * @return
791
	 */
792
	public static int getInt(String key, TXMResult result, String nodePath) {
793
		return getInt(key, result, nodePath, 0);
794
	}
795
	
796
	/**
786 797
	 *
787 798
	 * @param nodePath
788 799
	 * @param key
......
803 814
	}
804 815
	
805 816
	
817
	
818
	
806 819
	/**
807 820
	 * Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes.
808 821
	 * Returns the value of a key in the specified parameters if exists.
......
846 859
	public static long getLong(String key, TXMResult result, String nodePath, long defaultValue) {
847 860
		nodePath = findNodePath(nodePath, result, key);
848 861
		
849
		defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getLong(key, defaultValue);
862
		// defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getLong(key, defaultValue);
850 863
		return preferencesRootNode.node(nodePath).getLong(key, defaultValue);
851 864
		
852 865
	}
......
930 943
	public static double getDouble(String key, String nodePath, TXMResult result, double defaultValue) {
931 944
		nodePath = findNodePath(nodePath, result, key);
932 945
		
933
		defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getDouble(key, defaultValue);
946
		// defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getDouble(key, defaultValue);
934 947
		return preferencesRootNode.node(nodePath).getDouble(key, defaultValue);
935 948
	}
936 949
	
......
1015 1028
	public static float getFloat(String key, String nodePath, TXMResult result, float defaultValue) {
1016 1029
		nodePath = findNodePath(nodePath, result, key);
1017 1030
		
1018
		defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getFloat(key, defaultValue);
1031
		// defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getFloat(key, defaultValue);
1019 1032
		return preferencesRootNode.node(nodePath).getFloat(key, defaultValue);
1020 1033
	}
1021 1034
	
......
1499 1512
	
1500 1513
	/**
1501 1514
	 * Internal method to find the preference node path of a result otherwise look in instance, default scopes and in alternatives nodes qualifiers.
1502
	 * 
1515
	 *
1503 1516
	 * @param result
1504 1517
	 * @param key
1505 1518
	 */
......
1507 1520
		
1508 1521
		boolean keyExists = (result != null && keyExists(result.getParametersNodePath(), key));
1509 1522
		
1510
		// get the result scope preference
1523
		// get the result scope preference (formed as "project/project_name/uuid_class")
1511 1524
		if (keyExists) {
1512
			nodePath = result.getParametersNodePath();
1525
			return result.getParametersNodePath();
1513 1526
		}
1527
		// look in the instance scope
1528
		else if (keyExists("instance/" + nodePath, key)) {
1529
			return "instance/" + nodePath;
1530
		}
1514 1531
		// look in the global alternative preferences nodes
1515
		else if (!keyExists("instance/" + nodePath, key)) {
1532
		else {
1516 1533
			for (int i = 0; i < alternativeNodesQualifiers.size(); i++) {
1517 1534
				if (keyExists("instance/" + alternativeNodesQualifiers.get(i), key)) {
1518
					nodePath = "instance/" + alternativeNodesQualifiers.get(i);
1519
					break;
1535
					return "instance/" + alternativeNodesQualifiers.get(i);
1520 1536
				}
1537
				else if (keyExists("default/" + alternativeNodesQualifiers.get(i), key)) {
1538
					return "default/" + alternativeNodesQualifiers.get(i);
1539
				}
1521 1540
			}
1541
			
1542
			return "default/" + nodePath;
1522 1543
		}
1523
		else {
1524
			nodePath = "instance/" + nodePath;
1525
		}
1526 1544
		
1527
		// if (nodePath == null) {
1528
		// try {
1529
		// Log.warning("TXMPreferences.findNodePath(): no node qualifier has been found (key = " + key + ", TXMResult = " + result + ").");
1530
		// }
1531
		// catch(Exception e) {
1532
		// e.printStackTrace();
1533
		// }
1534
		// }
1535
		return nodePath;
1536 1545
	}
1537 1546
	
1538 1547
	
1548
	// /**
1549
	// * Looks for the value of the specified <code>key</code> in preference nodes.
1550
	// * Returns the value of the local result node if exists.
1551
	// * Otherwise try to get it from the specified node qualifier if exists.
1552
	// * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
1553
	// * Returns defaultValue if no value has been found for the specified key.
1554
	// *
1555
	// * @param nodePath
1556
	// * @param result
1557
	// * @param key
1558
	// * @param defaultValue
1559
	// * @return
1560
	// */
1561
	// public static long getLong(String key, TXMResult result, String nodePath, long defaultValue) {
1562
	// if(nodePath != null) {
1563
	// defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getLong(key, defaultValue);
1564
	// }
1565
	//
1566
	// nodePath = findNodePath(nodePath, result, key);
1567
	//
1568
	// return preferencesRootNode.node(nodePath).getLong(key, defaultValue);
1569
	//
1570
	// }
1571
	//
1572
	//
1539 1573
	
1574
	
1575
	
1540 1576
	/**
1541 1577
	 * Stores the specified parameters pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
1542 1578
	 * 
1543 1579
	 * @param result
1544 1580
	 * @param parameters
1545 1581
	 */
1546
	// FIXME: became useless?
1582
	// FIXME: SJ: became useless?
1547 1583
	// public static void putLocalParameters(TXMResult result, TXMParameters parameters) {
1548 1584
	// Set keys = parameters.keySet();
1549 1585
	// Iterator it = keys.iterator();
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2517)
245 245
				parametersNodePath = this.getProject().getParametersNodeRootPath();
246 246
			}
247 247
			else {
248
				parametersNodePath = ""; //$NON-NLS-1$ ;
248
				parametersNodePath = ""; //$NON-NLS-1$
249 249
			}
250 250
			
251 251
			this.parametersNodePath = parametersNodePath + createUUID() + "_" + this.getClass().getSimpleName(); //$NON-NLS-1$ ;
tmp/org.txm.core/src/java/org/txm/core/messages/TXMCoreMessages.java (revision 2517)
83 83
	
84 84
	public static String info_computingChildrenOfP0;
85 85
	
86
	
87
	
88 86
	public static String error_error2;
89 87
	
90 88
	public static String error_error;
tmp/org.txm.core/META-INF/MANIFEST.MF (revision 2517)
178 178
 .jar,lib/json-20090211.jar,lib/juh-3.2.1.jar,lib/jurt-3.2.1.jar,lib/r
179 179
 idl-3.2.1.jar,lib/unoil-3.2.1.jar,lib/sqlite-jdbc-3.8.11.2.jar,lib/po
180 180
 stgresql-9.4.1207.jre6.jar,lib/jodconverter-core-3.1-beta.jar
181
Require-Bundle: org.txm.utils.core;bundle-version="1.0.0";visibility:=
182
 reexport,org.txm.libs.groovy-all;bundle-version="1.0.0";visibility:=r
183
 eexport,org.eclipse.core.runtime;bundle-version="3.10.0";visibility:=
184
 reexport,org.eclipse.osgi.util;bundle-version="3.2.0";visibility:=ree
185
 xport,org.eclipse.core.net;visibility:=reexport,org.eclipse.osgi;visi
186
 bility:=reexport,org.eclipse.ui.workbench;visibility:=reexport,org.ec
187
 lipse.core.commands;visibility:=reexport,org.eclipse.core.resources;v
188
 isibility:=reexport,org.txm.libs.office;bundle-version="0.0.0";visibi
189
 lity:=reexport,org.txm.libs.msoffice;bundle-version="0.0.0";visibilit
190
 y:=reexport,org.txm.libs.hsqldb;bundle-version="1.0.0";visibility:=re
191
 export
181
Require-Bundle: org.txm.utils.core;bundle-version="1.0.0";visibility:=reexport,
182
 org.txm.libs.groovy-all;bundle-version="1.0.0";visibility:=reexport,
183
 org.eclipse.core.runtime;bundle-version="3.10.0";visibility:=reexport,
184
 org.eclipse.osgi.util;bundle-version="3.2.0";visibility:=reexport,
185
 org.eclipse.core.net;visibility:=reexport,
186
 org.eclipse.osgi;visibility:=reexport,
187
 org.eclipse.ui.workbench;visibility:=reexport,
188
 org.eclipse.core.commands;visibility:=reexport,
189
 org.eclipse.core.resources;visibility:=reexport,
190
 org.txm.libs.office;bundle-version="0.0.0";visibility:=reexport,
191
 org.txm.libs.msoffice;bundle-version="0.0.0";visibility:=reexport,
192
 org.txm.libs.hsqldb;bundle-version="1.0.0";visibility:=reexport
192 193
Bundle-ActivationPolicy: lazy
193 194
Bundle-ManifestVersion: 2
194 195
Bundle-Activator: org.txm.core.Activator

Also available in: Unified diff