| 10 |
10 |
import java.util.Arrays;
|
| 11 |
11 |
import java.util.Collections;
|
| 12 |
12 |
import java.util.HashMap;
|
| 13 |
|
import java.util.Iterator;
|
| 14 |
13 |
import java.util.Map;
|
| 15 |
|
import java.util.Set;
|
| 16 |
14 |
|
| 17 |
15 |
import org.eclipse.core.runtime.Platform;
|
| 18 |
16 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
| 19 |
17 |
import org.eclipse.core.runtime.preferences.DefaultScope;
|
| 20 |
18 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
| 21 |
|
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
| 22 |
19 |
import org.eclipse.core.runtime.preferences.IScopeContext;
|
| 23 |
20 |
import org.eclipse.core.runtime.preferences.InstanceScope;
|
| 24 |
21 |
import org.osgi.framework.FrameworkUtil;
|
| 25 |
22 |
import org.osgi.service.prefs.BackingStoreException;
|
|
23 |
import org.osgi.service.prefs.Preferences;
|
| 26 |
24 |
import org.txm.core.results.TXMParameters;
|
| 27 |
25 |
import org.txm.core.results.TXMResult;
|
| 28 |
26 |
import org.txm.utils.logger.Log;
|
| ... | ... | |
| 55 |
53 |
public abstract class TXMPreferences extends AbstractPreferenceInitializer {
|
| 56 |
54 |
|
| 57 |
55 |
|
|
56 |
/**
|
|
57 |
* Scope used for storing the command preferences.
|
|
58 |
*/
|
|
59 |
//public static IScopeContext scope = InstanceScope.INSTANCE;
|
| 58 |
60 |
|
| 59 |
|
// FIXME: here we must use a ProjectScope when we'll use IProject for TXM corpora
|
| 60 |
|
public static IScopeContext scope = InstanceScope.INSTANCE;
|
| 61 |
|
|
|
61 |
|
|
62 |
public static IEclipsePreferences preferencesRootNode = Platform.getPreferencesService().getRootNode();
|
|
63 |
|
| 62 |
64 |
/**
|
| 63 |
65 |
* Alternative nodes to look up when getting a preference.
|
| 64 |
66 |
*/
|
| ... | ... | |
| 86 |
88 |
|
| 87 |
89 |
|
| 88 |
90 |
// essentially for Links and Persistence
|
|
91 |
public final static String RESULT_PARAMETERS_NODE_PATH = "result_parameters_node_path"; //$NON-NLS-1$
|
| 89 |
92 |
public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$
|
| 90 |
93 |
public final static String PARENT_UUID = "parent_uuid"; //$NON-NLS-1$
|
| 91 |
94 |
public final static String BUNDLE_ID = "bundle_id"; //$NON-NLS-1$
|
| ... | ... | |
| 166 |
169 |
/**
|
| 167 |
170 |
* Preferences node qualifier of the instance.
|
| 168 |
171 |
*/
|
| 169 |
|
protected String preferencesNode;
|
|
172 |
protected String commandPreferencesNodeQualifier;
|
| 170 |
173 |
|
| 171 |
174 |
/**
|
| 172 |
175 |
* Instances map.
|
| ... | ... | |
| 181 |
184 |
public TXMPreferences() {
|
| 182 |
185 |
super();
|
| 183 |
186 |
TXMPreferences.instances.put(this.getClass(), this);
|
| 184 |
|
this.preferencesNode = FrameworkUtil.getBundle(this.getClass()).getSymbolicName();
|
| 185 |
|
Log.info("TXMPreferences.TXMPreferences(): preferences node = " + this.preferencesNode);
|
|
187 |
this.commandPreferencesNodeQualifier = FrameworkUtil.getBundle(this.getClass()).getSymbolicName();
|
|
188 |
Log.finest("TXMPreferences.TXMPreferences(): initializing preferences for node = " + this.commandPreferencesNodeQualifier + " (" + this.getClass() +")");
|
| 186 |
189 |
}
|
| 187 |
190 |
|
| 188 |
191 |
|
| ... | ... | |
| 192 |
195 |
* @return
|
| 193 |
196 |
*/
|
| 194 |
197 |
public double getDouble(String key) {
|
| 195 |
|
return getDouble(key, this.preferencesNode);
|
|
198 |
return getDouble(key, this.commandPreferencesNodeQualifier);
|
| 196 |
199 |
}
|
| 197 |
200 |
|
| 198 |
201 |
/**
|
| ... | ... | |
| 201 |
204 |
* @return
|
| 202 |
205 |
*/
|
| 203 |
206 |
public boolean getBoolean(String key) {
|
| 204 |
|
return getBoolean(key, this.preferencesNode);
|
|
207 |
return getBoolean(key, this.commandPreferencesNodeQualifier);
|
| 205 |
208 |
}
|
| 206 |
209 |
|
| 207 |
210 |
/**
|
| ... | ... | |
| 210 |
213 |
* @return
|
| 211 |
214 |
*/
|
| 212 |
215 |
public int getInt(String key) {
|
| 213 |
|
return getInt(key, this.preferencesNode);
|
|
216 |
return getInt(key, this.commandPreferencesNodeQualifier);
|
| 214 |
217 |
}
|
| 215 |
218 |
|
| 216 |
219 |
/**
|
| ... | ... | |
| 219 |
222 |
* @return
|
| 220 |
223 |
*/
|
| 221 |
224 |
public long getLong(String key) {
|
| 222 |
|
return getLong(key, this.preferencesNode);
|
|
225 |
return getLong(key, this.commandPreferencesNodeQualifier);
|
| 223 |
226 |
}
|
| 224 |
227 |
|
| 225 |
228 |
/**
|
| ... | ... | |
| 228 |
231 |
* @return
|
| 229 |
232 |
*/
|
| 230 |
233 |
public String getString(String key) {
|
| 231 |
|
return getString(key, this.preferencesNode);
|
|
234 |
return getString(key, this.commandPreferencesNodeQualifier);
|
| 232 |
235 |
}
|
| 233 |
236 |
|
| 234 |
237 |
|
| ... | ... | |
| 238 |
241 |
* @return
|
| 239 |
242 |
*/
|
| 240 |
243 |
public float getFloat(String key) {
|
| 241 |
|
return getFloat(key, this.preferencesNode);
|
|
244 |
return getFloat(key, this.commandPreferencesNodeQualifier);
|
| 242 |
245 |
}
|
| 243 |
246 |
|
| 244 |
247 |
|
| ... | ... | |
| 247 |
250 |
* @return the preferencesNode
|
| 248 |
251 |
*/
|
| 249 |
252 |
public String getPreferencesNodeQualifier() {
|
| 250 |
|
return preferencesNode;
|
|
253 |
return commandPreferencesNodeQualifier;
|
| 251 |
254 |
}
|
| 252 |
255 |
|
| 253 |
256 |
|
| 254 |
257 |
|
| 255 |
258 |
|
| 256 |
|
/**
|
| 257 |
|
* Stores a 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.
|
| 258 |
|
*
|
| 259 |
|
* @param key
|
| 260 |
|
* @param pValue
|
| 261 |
|
*/
|
| 262 |
|
public static void remove(String key, String node) {
|
| 263 |
|
scope.getNode(node).remove(key);
|
| 264 |
|
}
|
|
259 |
// /**
|
|
260 |
// * Stores a 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.
|
|
261 |
// *
|
|
262 |
// * @param key
|
|
263 |
// * @param pValue
|
|
264 |
// */
|
|
265 |
// public static void remove(String key, String node) {
|
|
266 |
// scope.getNode(node).remove(key);
|
|
267 |
// }
|
| 265 |
268 |
|
| 266 |
269 |
/**
|
| 267 |
270 |
* Saves all preferences and session results in the default app directory.
|
| ... | ... | |
| 270 |
273 |
|
| 271 |
274 |
Log.info("Saving preferences and session results.");
|
| 272 |
275 |
|
| 273 |
|
IPreferencesService service = Platform.getPreferencesService();
|
| 274 |
276 |
try {
|
| 275 |
|
service.getRootNode().flush();
|
|
277 |
preferencesRootNode.flush();
|
| 276 |
278 |
} catch(Exception e) {
|
| 277 |
279 |
Log.severe("Error while saving preferences and session results.");
|
| 278 |
280 |
e.printStackTrace();
|
| ... | ... | |
| 287 |
289 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 288 |
290 |
* Returns <code>false</code> if no value has been found for the specified key.
|
| 289 |
291 |
* @param commandParameters
|
| 290 |
|
* @param nodeQualifier
|
|
292 |
* @param nodePath
|
| 291 |
293 |
* @param result
|
| 292 |
294 |
* @param key
|
| 293 |
295 |
* @return
|
| 294 |
296 |
*/
|
| 295 |
|
public static Serializable getSerializable(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
297 |
public static Serializable getSerializable(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 296 |
298 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 297 |
299 |
return (Serializable) commandParameters.get(key);
|
| 298 |
300 |
}
|
| 299 |
|
return getSerializable(key, result, nodeQualifier);
|
|
301 |
return getSerializable(key, result, nodePath);
|
| 300 |
302 |
}
|
| 301 |
303 |
|
| 302 |
304 |
|
| 303 |
305 |
public static Serializable getSerializable(String key, TXMParameters commandParameters, TXMResult result) {
|
| 304 |
|
return getSerializable(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
306 |
return getSerializable(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 305 |
307 |
}
|
| 306 |
308 |
|
| 307 |
309 |
/**
|
| ... | ... | |
| 310 |
312 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 311 |
313 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 312 |
314 |
* Returns defaultValue if no value has been found for the specified key.
|
| 313 |
|
* @param nodeQualifier
|
|
315 |
* @param nodePath
|
| 314 |
316 |
* @param result
|
| 315 |
317 |
* @param key
|
| 316 |
318 |
* @return
|
| 317 |
319 |
*/
|
| 318 |
|
public static Serializable getSerializable(String key, TXMResult result, String nodeQualifier, Serializable defaultValue) {
|
|
320 |
public static Serializable getSerializable(String key, TXMResult result, String nodePath, Serializable defaultValue) {
|
| 319 |
321 |
|
| 320 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
322 |
nodePath = findNodePath(nodePath, result, key);
|
| 321 |
323 |
|
| 322 |
|
String data_default = DefaultScope.INSTANCE.getNode(nodeQualifier).get(key, "");
|
|
324 |
String data_default = DefaultScope.INSTANCE.getNode(nodePath).get(key, "");
|
| 323 |
325 |
if (data_default.length() == 0) {
|
| 324 |
326 |
return null;
|
| 325 |
327 |
}
|
| ... | ... | |
| 330 |
332 |
Log.printStackTrace(e);
|
| 331 |
333 |
}
|
| 332 |
334 |
|
| 333 |
|
String data_return = scope.getNode(nodeQualifier).get(key, "");
|
|
335 |
String data_return = preferencesRootNode.node(nodePath).get(key, "");
|
| 334 |
336 |
if (data_return.length() == 0) {
|
| 335 |
337 |
return defaultValue;
|
| 336 |
338 |
}
|
| ... | ... | |
| 349 |
351 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 350 |
352 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 351 |
353 |
* Returns <code>false</code> if no value has been found for the specified key.
|
| 352 |
|
* @param nodeQualifier
|
|
354 |
* @param nodePath
|
| 353 |
355 |
* @param result
|
| 354 |
356 |
* @param key
|
| 355 |
357 |
* @return
|
| 356 |
358 |
*/
|
| 357 |
|
public static Serializable getSerializable(String key, TXMResult result, String nodeQualifier) {
|
| 358 |
|
return getSerializable(key, result, nodeQualifier, false);
|
|
359 |
public static Serializable getSerializable(String key, TXMResult result, String nodePath) {
|
|
360 |
return getSerializable(key, result, nodePath, false);
|
| 359 |
361 |
}
|
| 360 |
362 |
|
| 361 |
363 |
/**
|
| 362 |
364 |
*
|
| 363 |
|
* @param nodeQualifier
|
|
365 |
* @param nodePath
|
| 364 |
366 |
* @param key
|
| 365 |
367 |
* @return
|
| 366 |
368 |
*/
|
| 367 |
|
public static Serializable getSerializable(String key, String nodeQualifier) {
|
| 368 |
|
return getSerializable(key, null, nodeQualifier);
|
|
369 |
public static Serializable getSerializable(String key, String nodePath) {
|
|
370 |
return getSerializable(key, null, nodePath);
|
| 369 |
371 |
}
|
| 370 |
372 |
|
| 371 |
373 |
/**
|
| ... | ... | |
| 386 |
388 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 387 |
389 |
* Returns <code>false</code> if no value has been found for the specified key.
|
| 388 |
390 |
* @param commandParameters
|
| 389 |
|
* @param nodeQualifier
|
|
391 |
* @param nodePath
|
| 390 |
392 |
* @param result
|
| 391 |
393 |
* @param key
|
| 392 |
394 |
* @return
|
| 393 |
395 |
*/
|
| 394 |
|
public static boolean getBoolean(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
396 |
public static boolean getBoolean(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 395 |
397 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 396 |
398 |
return (Boolean) commandParameters.get(key);
|
| 397 |
399 |
}
|
| 398 |
|
return getBoolean(key, result, nodeQualifier);
|
|
400 |
return getBoolean(key, result, nodePath);
|
| 399 |
401 |
}
|
| 400 |
402 |
|
| 401 |
403 |
|
| 402 |
404 |
public static boolean getBoolean(String key, TXMParameters commandParameters, TXMResult result) {
|
| 403 |
|
return getBoolean(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
405 |
return getBoolean(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 404 |
406 |
}
|
| 405 |
407 |
|
| 406 |
408 |
/**
|
| ... | ... | |
| 409 |
411 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 410 |
412 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 411 |
413 |
* Returns defaultValue if no value has been found for the specified key.
|
| 412 |
|
* @param nodeQualifier
|
|
414 |
* @param nodePath
|
| 413 |
415 |
* @param result
|
| 414 |
416 |
* @param key
|
| 415 |
417 |
* @return
|
| 416 |
418 |
*/
|
| 417 |
|
public static boolean getBoolean(String key, TXMResult result, String nodeQualifier, boolean defaultValue) {
|
|
419 |
public static boolean getBoolean(String key, TXMResult result, String nodePath, boolean defaultValue) {
|
| 418 |
420 |
|
| 419 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
421 |
nodePath = findNodePath(nodePath, result, key);
|
| 420 |
422 |
|
| 421 |
|
defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getBoolean(key, defaultValue);
|
| 422 |
|
return scope.getNode(nodeQualifier).getBoolean(key, defaultValue);
|
|
423 |
defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getBoolean(key, defaultValue);
|
|
424 |
return preferencesRootNode.node(nodePath).getBoolean(key, defaultValue);
|
| 423 |
425 |
}
|
| 424 |
426 |
|
| 425 |
427 |
/**
|
| ... | ... | |
| 428 |
430 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 429 |
431 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 430 |
432 |
* Returns <code>false</code> if no value has been found for the specified key.
|
| 431 |
|
* @param nodeQualifier
|
|
433 |
* @param nodePath
|
| 432 |
434 |
* @param result
|
| 433 |
435 |
* @param key
|
| 434 |
436 |
* @return
|
| 435 |
437 |
*/
|
| 436 |
|
public static boolean getBoolean(String key, TXMResult result, String nodeQualifier) {
|
| 437 |
|
return getBoolean(key, result, nodeQualifier, false);
|
|
438 |
public static boolean getBoolean(String key, TXMResult result, String nodePath) {
|
|
439 |
return getBoolean(key, result, nodePath, false);
|
| 438 |
440 |
}
|
| 439 |
441 |
|
| 440 |
442 |
/**
|
| 441 |
443 |
*
|
| 442 |
|
* @param nodeQualifier
|
|
444 |
* @param nodePath
|
| 443 |
445 |
* @param key
|
| 444 |
446 |
* @return
|
| 445 |
447 |
*/
|
| 446 |
|
public static boolean getBoolean(String key, String nodeQualifier) {
|
| 447 |
|
return getBoolean(key, null, nodeQualifier);
|
|
448 |
public static boolean getBoolean(String key, String nodePath) {
|
|
449 |
return getBoolean(key, null, nodePath);
|
| 448 |
450 |
}
|
| 449 |
451 |
|
| 450 |
452 |
/**
|
| ... | ... | |
| 463 |
465 |
* Try to cast and create a typed object from the String value of the key.
|
| 464 |
466 |
* @param commandParameters
|
| 465 |
467 |
* @param result
|
| 466 |
|
* @param nodeQualifier
|
|
468 |
* @param nodePath
|
| 467 |
469 |
* @param key
|
| 468 |
470 |
* @return
|
| 469 |
471 |
*/
|
| 470 |
472 |
//FIXME: does not work, need to test furthermore
|
| 471 |
|
// public static Object get(TXMResultParameters commandParameters, TXMResult result, String nodeQualifier, String key) {
|
|
473 |
// public static Object get(TXMResultParameters commandParameters, TXMResult result, String nodePath, String key) {
|
| 472 |
474 |
//
|
| 473 |
475 |
//
|
| 474 |
476 |
// if(commandParameters != null && commandParameters.get(key) != null) {
|
| 475 |
477 |
// return commandParameters.get(key);
|
| 476 |
478 |
// }
|
| 477 |
479 |
//
|
| 478 |
|
// nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
480 |
// nodePath = findNodeQualifier(nodePath, result, key);
|
| 479 |
481 |
//
|
| 480 |
|
// String stringValue = getString(nodeQualifier, key);
|
|
482 |
// String stringValue = getString(nodePath, key);
|
| 481 |
483 |
//
|
| 482 |
484 |
// try {
|
| 483 |
485 |
// // double
|
| ... | ... | |
| 527 |
529 |
|
| 528 |
530 |
|
| 529 |
531 |
|
| 530 |
|
/**
|
| 531 |
|
* Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes.
|
| 532 |
|
* Returns the value of a key in the specified parameters if exists.
|
| 533 |
|
* Otherwise try to get it from the local result node if exists.
|
| 534 |
|
* Otherwise try to get it from the specified node qualifier if exists.
|
| 535 |
|
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 536 |
|
* Returns an empty <code>String</code> if no value has been found for the specified key.
|
| 537 |
|
* @param commandParameters
|
| 538 |
|
* @param nodeQualifier
|
| 539 |
|
* @param result
|
| 540 |
|
* @param key
|
| 541 |
|
* @return
|
| 542 |
|
*/
|
| 543 |
|
public static String getString(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
| 544 |
|
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 545 |
|
return (String) commandParameters.get(key);
|
| 546 |
|
}
|
| 547 |
|
return getString(key, result, nodeQualifier);
|
| 548 |
|
}
|
|
532 |
// /**
|
|
533 |
// * Looks for the value of the specified <code>key</code> in the specified parameters and preference nodes.
|
|
534 |
// * Returns the value of a key in the specified parameters if exists.
|
|
535 |
// * Otherwise try to get it from the local result node if exists.
|
|
536 |
// * Otherwise try to get it from the specified node qualifier if exists.
|
|
537 |
// * Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
|
538 |
// * Returns an empty <code>String</code> if no value has been found for the specified key.
|
|
539 |
// * @param commandParameters
|
|
540 |
// * @param nodePath
|
|
541 |
// * @param result
|
|
542 |
// * @param key
|
|
543 |
// * @return
|
|
544 |
// */
|
|
545 |
// public static String getString(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
|
546 |
// if(commandParameters != null && commandParameters.get(key) != null) {
|
|
547 |
// return (String) commandParameters.get(key);
|
|
548 |
// }
|
|
549 |
// return getString(key, result, nodePath);
|
|
550 |
// }
|
|
551 |
//
|
|
552 |
// public static String getString(String key, TXMParameters commandParameters, TXMResult result) {
|
|
553 |
// return getString(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
|
554 |
// }
|
| 549 |
555 |
|
| 550 |
|
public static String getString(String key, TXMParameters commandParameters, TXMResult result) {
|
| 551 |
|
return getString(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
| 552 |
|
}
|
| 553 |
556 |
|
| 554 |
|
|
| 555 |
557 |
/**
|
| 556 |
558 |
* Looks for the value of the specified <code>key</code> in preference nodes.
|
| 557 |
559 |
* Returns the value of the local result node if exists.
|
| 558 |
560 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 559 |
561 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 560 |
562 |
* Returns defaultValue if no value has been found for the specified key.
|
| 561 |
|
* @param nodeQualifier
|
|
563 |
* @param nodePath
|
| 562 |
564 |
* @param result
|
| 563 |
565 |
* @param key
|
| 564 |
566 |
* @return
|
| 565 |
567 |
*/
|
| 566 |
|
public static String getString(String key, TXMResult result, String nodeQualifier, String defaultValue) {
|
| 567 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
568 |
public static String getString(String key, TXMResult result, String nodePath, String defaultValue) {
|
| 568 |
569 |
|
| 569 |
|
defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).get(key, defaultValue);
|
| 570 |
|
return scope.getNode(nodeQualifier).get(key, defaultValue);
|
|
570 |
// if(result instanceof Project) {
|
|
571 |
// //TXMPreferences.dump();
|
|
572 |
// return preferencesService.getRootNode().node(result.getParametersNodePath()).get(key, defaultValue);
|
|
573 |
// }
|
|
574 |
|
|
575 |
|
|
576 |
// if(result != null && result.getProject() != null && result.getProject().getPreferencesScope().getNode(result.getUUID()) != null) {
|
|
577 |
// return result.getProject().getPreferencesScope().getNode(result.getUUID()).get(key, defaultValue);
|
|
578 |
// }
|
|
579 |
|
|
580 |
nodePath = findNodePath(nodePath, result, key);
|
|
581 |
|
|
582 |
//System.out.println("--- TXMPreferences.getString() node path = " + nodePath);
|
|
583 |
|
|
584 |
|
|
585 |
defaultValue = DefaultScope.INSTANCE.getNode(nodePath).get(key, defaultValue);
|
|
586 |
return preferencesRootNode.node(nodePath).get(key, defaultValue);
|
| 571 |
587 |
}
|
| 572 |
588 |
|
| 573 |
589 |
|
| ... | ... | |
| 577 |
593 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 578 |
594 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 579 |
595 |
* Returns an empty <code>String</code> if no value has been found for the specified key.
|
| 580 |
|
* @param nodeQualifier
|
|
596 |
* @param nodePath
|
| 581 |
597 |
* @param result
|
| 582 |
598 |
* @param key
|
| 583 |
599 |
* @return
|
| 584 |
600 |
*/
|
| 585 |
|
public static String getString(String key, TXMResult result, String nodeQualifier) {
|
| 586 |
|
return getString(key, result, nodeQualifier, "");
|
|
601 |
public static String getString(String key, TXMResult result, String nodePath) {
|
|
602 |
return getString(key, result, nodePath, ""); //$NON-NLS-1$
|
| 587 |
603 |
}
|
| 588 |
604 |
|
| 589 |
605 |
|
| 590 |
606 |
/**
|
| 591 |
607 |
*
|
| 592 |
|
* @param nodeQualifier
|
|
608 |
* @param nodePath
|
| 593 |
609 |
* @param key
|
| 594 |
610 |
* @return
|
| 595 |
611 |
*/
|
| 596 |
|
public static String getString(String key, String nodeQualifier) {
|
| 597 |
|
return getString(key, null, nodeQualifier);
|
|
612 |
public static String getString(String key, String nodePath) {
|
|
613 |
return getString(key, null, nodePath);
|
| 598 |
614 |
}
|
| 599 |
615 |
|
| 600 |
616 |
|
| ... | ... | |
| 619 |
635 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 620 |
636 |
* Returns 0 if no value has been found for the specified key.
|
| 621 |
637 |
* @param commandParameters
|
| 622 |
|
* @param nodeQualifier
|
|
638 |
* @param nodePath
|
| 623 |
639 |
* @param result
|
| 624 |
640 |
* @param key
|
| 625 |
641 |
* @return
|
| 626 |
642 |
*/
|
| 627 |
|
public static int getInt(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
643 |
public static int getInt(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 628 |
644 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 629 |
645 |
return (Integer) commandParameters.get(key);
|
| 630 |
646 |
}
|
| 631 |
|
return getInt(key, result, nodeQualifier);
|
|
647 |
return getInt(key, result, nodePath);
|
| 632 |
648 |
}
|
| 633 |
649 |
|
| 634 |
650 |
|
| 635 |
651 |
public static int getInt(String key, TXMParameters commandParameters, TXMResult result) {
|
| 636 |
|
return getInt(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
652 |
return getInt(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 637 |
653 |
}
|
| 638 |
654 |
|
| 639 |
655 |
/**
|
| ... | ... | |
| 642 |
658 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 643 |
659 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 644 |
660 |
* Returns defaultValue if no value has been found for the specified key.
|
| 645 |
|
* @param nodeQualifier
|
|
661 |
* @param nodePath
|
| 646 |
662 |
* @param result
|
| 647 |
663 |
* @param key
|
| 648 |
664 |
* @return
|
| 649 |
665 |
*/
|
| 650 |
|
public static int getInt(String key, TXMResult result, String nodeQualifier) {
|
| 651 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
666 |
public static int getInt(String key, TXMResult result, String nodePath) {
|
|
667 |
nodePath = findNodePath(nodePath, result, key);
|
| 652 |
668 |
|
| 653 |
|
Integer defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getInt(key, 0);
|
| 654 |
|
return scope.getNode(nodeQualifier).getInt(key, defaultValue);
|
|
669 |
int defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getInt(key, 0);
|
|
670 |
return preferencesRootNode.node(nodePath).getInt(key, defaultValue);
|
| 655 |
671 |
|
| 656 |
672 |
}
|
| 657 |
673 |
|
| 658 |
674 |
/**
|
| 659 |
675 |
*
|
| 660 |
|
* @param nodeQualifier
|
|
676 |
* @param nodePath
|
| 661 |
677 |
* @param key
|
| 662 |
678 |
* @return
|
| 663 |
679 |
*/
|
| 664 |
|
public static int getInt(String key, String nodeQualifier) {
|
| 665 |
|
return getInt(key, null, nodeQualifier);
|
|
680 |
public static int getInt(String key, String nodePath) {
|
|
681 |
return getInt(key, null, nodePath);
|
| 666 |
682 |
}
|
| 667 |
683 |
|
| 668 |
684 |
/**
|
| ... | ... | |
| 684 |
700 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 685 |
701 |
* Returns 0L if no value has been found for the specified key.
|
| 686 |
702 |
* @param commandParameters
|
| 687 |
|
* @param nodeQualifier
|
|
703 |
* @param nodePath
|
| 688 |
704 |
* @param result
|
| 689 |
705 |
* @param key
|
| 690 |
706 |
* @return
|
| 691 |
707 |
*/
|
| 692 |
|
public static long getLong(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
708 |
public static long getLong(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 693 |
709 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 694 |
710 |
return (Long) commandParameters.get(key);
|
| 695 |
711 |
}
|
| 696 |
|
return getLong(key, result, nodeQualifier);
|
|
712 |
return getLong(key, result, nodePath);
|
| 697 |
713 |
}
|
| 698 |
714 |
|
| 699 |
715 |
public static long getLong(String key, TXMParameters commandParameters, TXMResult result) {
|
| 700 |
|
return getLong(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
716 |
return getLong(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 701 |
717 |
}
|
| 702 |
718 |
|
| 703 |
719 |
|
| ... | ... | |
| 708 |
724 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 709 |
725 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 710 |
726 |
* Returns defaultValue if no value has been found for the specified key.
|
| 711 |
|
* @param nodeQualifier
|
|
727 |
* @param nodePath
|
| 712 |
728 |
* @param result
|
| 713 |
729 |
* @param key
|
| 714 |
730 |
* @param defaultValue
|
| 715 |
731 |
* @return
|
| 716 |
732 |
*/
|
| 717 |
|
public static long getLong(String key, TXMResult result, String nodeQualifier, long defaultValue) {
|
| 718 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
733 |
public static long getLong(String key, TXMResult result, String nodePath, long defaultValue) {
|
|
734 |
nodePath = findNodePath(nodePath, result, key);
|
| 719 |
735 |
|
| 720 |
|
defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getLong(key, defaultValue);
|
| 721 |
|
return scope.getNode(nodeQualifier).getLong(key, defaultValue);
|
|
736 |
defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getLong(key, defaultValue);
|
|
737 |
return preferencesRootNode.node(nodePath).getLong(key, defaultValue);
|
| 722 |
738 |
|
| 723 |
739 |
}
|
| 724 |
740 |
|
| ... | ... | |
| 728 |
744 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 729 |
745 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 730 |
746 |
* Returns 0L if no value has been found for the specified key.
|
| 731 |
|
* @param nodeQualifier
|
|
747 |
* @param nodePath
|
| 732 |
748 |
* @param result
|
| 733 |
749 |
* @param key
|
| 734 |
750 |
* @param defaultValue
|
| 735 |
751 |
* @return
|
| 736 |
752 |
*/
|
| 737 |
|
public static long getLong(String key, TXMResult result, String nodeQualifier) {
|
| 738 |
|
return getLong(key, result, nodeQualifier, 0L);
|
|
753 |
public static long getLong(String key, TXMResult result, String nodePath) {
|
|
754 |
return getLong(key, result, nodePath, 0L);
|
| 739 |
755 |
}
|
| 740 |
756 |
|
| 741 |
757 |
/**
|
| 742 |
758 |
*
|
| 743 |
|
* @param nodeQualifier
|
|
759 |
* @param nodePath
|
| 744 |
760 |
* @param key
|
| 745 |
761 |
* @return
|
| 746 |
762 |
*/
|
| 747 |
|
public static long getLong(String key, String nodeQualifier) {
|
| 748 |
|
return getLong(key, null, nodeQualifier);
|
|
763 |
public static long getLong(String key, String nodePath) {
|
|
764 |
return getLong(key, null, nodePath);
|
| 749 |
765 |
}
|
| 750 |
766 |
|
| 751 |
767 |
/**
|
| ... | ... | |
| 767 |
783 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 768 |
784 |
* Returns 0.0d if no value has been found for the specified key.
|
| 769 |
785 |
* @param commandParameters
|
| 770 |
|
* @param nodeQualifier
|
|
786 |
* @param nodePath
|
| 771 |
787 |
* @param result
|
| 772 |
788 |
* @param key
|
| 773 |
789 |
* @return
|
| 774 |
790 |
*/
|
| 775 |
|
public static double getDouble(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
791 |
public static double getDouble(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 776 |
792 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 777 |
793 |
return (Double) commandParameters.get(key);
|
| 778 |
794 |
}
|
| 779 |
|
return getDouble(key, result, nodeQualifier);
|
|
795 |
return getDouble(key, result, nodePath);
|
| 780 |
796 |
}
|
| 781 |
797 |
|
| 782 |
798 |
public static double getDouble(String key, TXMParameters commandParameters, TXMResult result) {
|
| 783 |
|
return getDouble(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
799 |
return getDouble(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 784 |
800 |
}
|
| 785 |
801 |
|
| 786 |
802 |
|
| ... | ... | |
| 790 |
806 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 791 |
807 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 792 |
808 |
* Returns defaultValue if no value has been found for the specified key.
|
| 793 |
|
* @param nodeQualifier
|
|
809 |
* @param nodePath
|
| 794 |
810 |
* @param result
|
| 795 |
811 |
* @param key
|
| 796 |
812 |
* @return
|
| 797 |
813 |
*/
|
| 798 |
|
public static double getDouble(String key, String nodeQualifier, TXMResult result, double defaultValue) {
|
| 799 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
814 |
public static double getDouble(String key, String nodePath, TXMResult result, double defaultValue) {
|
|
815 |
nodePath = findNodePath(nodePath, result, key);
|
| 800 |
816 |
|
| 801 |
|
defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getDouble(key, defaultValue);
|
| 802 |
|
return scope.getNode(nodeQualifier).getDouble(key, defaultValue);
|
|
817 |
defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getDouble(key, defaultValue);
|
|
818 |
return preferencesRootNode.node(nodePath).getDouble(key, defaultValue);
|
| 803 |
819 |
}
|
| 804 |
820 |
|
| 805 |
821 |
/**
|
| ... | ... | |
| 808 |
824 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 809 |
825 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 810 |
826 |
* Returns 0.0d if no value has been found for the specified key.
|
| 811 |
|
* @param nodeQualifier
|
|
827 |
* @param nodePath
|
| 812 |
828 |
* @param result
|
| 813 |
829 |
* @param key
|
| 814 |
830 |
* @return
|
| 815 |
831 |
*/
|
| 816 |
|
public static double getDouble(String key, TXMResult result, String nodeQualifier) {
|
| 817 |
|
return getDouble(key, nodeQualifier, result, 0.0d);
|
|
832 |
public static double getDouble(String key, TXMResult result, String nodePath) {
|
|
833 |
return getDouble(key, nodePath, result, 0.0d);
|
| 818 |
834 |
}
|
| 819 |
835 |
|
| 820 |
836 |
|
| 821 |
837 |
/**
|
| 822 |
838 |
*
|
| 823 |
|
* @param nodeQualifier
|
|
839 |
* @param nodePath
|
| 824 |
840 |
* @param key
|
| 825 |
841 |
* @return
|
| 826 |
842 |
*/
|
| 827 |
|
public static double getDouble(String key, String nodeQualifier) {
|
| 828 |
|
return getDouble(key, null, nodeQualifier);
|
|
843 |
public static double getDouble(String key, String nodePath) {
|
|
844 |
return getDouble(key, null, nodePath);
|
| 829 |
845 |
}
|
| 830 |
846 |
|
| 831 |
847 |
|
| ... | ... | |
| 850 |
866 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 851 |
867 |
* Returns 0f if no value has been found for the specified key.
|
| 852 |
868 |
* @param commandParameters
|
| 853 |
|
* @param nodeQualifier
|
|
869 |
* @param nodePath
|
| 854 |
870 |
* @param result
|
| 855 |
871 |
* @param key
|
| 856 |
872 |
* @return
|
| 857 |
873 |
*/
|
| 858 |
|
public static float getFloat(String key, TXMParameters commandParameters, TXMResult result, String nodeQualifier) {
|
|
874 |
public static float getFloat(String key, TXMParameters commandParameters, TXMResult result, String nodePath) {
|
| 859 |
875 |
if(commandParameters != null && commandParameters.get(key) != null) {
|
| 860 |
876 |
return (Float) commandParameters.get(key);
|
| 861 |
877 |
}
|
| 862 |
|
return getFloat(key, result, nodeQualifier);
|
|
878 |
return getFloat(key, result, nodePath);
|
| 863 |
879 |
}
|
| 864 |
880 |
|
| 865 |
881 |
public static float getFloat(String key, TXMParameters commandParameters, TXMResult result) {
|
| 866 |
|
return getFloat(key, commandParameters, result, result.getPreferencesNodeQualifier());
|
|
882 |
return getFloat(key, commandParameters, result, result.getCommandPreferencesNodePath());
|
| 867 |
883 |
}
|
| 868 |
884 |
|
| 869 |
885 |
/**
|
| ... | ... | |
| 872 |
888 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 873 |
889 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 874 |
890 |
* Returns defaultValue if no value has been found for the specified key.
|
| 875 |
|
* @param nodeQualifier
|
|
891 |
* @param nodePath
|
| 876 |
892 |
* @param result
|
| 877 |
893 |
* @param key
|
| 878 |
894 |
* @return
|
| 879 |
895 |
*/
|
| 880 |
|
public static float getFloat(String key, String nodeQualifier, TXMResult result, float defaultValue) {
|
| 881 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
896 |
public static float getFloat(String key, String nodePath, TXMResult result, float defaultValue) {
|
|
897 |
nodePath = findNodePath(nodePath, result, key);
|
| 882 |
898 |
|
| 883 |
|
defaultValue = DefaultScope.INSTANCE.getNode(nodeQualifier).getFloat(key, defaultValue);
|
| 884 |
|
return scope.getNode(nodeQualifier).getFloat(key, defaultValue);
|
|
899 |
defaultValue = DefaultScope.INSTANCE.getNode(nodePath).getFloat(key, defaultValue);
|
|
900 |
return preferencesRootNode.node(nodePath).getFloat(key, defaultValue);
|
| 885 |
901 |
}
|
| 886 |
902 |
|
| 887 |
903 |
|
| ... | ... | |
| 902 |
918 |
return null;
|
| 903 |
919 |
}
|
| 904 |
920 |
|
| 905 |
|
public static Serializable getSerializable(String key, String nodeQualifier, TXMResult result, Serializable defaultValue) {
|
|
921 |
public static Serializable getSerializable(String key, String nodePath, TXMResult result, Serializable defaultValue) {
|
| 906 |
922 |
|
| 907 |
923 |
try {
|
| 908 |
924 |
byte[] defaultBytes = toByteArray(defaultValue);
|
| 909 |
925 |
|
| 910 |
|
nodeQualifier = findNodeQualifier(nodeQualifier, result, key);
|
|
926 |
nodePath = findNodePath(nodePath, result, key);
|
| 911 |
927 |
|
| 912 |
|
defaultBytes = DefaultScope.INSTANCE.getNode(nodeQualifier).getByteArray(key, defaultBytes);
|
| 913 |
|
byte[] bytes = scope.getNode(nodeQualifier).getByteArray(key, defaultBytes);
|
|
928 |
defaultBytes = DefaultScope.INSTANCE.getNode(nodePath).getByteArray(key, defaultBytes);
|
|
929 |
byte[] bytes = preferencesRootNode.node(nodePath).getByteArray(key, defaultBytes);
|
| 914 |
930 |
|
| 915 |
931 |
return toSerializable(bytes);
|
| 916 |
932 |
} catch (Exception e) {
|
| ... | ... | |
| 927 |
943 |
* Otherwise try to get it from the specified node qualifier if exists.
|
| 928 |
944 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>.
|
| 929 |
945 |
* Returns 0f if no value has been found for the specified key.
|
| 930 |
|
* @param nodeQualifier
|
|
946 |
* @param nodePath
|
| 931 |
947 |
* @param result
|
| 932 |
948 |
* @param key
|
| 933 |
949 |
* @return
|
| 934 |
950 |
*/
|
| 935 |
|
public static float getFloat(String key, TXMResult result, String nodeQualifier) {
|
| 936 |
|
return getFloat(key, nodeQualifier, result, 0f);
|
|
951 |
public static float getFloat(String key, TXMResult result, String nodePath) {
|
|
952 |
return getFloat(key, nodePath, result, 0f);
|
| 937 |
953 |
}
|
| 938 |
954 |
|
| 939 |
955 |
|
| 940 |
956 |
/**
|
| 941 |
957 |
*
|
| 942 |
|
* @param nodeQualifier
|
|
958 |
* @param nodePath
|
| 943 |
959 |
* @param key
|
| 944 |
960 |
* @return
|
| 945 |
961 |
*/
|
| 946 |
|
public static float getFloat(String key, String nodeQualifier) {
|
| 947 |
|
return getFloat(key, null, nodeQualifier);
|
|
962 |
public static float getFloat(String key, String nodePath) {
|
|
963 |
return getFloat(key, null, nodePath);
|
| 948 |
964 |
}
|
| 949 |
965 |
|
| 950 |
966 |
/**
|
| ... | ... | |
| 964 |
980 |
* @return <code>true</code> if the node exists, otherwise <code>false</code>
|
| 965 |
981 |
*/
|
| 966 |
982 |
public static boolean resultScopeNodeExists(TXMResult result) {
|
| 967 |
|
if(result == null) {
|
| 968 |
|
return false;
|
| 969 |
|
}
|
| 970 |
|
return scope.getNode(result.getUUID()) != null;
|
|
983 |
return preferencesRootNode.node(result.getParametersNodePath()) != null;
|
| 971 |
984 |
}
|
| 972 |
985 |
|
| 973 |
986 |
/**
|
| 974 |
|
* Checks if a key exists in the local node for the specified TXM result.
|
| 975 |
|
* @param result
|
|
987 |
*
|
|
988 |
* @param scope
|
|
989 |
* @param nodePath
|
| 976 |
990 |
* @param key
|
| 977 |
|
* @return <code>true</code> if the node and the key exist, otherwise <code>false</code>
|
|
991 |
* @return
|
| 978 |
992 |
*/
|
| 979 |
|
public static boolean resultScopeKeyExists(TXMResult result, String key) {
|
| 980 |
|
return keyExists(result.getUUID(), key);
|
| 981 |
|
}
|
| 982 |
|
|
| 983 |
|
/**
|
| 984 |
|
* Checks if a key exists in a node.
|
| 985 |
|
* @param nodeQualifier
|
| 986 |
|
* @param key
|
| 987 |
|
* @return <code>true</code> if the node and the key exist, otherwise <code>false</code>
|
| 988 |
|
*/
|
| 989 |
|
public static boolean keyExists(String nodeQualifier, String key) {
|
| 990 |
|
if(scope.getNode(nodeQualifier) != null) {
|
|
993 |
public static boolean keyExists(String nodePath, String key) {
|
|
994 |
|
|
995 |
if(preferencesRootNode.node(nodePath) != null) {
|
| 991 |
996 |
try {
|
| 992 |
|
return Arrays.asList(scope.getNode(nodeQualifier).keys()).contains(key);
|
|
997 |
return Arrays.asList(preferencesRootNode.node(nodePath).keys()).contains(key);
|
| 993 |
998 |
}
|
| 994 |
999 |
catch(BackingStoreException e) {
|
| 995 |
1000 |
e.printStackTrace();
|
| ... | ... | |
| 998 |
1003 |
return false;
|
| 999 |
1004 |
}
|
| 1000 |
1005 |
|
| 1001 |
|
|
| 1002 |
1006 |
/**
|
| 1003 |
1007 |
* Checks if a preference is defined as empty.
|
| 1004 |
1008 |
* Can be used to determine whatever a functionality is available or not by overriding the preference as empty.
|
| 1005 |
1009 |
* Essentially used for UI purpose, eg. to hide or disable a button that modify a preference.
|
| 1006 |
|
* @param nodeQualifier
|
|
1010 |
* @param nodePath
|
| 1007 |
1011 |
* @param key
|
| 1008 |
1012 |
* @return
|
| 1009 |
1013 |
*/
|
| 1010 |
|
public static boolean isEmpty(String nodeQualifier, String key) {
|
| 1011 |
|
return getString(key, nodeQualifier).equals("");
|
|
1014 |
public static boolean isEmpty(String nodePath, String key) {
|
|
1015 |
return getString(key, nodePath).equals("");
|
| 1012 |
1016 |
}
|
| 1013 |
1017 |
|
| 1014 |
1018 |
|
| ... | ... | |
| 1016 |
1020 |
* Sets a preference as empty.
|
| 1017 |
1021 |
* Can be used to determine whatever a functionality is available or not by overriding the preference as empty.
|
| 1018 |
1022 |
* Essentially used for UI purpose, eg. to hide or disable a button that modify a preference.
|
| 1019 |
|
* @param nodeQualifier
|
|
1023 |
* @param nodePath
|
| 1020 |
1024 |
* @param key
|
| 1021 |
1025 |
*/
|
| 1022 |
|
public static void setEmpty(String nodeQualifier, String key) {
|
| 1023 |
|
scope.getNode(nodeQualifier).put(key, "");
|
|
1026 |
public static void setEmpty(String nodePath, String key) {
|
|
1027 |
preferencesRootNode.node(nodePath).put(key, "");
|
| 1024 |
1028 |
}
|
| 1025 |
1029 |
|
| 1026 |
1030 |
/**
|
| ... | ... | |
| 1028 |
1032 |
* @return
|
| 1029 |
1033 |
*/
|
| 1030 |
1034 |
public IEclipsePreferences getDefaultPreferencesNode() {
|
| 1031 |
|
return DefaultScope.INSTANCE.getNode(this.preferencesNode);
|
|
1035 |
return DefaultScope.INSTANCE.getNode(this.commandPreferencesNodeQualifier);
|
| 1032 |
1036 |
}
|
| 1033 |
1037 |
|
| 1034 |
1038 |
/**
|
| 1035 |
1039 |
* print TxmPreferences in the console.
|
| 1036 |
1040 |
*/
|
| 1037 |
|
public static String dumpToString(String nodeQualifier) {
|
|
1041 |
public static String dumpToString(String nodePath) {
|
| 1038 |
1042 |
StringBuilder sb = new StringBuilder();
|
| 1039 |
|
IEclipsePreferences preferences = scope.getNode(nodeQualifier);
|
|
1043 |
Preferences preferences = preferencesRootNode.node(nodePath);
|
| 1040 |
1044 |
|
| 1041 |
1045 |
try {
|
| 1042 |
1046 |
String[] keys = preferences.keys();
|
| ... | ... | |
| 1056 |
1060 |
*/
|
| 1057 |
1061 |
public static void dump() {
|
| 1058 |
1062 |
try {
|
| 1059 |
|
IPreferencesService service = Platform.getPreferencesService();
|
| 1060 |
1063 |
System.out.println("root:"); //$NON-NLS-1$
|
| 1061 |
|
for (String children : service.getRootNode().childrenNames()) {
|
|
1064 |
for (String children : preferencesRootNode.childrenNames()) {
|
| 1062 |
1065 |
System.out.println("********************************************************************************************************"); //$NON-NLS-1$
|
| 1063 |
1066 |
System.out.println(" scope: " + children); //$NON-NLS-1$
|
| 1064 |
|
String[] subchildren = service.getRootNode().node(children).childrenNames();
|
|
1067 |
String[] subchildren = preferencesRootNode.node(children).childrenNames();
|
| 1065 |
1068 |
Arrays.sort(subchildren);
|
| 1066 |
1069 |
for (String children2 : subchildren) {
|
| 1067 |
|
System.out.println(" node: "+ children2); //$NON-NLS-1$
|
| 1068 |
|
String[] keys = service.getRootNode().node(children).node(children2).keys();
|
|
1070 |
System.out.println(" scope: " + children + " node: "+ children2); //$NON-NLS-1$
|
|
1071 |
String[] keys = preferencesRootNode.node(children).node(children2).keys();
|
| 1069 |
1072 |
Arrays.sort(keys);
|
| 1070 |
1073 |
for (String key2 : keys) {
|
| 1071 |
|
System.out.println(" " + key2 + " = " + service.getRootNode().node(children).node(children2).get(key2, null)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
1074 |
System.out.println(" " + key2 + " = " + preferencesRootNode.node(children).node(children2).get(key2, null)); //$NON-NLS-1$ //$NON-NLS-2$
|
| 1072 |
1075 |
}
|
| 1073 |
1076 |
}
|
| 1074 |
1077 |
}
|
| ... | ... | |
| 1079 |
1082 |
|
| 1080 |
1083 |
/**
|
| 1081 |
1084 |
* Dumps the keys and values of the specified node of the specified scope.
|
| 1082 |
|
* @param nodeQualifier
|
|
1085 |
* @param nodePath
|
| 1083 |
1086 |
*/
|
| 1084 |
|
public static void dump(IScopeContext scope, String nodeQualifier) {
|
| 1085 |
|
IEclipsePreferences preferences = scope.getNode(nodeQualifier);
|
|
1087 |
public static void dump(IScopeContext scope, String nodePath) {
|
|
1088 |
IEclipsePreferences preferences = scope.getNode(nodePath);
|
| 1086 |
1089 |
System.out.println("TXMPreferences.dump(): ***************************************************************");
|
| 1087 |
|
System.out.println("TXMPreferences.dump(): node qualifier = " + nodeQualifier);
|
|
1090 |
System.out.println("TXMPreferences.dump(): node qualifier = " + nodePath);
|
| 1088 |
1091 |
System.out.println("TXMPreferences.dump():" + preferences.absolutePath());
|
| 1089 |
1092 |
try {
|
| 1090 |
1093 |
String[] keys = preferences.keys();
|
| ... | ... | |
| 1101 |
1104 |
|
| 1102 |
1105 |
/**
|
| 1103 |
1106 |
* Dumps the keys and values of the specified node of the instance and default scopes.
|
| 1104 |
|
* @param nodeQualifier
|
|
1107 |
* @param nodePath
|
| 1105 |
1108 |
*/
|
| 1106 |
|
public static void dump(String nodeQualifier) {
|
| 1107 |
|
dump(DefaultScope.INSTANCE, nodeQualifier);
|
| 1108 |
|
dump(scope, nodeQualifier);
|
|
1109 |
public static void dump(String nodePath) {
|
|
1110 |
dump(DefaultScope.INSTANCE, nodePath);
|
|
1111 |
dump(InstanceScope.INSTANCE, nodePath);
|
| 1109 |
1112 |
}
|
| 1110 |
1113 |
|
| 1111 |
1114 |
|
| 1112 |
1115 |
/**
|
| 1113 |
1116 |
*
|
| 1114 |
|
* @param nodeQualifier
|
|
1117 |
* @param nodePath
|
| 1115 |
1118 |
* @throws BackingStoreException
|
| 1116 |
1119 |
*/
|
| 1117 |
|
public static String[] getKeys(IScopeContext scope, String nodeQualifier) throws BackingStoreException {
|
| 1118 |
|
IEclipsePreferences preferences = scope.getNode(nodeQualifier);
|
|
1120 |
public static String[] getKeys(IScopeContext scope, String nodePath) throws BackingStoreException {
|
|
1121 |
IEclipsePreferences preferences = scope.getNode(nodePath);
|
| 1119 |
1122 |
return preferences.keys();
|
| 1120 |
1123 |
}
|
| 1121 |
1124 |
|
| 1122 |
|
public static String[] getCommandScopeKeys(String nodeQualifier) throws BackingStoreException {
|
| 1123 |
|
return getKeys(scope, nodeQualifier);
|
|
1125 |
public static String[] getCommandScopeKeys(String nodePath) throws BackingStoreException {
|
|
1126 |
return getKeys(InstanceScope.INSTANCE, nodePath);
|
| 1124 |
1127 |
}
|
| 1125 |
1128 |
|
| 1126 |
|
public static String[] getDefaultScopeKeys(String nodeQualifier) throws BackingStoreException {
|
| 1127 |
|
return getKeys(DefaultScope.INSTANCE, nodeQualifier);
|
|
1129 |
public static String[] getDefaultScopeKeys(String nodePath) throws BackingStoreException {
|
|
1130 |
return getKeys(DefaultScope.INSTANCE, nodePath);
|
| 1128 |
1131 |
}
|
| 1129 |
1132 |
|
| 1130 |
|
public static HashMap<String, Object> getKeysAndValuesAsMap(IScopeContext scope, String nodeQualifier) {
|
|
1133 |
public static HashMap<String, Object> getKeysAndValuesAsMap(IScopeContext scope, String nodePath) {
|
| 1131 |
1134 |
|
| 1132 |
1135 |
HashMap<String, Object> str = new HashMap<String, Object>();
|
| 1133 |
1136 |
|
| 1134 |
|
IEclipsePreferences preferences = scope.getNode(nodeQualifier);
|
|
1137 |
IEclipsePreferences preferences = scope.getNode(nodePath);
|
| 1135 |
1138 |
|
| 1136 |
1139 |
try {
|
| 1137 |
1140 |
String[] keys = preferences.keys();
|
| ... | ... | |
| 1148 |
1151 |
return str;
|
| 1149 |
1152 |
}
|
| 1150 |
1153 |
|
| 1151 |
|
public static String getKeysAndValues(IScopeContext scope, String nodeQualifier) {
|
|
1154 |
public static String getKeysAndValues(String nodePath) {
|
| 1152 |
1155 |
|
| 1153 |
1156 |
StringBuilder str = new StringBuilder();
|
| 1154 |
1157 |
|
| 1155 |
|
IEclipsePreferences preferences = scope.getNode(nodeQualifier);
|
|
1158 |
Preferences preferences = preferencesRootNode.node(nodePath);
|
| 1156 |
1159 |
|
| 1157 |
1160 |
str.append("Path = " + preferences.absolutePath() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
| 1158 |
1161 |
str.append("Name = " + preferences.name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
| ... | ... | |
| 1177 |
1180 |
|
| 1178 |
1181 |
/**
|
| 1179 |
1182 |
* Dumps the keys and values of the specified node, of the specified result node and also of the alternative nodes.
|
| 1180 |
|
* @param nodeQualifier
|
|
1183 |
* @param nodePath
|
| 1181 |
1184 |
* @param result
|
| 1182 |
1185 |
*/
|
| 1183 |
|
public static void dump(String nodeQualifier, TXMResult result) {
|
|
1186 |
public static void dump(String nodePath, TXMResult result) {
|
| 1184 |
1187 |
|
| 1185 |
1188 |
// result scope node
|
| 1186 |
1189 |
if(result != null) {
|
| 1187 |
1190 |
if(resultScopeNodeExists(result)) {
|
| 1188 |
|
Log.finest("TXMPreferences.dump(): Result scope preferences for node " + result.getUUID() + ":");
|
| 1189 |
|
dump(result.getUUID());
|
|
1191 |
Log.finest("TXMPreferences.dump(): Result scope preferences for node " + result.getParametersNodePath() + ":");
|
|
1192 |
dump(result.getParametersNodePath());
|
| 1190 |
1193 |
}
|
| 1191 |
1194 |
else {
|
| 1192 |
|
Log.severe("TXMPreferences.dump(): No result scope preferences was found for node" + result.getUUID() + ".");
|
|
1195 |
Log.severe("TXMPreferences.dump(): No result scope preferences was found for node" + result.getParametersNodePath() + ".");
|
| 1193 |
1196 |
}
|
| 1194 |
1197 |
}
|
| 1195 |
1198 |
// command scope node
|
| 1196 |
|
if(nodeQualifier != null) {
|
| 1197 |
|
Log.finest("TXMPreferences.dump(): Command scope preferences for node " + nodeQualifier + ":");
|
| 1198 |
|
dump(nodeQualifier);
|
|
1199 |
if(nodePath != null) {
|
|
1200 |
Log.finest("TXMPreferences.dump(): Command scope preferences for node " + nodePath + ":");
|
|
1201 |
dump(nodePath);
|
| 1199 |
1202 |
}
|
| 1200 |
1203 |
else {
|
| 1201 |
1204 |
Log.finest("TXMPreferences.dump(): No Command scope was asked to dump.");
|
| ... | ... | |
| 1215 |
1218 |
*/
|
| 1216 |
1219 |
public static void flush(TXMResult result) {
|
| 1217 |
1220 |
Log.finest("TXMPreferences.flush(): Local preferences for object " + result.getUUID() + " saved to file.");
|
| 1218 |
|
flush(result.getUUID());
|
|
1221 |
flush(result.getParametersNodePath());
|
| 1219 |
1222 |
}
|
| 1220 |
1223 |
|
| 1221 |
1224 |
/**
|
| 1222 |
1225 |
* Saves the local preferences to file.
|
| 1223 |
1226 |
* @param result
|
| 1224 |
1227 |
*/
|
| 1225 |
|
public static void flush(String qualifier) {
|
|
1228 |
public static void flush(String nodePath) {
|
| 1226 |
1229 |
try {
|
| 1227 |
|
scope.getNode(qualifier).flush();
|
|
1230 |
preferencesRootNode.node(nodePath).flush();
|
| 1228 |
1231 |
}
|
| 1229 |
1232 |
catch(BackingStoreException e) {
|
| 1230 |
1233 |
e.printStackTrace();
|
| 1231 |
1234 |
}
|
| 1232 |
1235 |
}
|
| 1233 |
1236 |
|
|
1237 |
public void flush() {
|
|
1238 |
TXMPreferences.flush(this.commandPreferencesNodeQualifier);
|
|
1239 |
}
|
|
1240 |
|
|
1241 |
|
| 1234 |
1242 |
/**
|
| 1235 |
1243 |
* Deletes the local node if exists and the associated .prefs persistence file.
|
| 1236 |
1244 |
* @param result
|
| 1237 |
1245 |
*/
|
| 1238 |
1246 |
public static void delete(TXMResult result) {
|
| 1239 |
|
delete(scope.getNode(result.getUUID()));
|
|
1247 |
delete(preferencesRootNode.node(result.getParametersNodePath()));
|
| 1240 |
1248 |
Log.finest("TXMPreferences.delete(): Local preferences node for object " + result.getUUID() + " deleted.");
|
| 1241 |
1249 |
}
|
| 1242 |
1250 |
|
| ... | ... | |
| 1245 |
1253 |
* Deletes the specified node if exists and the associated .prefs file.
|
| 1246 |
1254 |
* @param node
|
| 1247 |
1255 |
*/
|
| 1248 |
|
public static void delete(IEclipsePreferences node) {
|
|
1256 |
public static void delete(Preferences node) {
|
| 1249 |
1257 |
try {
|
| 1250 |
1258 |
node.clear();
|
| 1251 |
1259 |
node.flush();
|
| ... | ... | |
| 1258 |
1266 |
}
|
| 1259 |
1267 |
|
| 1260 |
1268 |
|
|
1269 |
|
|
1270 |
|
| 1261 |
1271 |
/**
|
| 1262 |
|
* Deletes all the result nodes from the preferences and files that are not set as persistable.
|
|
1272 |
* Gets all the result nodes qualifiers (from scope or *.prefs files starting with TXMResult.UUID_PREFIX, eg.: "txm_res_").
|
|
1273 |
* @return
|
| 1263 |
1274 |
*/
|
| 1264 |
|
public static void deleteAllNotPersistableResultsNodes() {
|
| 1265 |
|
ArrayList<String> resultsNodesQualifier = getAllResultsNodesQualifiers();
|
| 1266 |
|
for (int i = 0; i < resultsNodesQualifier.size(); i++) {
|
| 1267 |
|
TXMResult result = TXMResult.getResult(resultsNodesQualifier.get(i));
|
| 1268 |
|
if(result != null && !result.isPersistable()) {
|
| 1269 |
|
delete(scope.getNode(resultsNodesQualifier.get(i)));
|
|
1275 |
// FIXME: old method, from Instance scope
|
|
1276 |
// public static ArrayList<String> getAllResultsNodesQualifiers() {
|
|
1277 |
// ArrayList<String> resultsNodesQualifiers = new ArrayList<String>();
|
|
1278 |
// try {
|
|
1279 |
// IPreferencesService service = Platform.getPreferencesService();
|
|
1280 |
// for (String scopeName : service.getRootNode().childrenNames()) {
|
|
1281 |
// if(scopeName != TXMPreferences.scope.getName()) {
|
|
1282 |
// continue;
|
|
1283 |
// }
|
|
1284 |
//
|
|
1285 |
// String[] nodesNames = service.getRootNode().node(scopeName).childrenNames();
|
|
1286 |
// Arrays.sort(nodesNames);
|
|
1287 |
// for (String nodeName : nodesNames) {
|
|
1288 |
// if(nodeName.startsWith(TXMResult.UUID_PREFIX)) {
|
|
1289 |
// resultsNodesQualifiers.add(nodeName);
|
|
1290 |
// }
|
|
1291 |
// }
|
|
1292 |
// }
|
|
1293 |
// } catch (Exception e) {
|
|
1294 |
// e.printStackTrace();
|
|
1295 |
// }
|
|
1296 |
// Collections.sort(resultsNodesQualifiers);
|
|
1297 |
// return resultsNodesQualifiers;
|
|
1298 |
// }
|
|
1299 |
|
|
1300 |
/**
|
|
1301 |
* Gets all the result nodes qualifiers from the specified node path (from the scope or *.prefs files starting with TXMResult.UUID_PREFIX, eg.: "txm_res_").
|
|
1302 |
* @return
|
|
1303 |
*/
|
|
1304 |
// FIXME: try to use the scope directly and not pass through the reference service
|
|
1305 |
public static ArrayList<String> getAllResultsNodePaths(String rootPath) {
|
|
1306 |
// ArrayList<String> resultsNodesQualifiers = new ArrayList<String>();
|
|
1307 |
// try {
|
|
1308 |
// IPreferencesService service = Platform.getPreferencesService();
|
|
1309 |
// for (String scopeName : service.getRootNode().childrenNames()) {
|
|
1310 |
// System.out.println("TXMPreferences.getAllResultsNodesQualifiers(): scope = " + scopeName);
|
|
1311 |
// if(!scopeName.equals(scope.getName())) {
|
|
1312 |
// System.out.println("TXMPreferences.getAllResultsNodesQualifiersProjects(): skipping scope.");
|
|
1313 |
// continue;
|
|
1314 |
// }
|
|
1315 |
//
|
|
1316 |
// String[] nodesNames = service.getRootNode().node(scopeName).node(nodePath).childrenNames();
|
|
1317 |
//
|
|
1318 |
// System.out.println("TXMPreferences.getAllResultsNodesQualifiers(): nodes found = " + nodesNames.length);
|
|
1319 |
//
|
|
1320 |
//
|
|
1321 |
// Arrays.sort(nodesNames);
|
|
1322 |
// for (String nodeName : nodesNames) {
|
|
1323 |
// System.out.println("TXMPreferences.getAllResultsNodesQualifiers(): node name = " + nodeName);
|
|
1324 |
//
|
|
1325 |
// if(nodeName.startsWith(TXMResult.UUID_PREFIX)) {
|
|
1326 |
// resultsNodesQualifiers.add(nodeName);
|
|
1327 |
// }
|
|
1328 |
// }
|
|
1329 |
// }
|
|
1330 |
// } catch (Exception e) {
|
|
1331 |
// e.printStackTrace();
|
|
1332 |
// }
|
|
1333 |
// Collections.sort(resultsNodesQualifiers);
|
|
1334 |
// return resultsNodesQualifiers;
|
|
1335 |
|
|
1336 |
|
|
1337 |
Log.finest("TXMPreferences.getAllResultsNodePaths(): looking for nodes in path \"" + preferencesRootNode.node(rootPath) + "\".");
|
|
1338 |
|
|
1339 |
ArrayList<String> nodePaths = new ArrayList<String>();
|
|
1340 |
|
|
1341 |
try {
|
|
1342 |
String[] nodesNames = preferencesRootNode.node(rootPath).childrenNames();
|
|
1343 |
|
|
1344 |
Log.finest("TXMPreferences.getAllResultsNodePaths(): " + nodesNames.length + " node(s) found.");
|
|
1345 |
|
|
1346 |
Arrays.sort(nodesNames);
|
|
1347 |
for (String nodeName : nodesNames) {
|
|
1348 |
Log.finest("TXMPreferences.getAllResultsNodePaths(): node name = " + nodeName);
|
|
1349 |
|
|
1350 |
if(nodeName.startsWith(TXMResult.UUID_PREFIX)) {
|
|
1351 |
Log.finest("TXMPreferences.getAllResultsNodePaths(): node path = " + rootPath + nodeName);
|
|
1352 |
nodePaths.add(rootPath + nodeName);
|
|
1353 |
}
|
| 1270 |
1354 |
}
|
|
1355 |
|
|
1356 |
Collections.sort(nodePaths);
|
| 1271 |
1357 |
}
|
|
1358 |
catch (BackingStoreException e) {
|
|
1359 |
e.printStackTrace();
|
|
1360 |
}
|
|
1361 |
return nodePaths;
|
|
1362 |
|
| 1272 |
1363 |
}
|
| 1273 |
1364 |
|
| 1274 |
1365 |
|
|
1366 |
|
| 1275 |
1367 |
/**
|
| 1276 |
|
* Deletes all the result nodes from the preferences and files.
|
|
1368 |
* Deletes all the result nodes from the preferences and files that are not set as persistable.
|
| 1277 |
1369 |
*/
|
| 1278 |
|
public static void deleteAllResultsNodes() {
|
| 1279 |
|
ArrayList<String> resultsNodesQualifier = getAllResultsNodesQualifiers();
|
|
1370 |
public static void deleteAllNotPersistableResultsNodes(String path) {
|
|
1371 |
|
|
1372 |
ArrayList<String> resultsNodesQualifier = getAllResultsNodePaths(path);
|
| 1280 |
1373 |
for (int i = 0; i < resultsNodesQualifier.size(); i++) {
|
| 1281 |
|
delete(scope.getNode(resultsNodesQualifier.get(i)));
|
|
1374 |
TXMResult result = TXMResult.getResult(resultsNodesQualifier.get(i));
|
|
1375 |
if(result != null && !result.isPersistable()) {
|
|
1376 |
delete(preferencesRootNode.node(path).node(resultsNodesQualifier.get(i)));
|
|
1377 |
}
|
| 1282 |
1378 |
}
|
| 1283 |
1379 |
}
|
| 1284 |
1380 |
|
| 1285 |
1381 |
|
| 1286 |
1382 |
/**
|
| 1287 |
|
* Gets all the result nodes qualifiers (from scope or *.prefs files starting with TXMResult.UUID_PREFIX, eg.: "txm_res_").
|
| 1288 |
|
* @return
|
|
1383 |
* Deletes all the result nodes from the preferences and files.
|
| 1289 |
1384 |
*/
|
| 1290 |
|
public static ArrayList<String> getAllResultsNodesQualifiers() {
|
| 1291 |
|
ArrayList<String> resultsNodesQualifiers = new ArrayList<String>();
|
| 1292 |
|
try {
|
| 1293 |
|
IPreferencesService service = Platform.getPreferencesService();
|
| 1294 |
|
for (String scopeName : service.getRootNode().childrenNames()) {
|
| 1295 |
|
if(scopeName != TXMPreferences.scope.getName()) {
|
| 1296 |
|
continue;
|
| 1297 |
|
}
|
| 1298 |
|
|
| 1299 |
|
String[] nodesNames = service.getRootNode().node(scopeName).childrenNames();
|
| 1300 |
|
Arrays.sort(nodesNames);
|
| 1301 |
|
for (String nodeName : nodesNames) {
|
| 1302 |
|
if(nodeName.startsWith(TXMResult.UUID_PREFIX)) {
|
| 1303 |
|
resultsNodesQualifiers.add(nodeName);
|
| 1304 |
|
}
|
| 1305 |
|
}
|
| 1306 |
|
}
|
| 1307 |
|
} catch (Exception e) {
|
| 1308 |
|
e.printStackTrace();
|
|
1385 |
public static void deleteAllResultsNodes(String path) {
|
|
1386 |
|
|
1387 |
ArrayList<String> resultsNodesQualifier = getAllResultsNodePaths(path);
|
|
1388 |
for (int i = 0; i < resultsNodesQualifier.size(); i++) {
|
|
1389 |
delete(preferencesRootNode.node(path).node(resultsNodesQualifier.get(i)));
|
| 1309 |
1390 |
}
|
| 1310 |
|
Collections.sort(resultsNodesQualifiers);
|
| 1311 |
|
return resultsNodesQualifiers;
|
| 1312 |
1391 |
}
|
|
1392 |
|
| 1313 |
1393 |
|
| 1314 |
|
|
| 1315 |
|
|
| 1316 |
|
|
| 1317 |
1394 |
/**
|
| 1318 |
|
* Internal method to find the node qualifier of a result otherwise look in instance, default scopes and in alternatives nodes qualifiers.
|
|
1395 |
* Internal method to find the preference node path of a result otherwise look in instance, default scopes and in alternatives nodes qualifiers.
|
| 1319 |
1396 |
* @param result
|
| 1320 |
1397 |
* @param key
|
| 1321 |
1398 |
*/
|
| 1322 |
|
public static String findNodeQualifier(String nodeQualifier, TXMResult result, String key) {
|
|
1399 |
public static String findNodePath(String nodePath, TXMResult result, String key) {
|
| 1323 |
1400 |
|
| 1324 |
|
boolean keyExists = (result != null && resultScopeKeyExists(result, key));
|
|
1401 |
boolean keyExists = (result != null && keyExists(result.getParametersNodePath(), key));
|
| 1325 |
1402 |
|
| 1326 |
1403 |
// get the result scope preference
|
| 1327 |
1404 |
if(keyExists) {
|