Révision 2559
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2559) | ||
---|---|---|
400 | 400 |
// @Override |
401 | 401 |
// public void run() { |
402 | 402 |
// // TODO Auto-generated method stub |
403 |
// TXMEditor.this.getResult().getParent().compute(true);
|
|
403 |
// TXMEditor.this.getResult().getParent().compute(false);
|
|
404 | 404 |
// } |
405 | 405 |
// }; |
406 | 406 |
// |
... | ... | |
414 | 414 |
@Override |
415 | 415 |
public void run(IProgressMonitor monitor) { |
416 | 416 |
// TODO Auto-generated method stub |
417 |
TXMEditor.this.getResult().getParent().compute(monitor); |
|
417 |
TXMEditor.this.getResult().getParent().compute(monitor, false);
|
|
418 | 418 |
} |
419 | 419 |
}; |
420 | 420 |
|
... | ... | |
457 | 457 |
dialog.run(true, true, job2); |
458 | 458 |
} |
459 | 459 |
} |
460 |
// Canceling |
|
460 | 461 |
catch (ThreadDeath e) { |
461 |
// TODO Auto-generated catch block |
|
462 |
// e.printStackTrace(); |
|
462 |
|
|
463 |
// set parent as canceled |
|
464 |
this.getResult().getParent().cancel(); |
|
465 |
|
|
463 | 466 |
CorporaView.refresh(); |
464 | 467 |
|
465 |
// TODO: SJ: may need to clean some things here |
|
466 |
|
|
467 | 468 |
this.close(); |
468 | 469 |
return; |
469 | 470 |
|
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2559) | ||
---|---|---|
2316 | 2316 |
* @param deepComputing |
2317 | 2317 |
* @return |
2318 | 2318 |
*/ |
2319 |
protected boolean compute(IProgressMonitor monitor, boolean deepComputing) {
|
|
2319 |
public boolean compute(IProgressMonitor monitor, boolean deepComputing) {
|
|
2320 | 2320 |
|
2321 | 2321 |
// skip the process if the result is already in computing stage |
2322 | 2322 |
if (this.computing) { |
... | ... | |
2352 | 2352 |
|
2353 | 2353 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": starting parent (" + this.parent.getClass().getSimpleName() + ") computing process..."); |
2354 | 2354 |
|
2355 |
if (!this.parent.compute(monitor, true)) {
|
|
2355 |
if (!this.parent.compute(monitor, deepComputing)) {
|
|
2356 | 2356 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result."); |
2357 | 2357 |
this.computing = false; |
2358 | 2358 |
return false; |
... | ... | |
2475 | 2475 |
} |
2476 | 2476 |
|
2477 | 2477 |
// Children cascade computing (if parent == null then it is the Workspace (Tree root)) |
2478 |
if (deepComputing && this.parent != null) {
|
|
2478 |
if (this.parent != null) { |
|
2479 | 2479 |
|
2480 | 2480 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " child(ren)."); |
2481 | 2481 |
|
... | ... | |
2485 | 2485 |
// lazy loading test |
2486 | 2486 |
// only compute the child it has already been computed one time ("loaded" one time) |
2487 | 2487 |
// or if this result always needs its children synchronized/computed to be consistent (eg. Partition and children parts) |
2488 |
if (child.mustBeSynchronizedWithParent() || child.hasBeenComputedOnce()) {
|
|
2488 |
if ((deepComputing && child.hasBeenComputedOnce()) || child.mustBeSynchronizedWithParent()) {
|
|
2489 | 2489 |
child.compute(monitor, deepComputing); |
2490 | 2490 |
} |
2491 | 2491 |
|
... | ... | |
2525 | 2525 |
return true; |
2526 | 2526 |
} |
2527 | 2527 |
|
2528 |
|
|
2528 | 2529 |
/** |
2530 |
* Sets the result and all its children as canceled (set them as dirty and set computing state as false). |
|
2531 |
* Dedicated to be called when computing has been killed. |
|
2532 |
* |
|
2533 |
*/ |
|
2534 |
public void cancel() { |
|
2535 |
if (this.computing) { |
|
2536 |
|
|
2537 |
// set back to dirty |
|
2538 |
this.dirty = true; |
|
2539 |
this.computing = false; |
|
2540 |
|
|
2541 |
// deep canceling |
|
2542 |
for (int i = 0; i < this.children.size(); i++) { |
|
2543 |
this.children.get(i).cancel(); |
|
2544 |
} |
|
2545 |
|
|
2546 |
} |
|
2547 |
} |
|
2548 |
|
|
2549 |
|
|
2550 |
/** |
|
2529 | 2551 |
* This method is dedicated to be implemented by the inherited result classes to define the computing steps. |
2530 | 2552 |
* |
2531 | 2553 |
* @return true if the result was computed |
Formats disponibles : Unified diff