Révision 1405

tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 1405)
85 85
import org.txm.core.messages.TXMCoreMessages;
86 86
import org.txm.core.preferences.TBXPreferences;
87 87
import org.txm.core.preferences.TXMPreferences;
88
import org.txm.core.results.TXMResult;
88 89
import org.txm.objects.Project;
89 90
import org.txm.rcp.commands.OpenWelcomePage;
90 91
import org.txm.rcp.commands.RestartTXM;
......
466 467
	public void postShutdown() {
467 468
		callStopScript();
468 469
		Toolbox.shutdown();
470
	}
471
	
472
	/**
473
	 * shutdown code.
474
	 */
475
	@Override
476
	public boolean preShutdown() {
477
		return continueShutDownForPersistedResults();
478
	}
469 479

  
480
	private boolean continueShutDownForPersistedResults() {
481
		if (Toolbox.workspace == null) return true; // nothing to do
482
		
483
		StringBuffer messages = new StringBuffer();
484
		for (Project project : Toolbox.workspace.getProjects()) {
485
			ArrayList<String> bugs = new ArrayList<String>();
486
			for (TXMResult result : project.getDeepChildren()) {
487
				if (result.mustBePersisted() && 
488
					(result.isAltered())) {
489
					bugs.add(result.getSimpleName());
490
				}
491
			}
492
			if (bugs.size() > 0) {
493
				messages.append("\t"+project.getName()+": "+bugs+"\n\n");
494
			}
495
		}
496
		
497
		if (messages.length() > 0) {
498
			return MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Warning", "Modified or not recomputed results won't be correctly saved. Continue?Lost data: \n"+messages);
499
		}
500
		return true;
470 501
	}
471 502

  
472 503
	/* (non-Javadoc)

Formats disponibles : Unified diff