Revision 540

tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 540)
102 102
		}
103 103
		else	{
104 104
			// Create and open the chart editor
105
			ChartEditorPart.compute(progression);
105
			//ChartEditorPart.compute(progression);
106 106
		}
107 107

  
108 108
		ChartEditorPart.openEditor(progression);
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 540)
2219 2219
		return this.concordance.getParent().getName().equals(parent.getName());
2220 2220
	}
2221 2221

  
2222
	@Override
2223
	public void computeResult() {
2224
		// TODO Auto-generated method stub
2225 2222

  
2226
	}
2227 2223

  
2228
	@Override
2229 2224
	protected void initializeFields() {
2230 2225
		if (this.concordance == null) {
2231 2226
			leftContextSize = TXMPreferences.getInt(ConcordancePreferences.LEFT_CONTEXT_SIZE, ConcordancePreferences.PREFERENCES_NODE);
tmp/org.txm.synopticeditor.rcp/src/org/txm/rcp/synoptic/editor/SynopticEditionEditor.java (revision 540)
846 846
		this.firePropertyChange(IEditorPart.PROP_DIRTY);
847 847
	}
848 848

  
849
	@Override
850
	public void computeResult() {
851
		// nothing to do
852
	}
853 849

  
854
	@Override
850

  
855 851
	protected void initializeFields() {
856 852
		editionsChooser.setText(StringUtils.join(editionNames, " | ")); //$NON-NLS-1$
857 853
		page_label.setText(""); //$NON-NLS-1$
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesBarChart.java (revision 540)
103 103
					@Override
104 104
					public void widgetSelected(SelectionEvent e) {
105 105
						TXMPreferences.putLocalBoolean(editor.getResultData(), SpecificitiesPreferences.CHART_TRANSPOSE, groupBarsByLines.getSelection());
106
						editor.computeChart(true, true, true);
106
						editor.compute(true);
107 107
					}
108 108
					
109 109
					@Override
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/SVGGraphicEditor.java (revision 540)
249 249
		return source.getParent().equals(parent);
250 250
	}
251 251

  
252
	@Override
253
	public void computeResult() {
254
		// nothing to do
255
	}
256 252

  
257
	@Override
258
	protected void initializeFields() {
259
		// TODO Auto-generated method stub
260
		
261
	}
262 253
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 540)
311 311
	 */
312 312
	public static void compute(final TXMResult result, final boolean update, final TXMEditorPart editor)	{
313 313
		
314
		StatusLine.setMessage("Computing " + result.getName());
315
		
314 316
		JobHandler job = new JobHandler("Computing result") {
315 317

  
316 318
		    @Override
......
320 322
		    	
321 323
		    	try {
322 324

  
325
		    		JobsTimer.start();
326
		    		
323 327
		    		// computing result
324 328
					monitor.beginTask("Computing", 100);
325 329

  
......
335 339
					monitor.worked(50);
336 340
					
337 341
					// cancel
338
					if(monitor.isCanceled())	{
339
						return Status.CANCEL_STATUS;
340
					}
342
//					if(monitor.isCanceled())	{
343
//						return Status.CANCEL_STATUS;
344
//					}
341 345

  
342 346
					// refreshing the tree node
343 347
					if(editor != null)	{
348
//						System.out.println(message);
349
//						StatusLine.setMessage(message);
350
						
344 351
						editor.refresh(update);
345 352
					}
346 353
					
347
					// done
348
					monitor.done();
349 354
				}
350 355
		    	// for user direct canceling
351 356
		    	catch(ThreadDeath td) {
......
353 358
		    		return Status.CANCEL_STATUS;
354 359
		    	}
355 360
				catch(Exception e) {
356
					// TODO Auto-generated catch block
357
					e.printStackTrace();
358
				} 
361
					System.out.println(e.getLocalizedMessage());
362
					Log.printStackTrace(e);
363
				}
364
		    	finally {
365
		    		monitor.done();
366
					JobsTimer.stopAndPrint();
367
		    	}
359 368
				return Status.OK_STATUS;
360 369
		    }
361 370

  
......
365 374
		job.schedule();
366 375
	}
