Révision 2615
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2615) | ||
---|---|---|
522 | 522 |
/** |
523 | 523 |
* Stores the parameters of the specified type used for last computing. |
524 | 524 |
* |
525 |
* @param parameterType |
|
525 |
* @param parameterTypes
|
|
526 | 526 |
* @param appendToLastParameters |
527 | 527 |
* @throws Exception |
528 | 528 |
*/ |
529 |
protected void updateLastParameters(int parameterType) throws Exception {
|
|
529 |
protected void updateLastParameters(ArrayList<Integer> parametersTypes) throws Exception {
|
|
530 | 530 |
|
531 | 531 |
HashMap<String, Object> lastParameters; |
532 | 532 |
|
... | ... | |
536 | 536 |
|
537 | 537 |
for (Field f : fields) { |
538 | 538 |
Parameter parameter = f.getAnnotation(Parameter.class); |
539 |
if (parameter == null || parameter.type() != parameterType) {
|
|
539 |
if (parameter == null || !parametersTypes.contains(parameter.type())) {
|
|
540 | 540 |
continue; |
541 | 541 |
} |
542 | 542 |
|
... | ... | |
552 | 552 |
lastParameters.put(name, f.get(this)); |
553 | 553 |
} |
554 | 554 |
|
555 |
// if (lastParameters.isEmpty()) { |
|
556 |
// System.out.println("TXMResult.updateLastParameters() empty"); |
|
557 |
// } |
|
558 |
|
|
555 | 559 |
this.parametersHistory.add(lastParameters); |
556 | 560 |
|
557 | 561 |
// truncate the stack to the max count |
... | ... | |
570 | 574 |
* @throws Exception |
571 | 575 |
*/ |
572 | 576 |
protected void updateLastParameters() throws Exception { |
573 |
this.updateLastParameters(Parameter.COMPUTING); |
|
577 |
ArrayList<Integer> parametersTypes = new ArrayList<>(); |
|
578 |
parametersTypes.add(Parameter.COMPUTING); |
|
579 |
this.updateLastParameters(parametersTypes); |
|
574 | 580 |
} |
575 | 581 |
|
576 | 582 |
|
... | ... | |
647 | 653 |
} |
648 | 654 |
|
649 | 655 |
Object lastValue = lastParameters.get(key); |
650 |
Object newValue = this.getParameter(key); |
|
656 |
Object newValue = this.getParameter(key, true);
|
|
651 | 657 |
if (lastValue == null) { |
652 | 658 |
if (newValue != null) { |
653 | 659 |
return true; |
... | ... | |
1100 | 1106 |
|
1101 | 1107 |
// internal data to save for unserialization |
1102 | 1108 |
this.saveParameter("class", this.getClass().getName()); //$NON-NLS-1$ |
1103 |
|
|
1104 | 1109 |
this.saveParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH, this.parametersNodePath); |
1105 |
|
|
1106 |
// FIXME: old version that not work well if a bundle has no preference initializer |
|
1107 |
// this.saveParameter(TXMPreferences.BUNDLE_ID, this.commandPreferencesNodePath); |
|
1108 |
// FIXME: new version |
|
1109 | 1110 |
this.saveParameter(TXMPreferences.BUNDLE_ID, FrameworkUtil.getBundle(getClass()).getSymbolicName()); |
1110 | 1111 |
|
1111 | 1112 |
|
1112 |
|
|
1113 | 1113 |
if (this.parent != null) { |
1114 | 1114 |
this.saveParameter(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.parent.getParametersNodePath()); |
1115 | 1115 |
} |
... | ... | |
1395 | 1395 |
while (this.children.size() > 0) { |
1396 | 1396 |
TXMResult c = this.children.get(0); |
1397 | 1397 |
c.delete(); // should call parent.removeResult(child) |
1398 |
// TXMPreferences.delete(this.children.get(i)); |
|
1399 |
// this.removeChild(i); |
|
1400 | 1398 |
this.children.remove(c); // but should be done already... |
1401 | 1399 |
} |
1402 | 1400 |
this.children.clear(); |
... | ... | |
1408 | 1406 |
// specific cleaning |
1409 | 1407 |
this.clean(); |
1410 | 1408 |
|
1411 |
if (this.parent != null) { |
|
1412 |
|
|
1413 |
this.parent.removeChild(this); |
|
1414 |
|
|
1415 |
} |
|
1416 |
this.parent = null; |
|
1417 | 1409 |
|
1418 | 1410 |
// log |
1419 | 1411 |
if (this.isVisible() || Log.isLoggingFineLevel()) { |
1420 | 1412 |
Log.info(TXMCoreMessages.bind(TXMCoreMessages.info_p0P1Deleted, this.getResultType(), this.getSimpleName())); |
1421 | 1413 |
} |
1422 | 1414 |
|
1415 |
// removes the parent only after the log since getSimpleName() can use it |
|
1416 |
if (this.parent != null) { |
|
1417 |
this.parent.removeChild(this); |
|
1418 |
} |
|
1423 | 1419 |
|
1424 | 1420 |
return true; |
1425 | 1421 |
} |
... | ... | |
2371 | 2367 |
if (this.parent != null && !(this.parent instanceof Project) && !(this.parent instanceof Workspace) |
2372 | 2368 |
&& !this.parent.isComputing()) { |
2373 | 2369 |
|
2374 |
mainSubMonitor.setTaskName("Copmputing parents branch...");
|
|
2370 |
mainSubMonitor.setTaskName("Computing parents branch..."); |
|
2375 | 2371 |
|
2376 | 2372 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": starting parent (" + this.parent.getClass().getSimpleName() + ") computing process..."); |
2377 | 2373 |
|
... | ... | |
2381 | 2377 |
return false; |
2382 | 2378 |
} |
2383 | 2379 |
} |
2380 |
else { |
|
2381 |
mainSubMonitor.setWorkRemaining(2); |
|
2382 |
} |
|
2384 | 2383 |
|
2385 | 2384 |
// update the dirty state from history if a parameter has changed since last computing |
2386 | 2385 |
this.updateDirtyFromHistory(); |
... | ... | |
2432 | 2431 |
// subMonitor.worked(1); |
2433 | 2432 |
|
2434 | 2433 |
} |
2434 |
else { |
|
2435 |
mainSubMonitor.setWorkRemaining(1); |
|
2436 |
} |
|
2435 | 2437 |
|
2436 | 2438 |
// clear the lazy name, no more needed since the object has been computed and getSimpleName() can now work |
2437 | 2439 |
this.lazyName = null; |
... | ... | |
2440 | 2442 |
this.updateLastParameters(); |
2441 | 2443 |
|
2442 | 2444 |
|
2445 |
|
|
2443 | 2446 |
if (!skipComputing) { |
2444 | 2447 |
|
2445 | 2448 |
// store last used parameters |
... | ... | |
2506 | 2509 |
if (!child.isComputing() && ((deepComputing && child.hasBeenComputedOnce()) || child.mustBeSynchronizedWithParent())) { |
2507 | 2510 |
child.compute(loopMonitor.split(1).setWorkRemaining(100), deepComputing); |
2508 | 2511 |
} |
2512 |
else { |
|
2513 |
loopMonitor.worked(1); |
|
2514 |
} |
|
2509 | 2515 |
} |
2510 | 2516 |
} |
2511 | 2517 |
} |
... | ... | |
2537 | 2543 |
Log.info(this.getComputingDoneMessage()); |
2538 | 2544 |
} |
2539 | 2545 |
|
2540 |
|
|
2541 |
// delete the monitor used by subclasses computation method |
|
2542 |
if (this.monitor != null) { |
|
2543 |
this.monitor.done(); |
|
2544 |
this.monitor = null; |
|
2545 |
} |
|
2546 |
|
|
2547 | 2546 |
this.computing = false; |
2548 | 2547 |
|
2549 | 2548 |
// monitor log |
Formats disponibles : Unified diff