Révision 2579

tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2579)
9 9
import java.util.HashSet;
10 10
import java.util.List;
11 11
import java.util.Set;
12
import java.util.Timer;
13
import java.util.TimerTask;
14 12

  
15 13
import org.eclipse.core.runtime.IConfigurationElement;
16 14
import org.eclipse.core.runtime.IProgressMonitor;
......
22 20
import org.eclipse.core.runtime.jobs.Job;
23 21
import org.eclipse.jface.action.MenuManager;
24 22
import org.eclipse.jface.dialogs.MessageDialog;
25
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
26
import org.eclipse.jface.operation.IRunnableWithProgress;
27 23
import org.eclipse.jface.viewers.ISelectionProvider;
28 24
import org.eclipse.jface.viewers.IStructuredSelection;
29 25
import org.eclipse.jface.viewers.StructuredSelection;
......
43 39
import org.eclipse.swt.widgets.Display;
44 40
import org.eclipse.swt.widgets.Group;
45 41
import org.eclipse.swt.widgets.Menu;
42
import org.eclipse.swt.widgets.ProgressBar;
46 43
import org.eclipse.swt.widgets.Shell;
47 44
import org.eclipse.swt.widgets.Spinner;
48 45
import org.eclipse.swt.widgets.Table;
......
393 390
		
394 391
		try {
395 392
			
396
			// since some editor fields need some values of their parent,
397
			// ensure the parents branch is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.)
398
			// show modal blocking cancelable progression dialog
399
			try {
400
				if (!this.getResult().getParent().hasBeenComputedOnce()) {
401
					AdvancedProgressMonitorDialog dialog = new AdvancedProgressMonitorDialog(this.getSite().getShell(), TXMEditor.this.getResult().getParent());
402
					dialog.runComputingProcess(true);
403
				}
404
			}
405
			// Canceling
406
			catch (InterruptedException e) {
407
				
408
				CorporaView.refresh();
409
				this.close();
410
				
411
				return;
412
			}
413
			
414
			
415 393
			this.parent = parent;
416 394
			
417 395
			// disable the rendering while creating the widgets
......
900 878
		
901 879
		StatusLine.setMessage(this.getResult().getComputingStartMessage());
902 880
		
881
		// FIXME: SJ: tests to hide/display the result area while computing
882
		// this.resultArea.setVisible(false);
903 883
		
904 884
		this.computingJob = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getName())) {
905 885
			
......
1015 995
								
1016 996
								StatusLine.setMessage(TXMEditor.this.getResult().getComputingDoneMessage());
1017 997
								
1018
								// FIXME: SJ: tests to enable/disable the editor widgets when computing
998
								// FIXME: SJ: tests to enable/disable the editor widgets while computing
1019 999
								// recursiveSetEnabled(true);
1020 1000
								
1001
								// FIXME: SJ: tests to hide/display the result area while computing
1002
								// resultArea.setVisible(true);
1021 1003
							}
1022 1004
							catch (Exception e) {
1023 1005
								Log.finer("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": Error while refreshing the editor: " + e); //$NON-NLS-1$
......
1030 1012
				catch (ThreadDeath | InterruptedException e) {
1031 1013
					// FIXME: SJ: should call clean() and/or set the result as dirty?
1032 1014
					return Status.CANCEL_STATUS;
1033
					// FIXME: SJ tests, but it doesn't seem to improve the canceling, need to check more
1034
					// throw td;
1035 1015
				}
1036 1016
				catch (Exception e) {
1037 1017
					TXMEditor.this.getResult().resetComputingState();
......
1045 1025
			}
1046 1026
		};
1047 1027
		
1048
		// FIXME: SJ: tests to show busy cursor
1049
		// IProgressService ps = PlatformUI.getWorkbench().getProgressService();
1050
		// ps.showInDialog(null, job);
1051
		// ps.busyCursorWhile(job);
1028
		this.computingJob.setPriority(Job.DECORATE);
1029
		this.computingJob.setUser(true);
1030
		this.computingJob.schedule();
1052 1031
		
1053
		computingJob.setPriority(Job.DECORATE);
1054
		// FIXME: SJ tests
1055
		// job.setPriority(Job.INTERACTIVE);
1056
		computingJob.setUser(true);
1057
		computingJob.schedule();
1058
		
1059 1032
		return computingJob;
1060 1033
	}
1061 1034
	
......
1091 1064
			// editorInput.getResult().compute(false);
1092 1065
			// }
1093 1066
			
1067
			
1068
			// since some editor fields need some values of their parent,
1069
			// ensure the parents branch is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.)
1070
			// show modal blocking cancelable progression dialog
1071
			if (!wasAlreadyOpened) {
1072
				try {
1073
					if (!editorInput.getResult().getParent().hasBeenComputedOnce()) {
1074
						AdvancedProgressMonitorDialog dialog = new AdvancedProgressMonitorDialog(window.getShell(), editorInput.getResult().getParent());
1075
						dialog.runComputingProcess(true);
1076
					}
1077
				}
1078
				// Canceling
1079
				catch (InterruptedException e) {
1080
					
1081
					CorporaView.refresh();
1082
					
1083
					return null;
1084
				}
1085
			}
1086
			
1087
			
1094 1088
			// opening the editor
1095 1089
			IEditorPart e = page.openEditor(editorInput, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
1096 1090
			if (e instanceof TXMEditor) {

Formats disponibles : Unified diff