367 376

  
377
// FIXME: old code	
378
//	/**
379
//	 * Computes and creates or updates the result (from the linked editor input data).
380
//	 * @param update set if it's an update on an existing result or a creation of a new result 
381
//	 */
382
//	public void computeResult() {
383
//		final TXMResult result = this.getResultData();
384
//		StatusLine.setMessage("Computing "+result.getName());
385
//		//final TXMParameters parameters = this.getParameters();
386
//		final String title = result.getName()+"...";
387
//		try {
388
//			JobHandler jobhandler = new JobHandler(title, topToolBar) {
389
//				@Override
390
//				protected IStatus run(IProgressMonitor monitor) {
391
//					this.runInit(monitor);
392
//					try {
393
//						JobsTimer.start();
394
//
395
//						//result.setParameters(parameters);
396
//
397
//						if (result.canCompute() && result.isDirty()) {
398
//
399
//							String title = "";//result.getComputingMessage();
400
//							System.out.println(title);
401
//							Log.info("Start computing Index...");
402
//
403
//							result.compute(true, monitor);
404
//						} else {
405
//							return Status.CANCEL_STATUS;
406
//						}
407
//
408
//						if (monitor.isCanceled())
409
//							return Status.CANCEL_STATUS;
410
//
411
//						final String message = "";//result.getComputingEndMessage();
412
//
413
//						if (monitor.isCanceled())
414
//							return Status.CANCEL_STATUS;
415
//
416
//						monitor.worked(95);
417
//						// refresh ui
418
//						syncExec(new Runnable() {
419
//							@Override
420
//							public void run() {
421
//
422
//								System.out.println(message);
423
//								StatusLine.setMessage(message);
424
//
425
//								refresh();
426
//
427
//								RestartTXM.reloadViews();
428
//							}
429
//						});
430
//
431
//					} catch (ThreadDeath td) {
432
//						return Status.CANCEL_STATUS;
433
//					} catch (Exception e) {
434
//						//System.out.println(result.getComputingErrorMessage());
435
//						System.out.println(e.getLocalizedMessage());
436
//						Log.printStackTrace(e);
437
//					} finally {
438
//						monitor.done();
439
//						JobsTimer.stopAndPrint();
440
//					}
441
//					return Status.OK_STATUS;
442
//				}
443
//			};
444
//			jobhandler.startJob();
445
//
446
//		} catch (Exception e1) {
447
//			org.txm.rcp.utils.Logger.printStackTrace(e1);
448
//		}
449
//	}
368 450
	
369
	/**
370
	 * Computes and creates or updates the result (from the linked editor input data).
371
	 * @param update set if it's an update on an existing result or a creation of a new result 
372
	 */
373
	public void computeResult() {
374
		final TXMResult result = this.getResultData();
375
		StatusLine.setMessage("Computing "+result.getName());
376
		//final TXMParameters parameters = this.getParameters();
377
		final String title = result.getName()+"...";
378
		try {
379
			JobHandler jobhandler = new JobHandler(title, topToolBar) {
380
				@Override
381
				protected IStatus run(IProgressMonitor monitor) {
382
					this.runInit(monitor);
383
					try {
384
						JobsTimer.start();
385 451

  
386
						//result.setParameters(parameters);
387

  
388
						if (result.canCompute() && result.isDirty()) {
389

  
390
							String title = "";//result.getComputingMessage();
391
							System.out.println(title);
392
							Log.info("Start computing Index...");
393

  
394
							result.compute(true, monitor);
395
						} else {
396
							return Status.CANCEL_STATUS;
397
						}
398

  
399
						if (monitor.isCanceled())
400
							return Status.CANCEL_STATUS;
401

  
402
						final String message = "";//result.getComputingEndMessage();
403

  
404
						if (monitor.isCanceled())
405
							return Status.CANCEL_STATUS;
406

  
407
						monitor.worked(95);
408
						// refresh ui
409
						syncExec(new Runnable() {
410
							@Override
411
							public void run() {
412

  
413
								System.out.println(message);
414
								StatusLine.setMessage(message);
415

  
416
								refresh();
417

  
418
								RestartTXM.reloadViews();
419
							}
420
						});
421

  
422
					} catch (ThreadDeath td) {
423
						return Status.CANCEL_STATUS;
424
					} catch (Exception e) {
425
						//System.out.println(result.getComputingErrorMessage());
426
						System.out.println(e.getLocalizedMessage());
427
						Log.printStackTrace(e);
428
					} finally {
429
						monitor.done();
430
						JobsTimer.stopAndPrint();
431
					}
432
					return Status.OK_STATUS;
433
				}
434
			};
435
			jobhandler.startJob();
436

  
437
		} catch (Exception e1) {
438
			org.txm.rcp.utils.Logger.printStackTrace(e1);
439
		}
440
	}
441
	
442

  
443 452
	/**
444
	 * The createPartArea method must call this method to initialize the fields values
445
	 */
446
	protected abstract void initializeFields();
447
	
448
	/**
449 453
	 * Synchronizes the editor with the result and refreshes the corpus view.
450 454
	 * Also fires a dirty property change.
451 455
	 */
......
524 528
	 * @return
525 529
	 */
526 530
	public static TXMEditorPart openEditor(TXMResultEditorInput editorInput, String editorPartId, boolean activate, int matchFlags)	{
531
		
532
		compute(editorInput.getResult());
527 533
		TXMEditorPart editor = null;
528 534
		try {
529 535
			IWorkbenchWindow window =TXMWindows.getActiveWindow();
......
546 552
		return openEditor(editorInput, editorPartId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
547 553
	}
548 554
	
555
	public static TXMEditorPart openEditor(TXMResult result, String editorPartId)	{
556
		return openEditor(new TXMResultEditorInput(result), editorPartId);
557
	}
558
	
549 559
	public void setPartName(String partName) {
550 560
		super.setPartName(partName);
551 561
	}
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java (revision 540)
90 90
		// FIXME: Pie chart tests
91 91
//		partitionDimensions.setChartType("Partition Dimensions Pie Chart"); //$NON-NLS-1$
92 92
		
93
		ChartEditorPart.compute(partitionDimensions);
94 93
		ChartEditorPart.openEditor(partitionDimensions);
95 94

  
96 95
		return null;
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 540)
170 170
		//this.composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
171 171
		//parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
172 172

  
173
//		// FIXME: tests
174
//		if(!this.getResultData().isChartDirty())	{
175
//
176
//			loadChart();
177
//			
178
//			// Initialize Swing/AWT events delegation.
179
//			this.getSite().getShell().getDisplay().syncExec(new Runnable() {
180
//				@Override
181
//				public void run() {
182
//					// initialize the default shared context menus as Export, etc.
183
//					initDefaultContextMenus();;
184
//	
185
//					
186
//					// registers user entries event call back extensions
187
//					registerEventCallBackExtensions();
188
//					
189
//					//FIXME: test to contribute to menu only in some context
190
//					// create chart editor part context
191
//	//				IContextService contextService = (IContextService)getSite().getService(IContextService.class);
192
//	//				contextService.activateContext(ChartEditorPart.class.getName());
193
//	//				// create chart composite context
194
//	//				contextService.activateContext(this.chartComposite.getClass().getName());
195
//					
196
//					//FIXME: description test
197
//					//this.setContentDescription("details");
198
//					//this.setContentDescription(this.getResultData().getDetails());
199
//	
200
//					initializeAWTDelegationListeners();
201
//				}
202
//			});
203
//			
204 173
			this.refresh();
205 174
//
206 175
//		}
......
231 200
	 * @return
232 201
	 */
233 202
	public static ChartEditorPart openEditor(ChartResult result, SWTChartsComponentsProvider chartsComponentsProvider) {
203
		compute(result);
234 204
		return chartsComponentsProvider.openEditor(result);
235 205
	}
236 206

  
207
	
237 208
	@Override
238 209
	public void refresh(boolean update) {
239 210
		super.refresh(update);
......
758 729
		return this.chartComposite.hasFocus();
759 730
	}
760 731

  
761
	@Override
762
	public void computeResult() {
763
		// TODO Auto-generated method stub
764
	}
765 732

  
766 733

  
767 734

  
768
	@Override
769
	protected void initializeFields() {
770
		// TODO Auto-generated method stub
771
	}
772

  
773

  
774

  
775 735
	/**
776 736
	 * @return the chartComposite
777 737
	 */
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 540)
236 236
		
237 237
		
238 238
		this.subTask("processing structural units");
239
		if (!stepStructuralUnits() || this.isCanceled())	{
239
		if (!stepStructuralUnits())	{
240 240
			return false;
241 241
		}
242 242
		this.worked(20);
......
244 244
		
245 245
		if(!update)	{
246 246
			this.subTask("finalizing");
247
			if (!stepFinalize() || this.isCanceled())	{
247
			if (!stepFinalize())	{
248 248
				return false;
249 249
			}
250 250
			this.corpus.addResult(this);
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/DiagnosticEditor.java (revision 540)
13 13
import org.eclipse.ui.IEditorInput;
14 14
import org.eclipse.ui.IEditorSite;
15 15
import org.eclipse.ui.PartInitException;
16
import org.txm.core.results.TXMParameters;
17 16
import org.txm.functions.diagnostic.Diagnostic;
18 17
import org.txm.rcp.editors.TXMEditorPart;
19
import org.txm.rcp.preferences.RCPPreferences;
20 18
import org.txm.searchengine.cqp.CQPPreferences;
21 19

  
22 20
public class DiagnosticEditor extends TXMEditorPart {
......
32 30
			this.diag = (Diagnostic) getResultData();
33 31
	}
34 32
	
35
	@Override
36
	protected void initializeFields() {
37
		// TODO Auto-generated method stub
38
		
39
	}
40 33
	
41 34
	@Override
42 35
	public void createPartControl(Composite parent) {
......
59 52
		browser = new Browser(displayArea, SWT.NONE);
60 53
		browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
61 54
		
62
		computeResult();
63 55
	}
64 56
	
65 57
	@Override
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor2.java (revision 540)
744 744

  
745 745

  
746 746

  
747
	@Override
747

  
748 748
	protected void initializeFields() {
749 749
		nLinesSpinner.setMinimum(1);
750 750
		nLinesSpinner.setMaximum(itable.getNRows());
tmp/org.txm.internalview.rcp/src/org/txm/internal/rcp/editors/InternalViewEditor.java (revision 540)
634 634
		return false;
635 635
	}
636 636

  
637
	@Override
637

  
638 638
	protected void initializeFields() {
639 639
		try { // init combos
640 640
			availables = new ArrayList<Property>(corpus.getOrderedProperties());
tmp/org.txm.referencer.rcp/src/org/txm/rcp/editors/referencer/ReferencerEditor.java (revision 540)
654 654
		return this.corpus;
655 655
	}
656 656

  
657
	@Override
658 657
	protected void initializeFields() {
659 658
		// word properties
660 659
		ArrayList<Property> selectedProps = new ArrayList<Property>();

Also available in: Unified diff