Revision 1509

tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 1509)
243 243
		//			}
244 244
		//		});
245 245
		treeViewer.setContentProvider(new TXMResultContentProvider(this));
246
		//treeViewer.setLabelProvider(new TextometrieLabelProvider());
247
		//treeViewer.setLabelProvider(new DecoratingLabelProvider(new TXMResultLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
248

  
249 246
		treeViewer.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
250 247

  
251 248
		// for now the sorter is used to sort the Corpus, Subcorpus and partition objects
......
290 287
			if (p == null) return;
291 288
			treeViewer.setInput(p);
292 289
		}
290
		// FIXME: SJ: to remove?
293 291
		//PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getTree(), "org.txm.rcp.corporaView" //$NON-NLS-1$);
294 292

  
295 293
		treeViewer.getTree().addSelectionListener(new SelectionListener() {
......
305 303

  
306 304
				TreeSelection selection = (TreeSelection) treeViewer.getSelection();
307 305
				Object selectedItem = selection.getFirstElement();
306
				
307
				// FIXME : MD tests
308
//				if (selectedItem instanceof TXMResult) {
309
//					TXMResult r = ((TXMResult)selectedItem);
310
//					if (r.compute()) {
311
//						String mess = r.getSimpleDetails();
312
//						if (mess == null) mess = selectedItem.toString();
313
//						StatusLine.setMessage(mess);
314
//					}
315
//				}
316
				
317
				// FIXME: SJ tests, define here what to display
308 318
				if (selectedItem instanceof TXMResult) {
309
					TXMResult r = ((TXMResult)selectedItem);
310
					if (r.compute()) {
311
						String mess = r.getSimpleDetails();
312
						if (mess == null) mess = selectedItem.toString();
313
						StatusLine.setMessage(mess);
314
					}
319
//					TXMResult result = ((TXMResult)selectedItem);
320
//					String mess = result.getSimpleDetails();
321
//					if (mess == null) {
322
//						mess = result.getCurrentName();
323
//					}
324
//					StatusLine.setMessage(mess);
325
					StatusLine.setMessage(((TXMResult)selectedItem).getName());
315 326
				}
327
				
316 328
			}
317 329

  
318 330
			@Override
......
402 414
			}
403 415
		});
404 416

  
405
		// FIXME: show icon for results that are user persistable
406

  
407 417
		final int IMAGE_MARGIN = 2;
408 418
		final Image icon = IImageKeys.getImage("icons/decorators/bullet_green.png");
409 419
		final Image icon_lock = IImageKeys.getImage("icons/decorators/lock.png");
420
		
421
		// FIXME: test to show icon for results that are user persistable
410 422
		//		    final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.gef","platform:/plugin/org.eclipse.gef/org/eclipse/gef/internal/icons/pinned.gif").createImage();
411 423
		//		    final Image icon = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.team.svn.help","platform:/plugin/org.eclipse.team.svn.help/images/lock.gif").createImage();
412 424

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ExportResult.java (revision 1509)
51 51
import org.txm.rcp.messages.TXMUIMessages;
52 52
import org.txm.rcp.swt.dialog.LastOpened;
53 53
import org.txm.rcp.utils.JobHandler;
54
// TODO: Auto-generated Javadoc
55 54
/**
56
 * export a result of a result by calling the function toTxt(File f) then show
57
 * the result in the text editor @ author mdecorde.
55
 * Exports a result by calling the function toTxt(File f) then opens or not the result in the text editor according to the preferences.
56
 * @author mdecorde
58 57
 */
59 58
public class ExportResult extends AbstractHandler {
60 59

  
......
84 83
		String extensions[] = {"*.csv"}; //$NON-NLS-1$
85 84
		if (s instanceof TXMResult) {
86 85
			extensions = ((TXMResult)s).getExportTXTExtensions(); //$NON-NLS-1$
86
			dialog.setFileName(((TXMResult)s).getValidFileName());
87 87
		}
88 88
		dialog.setFilterExtensions(extensions);
89 89

  
......
93 93

  
94 94
		if (dialog.open() != null) {
95 95
			StatusLine.setMessage(TXMUIMessages.exportingResults);
96
			String filepath = dialog.getFilterPath()
97
					+ "/" + dialog.getFileName(); //$NON-NLS-1$
96
			String filepath = dialog.getFilterPath() + "/" + dialog.getFileName(); //$NON-NLS-1$
98 97
			if (!(filepath.endsWith(extensions[0].substring(1))))
99 98
				filepath += extensions[0].substring(1);
100 99

  
......
129 128

  
130 129
						if (s instanceof TXMResult) {
131 130
							TXMResult r = (TXMResult)s;
131
							
132
							// compute the result if needed
132 133
							if (!r.isAltered()) {
133
								r.compute(this); // refresh result
134
								r.compute(this);
134 135
							}
136
							
135 137
							r.setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
136 138
							r.toTxt(outfile, encoding, colseparator, txtseparator);
137 139
						} else {
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1509)
89 89

  
90 90

  
91 91

  
92
	// essentially for Links and Persistence
92
	// TXMResult internal parameters, essentially for Links and Persistence
93 93
	public final static String RESULT_PARAMETERS_NODE_PATH = "result_parameters_node_path"; //$NON-NLS-1$
94 94
	//public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$
95 95
	public final static String PARENT_PARAMETERS_NODE_PATH = "parent_parameters_node_path"; //$NON-NLS-1$
......
97 97
	public final static String USER_NAME = "user_name"; //$NON-NLS-1$
98 98
	public final static String LAZY_NAME = "lazy_name"; //$NON-NLS-1$
99 99
	public final static String VISIBLE = "visible"; //$NON-NLS-1$
100
	/**
101
	 * Result creation date.
102
	 */
103
	public static final String CREATION_DATE = "creation_date";
100 104
	
105
	/**
106
	 * Last computing date of a result.
107
	 */
108
	public static final String LAST_COMPUTING_DATE = "last_computing_date";
109
	// end of TXMResult internal parameters
110
	
111
	
112
	
113
	
101 114
	// to shared strings in some command preferences
102 115
	/**
103 116
	 * Queries.
tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java (revision 1509)
102 102
	public static final String DESCRIPTION = "description";
103 103
	public static final String ANNOTATE = "annotate";
104 104

  
105
	public static final String CREATE_DATE = "create_date";
106
	public static final String UPDATE_DATE = "update_date";
107

  
108 105
	public static final String ID = "id";
109 106

  
110 107
	public static final String REF_PROPERTY = "ref_property";
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1509)
179 179
	/**
180 180
	 * Last compute date.
181 181
	 */
182
	@Parameter(key=TBXPreferences.UPDATE_DATE, type=Parameter.INTERNAL)
183
	private Date pLastUpdateDate;
182
	@Parameter(key=TBXPreferences.LAST_COMPUTING_DATE, type=Parameter.INTERNAL)
183
	private Date lastComputingDate;
184 184

  
185 185
	/**
186 186
	 * Creation date.
187 187
	 */
188
	@Parameter(key=TBXPreferences.CREATE_DATE, type=Parameter.INTERNAL)
189
	private Date pCreationDate;
188
	@Parameter(key=TBXPreferences.CREATION_DATE, type=Parameter.INTERNAL)
189
	private Date creationDate;
190 190
	
191 191
	// true if the result is computing = in compute(,) method
192 192
	protected boolean computing = false;
......
201 201
	}
202 202

  
203 203
	public Date getComputeDate() {
204
		return this.pLastUpdateDate;
204
		return this.lastComputingDate;
205 205
	}
206 206

  
207 207
	public Date getCreationDate() {
208
		return this.pCreationDate;
208
		return this.creationDate;
209 209
	}
210 210
	
211 211
	/**
......
242 242
			// no parametersNodePath -> new result
243 243
			this.parametersNodePath = parametersNodePath + createUUID() + "_" + this.getClass().getSimpleName(); //$NON-NLS-1$;
244 244
			try {
245
				this.saveParameter(TBXPreferences.CREATE_DATE, ID_TIME_FORMAT.format(Calendar.getInstance().getTime()));
245
				this.saveParameter(TBXPreferences.CREATION_DATE, ID_TIME_FORMAT.format(Calendar.getInstance().getTime()));
246 246
			} catch (Exception e) {
247 247
				// TODO Auto-generated catch block
248 248
				e.printStackTrace();
......
2096 2096
				// store last used parameters
2097 2097
//				this.updateLastParameters();
2098 2098
				if (this.hasBeenComputedOnce// don't update the compute date if the object has been lazy loaded
2099
						|| pLastUpdateDate == null) { // set the update date if never computed once
2100
					pLastUpdateDate = Calendar.getInstance().getTime(); // update this internal parameter before saving parameters
2099
						|| lastComputingDate == null) { // set the update date if never computed once
2100
					lastComputingDate = Calendar.getInstance().getTime(); // update this internal parameter before saving parameters
2101 2101
				}
2102 2102
				
2103 2103
				if (!this.autoSaveParametersFromAnnotations()) {
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChart.java (revision 1509)
46 46
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
47 47
import org.txm.core.preferences.TBXPreferences;
48 48
import org.txm.core.preferences.TXMPreferences;
49
import org.txm.core.results.TXMResult;
49 50
import org.txm.rcp.JobsTimer;
50 51
import org.txm.rcp.StatusLine;
51 52
import org.txm.rcp.commands.OpenGraph;
......
134 135
						this.runInit(monitor);
135 136
						monitor.beginTask(TXMUIMessages.exporting, 100);
136 137

  
138
						// compute the result if needed
139
						if (!chartResult.hasBeenComputedOnce())	{
140
							chartResult.compute(this);
141
						}
142
						
137 143
						String outputFormat = SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().get(dialog.getFilterIndex());
138 144
						ChartsEngine.getCurrent().createChartFile(chartResult, file, outputFormat);
139 145

  
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1509)
246 246

  
247 247
		// Parts already created
248 248
		if (this.getParts().size() > 0) {
249
			//			//FIXME: temporary fix, compute all the children parts
249
			//FIXME: temporary fix, compute all the children parts
250 250
			List<Part> parts = (List<Part>)getChildren(Part.class);
251 251
			for (int i = 0; i < parts.size(); i++) {
252 252
				parts.get(i).compute();
253 253
			}
254
		} else {
254
		}
255
		else {
255 256
			Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartition, this.getParent(), this.userName));
256 257

  
257 258
			if (this.pProperty != null) {
......
365 366

  
366 367
	@Override
367 368
	public String getDetails() {
368
		return NLS.bind(getName()+" ({0})", getPartsCount());
369
		return NLS.bind(this.getName() + " ({0})", this.getPartsCount());
369 370
	}
370 371

  
372
	@Override
373
	public String getSimpleName() {
374
		return this.userName;
375
	}
376

  
377
	@Override
378
	public String getName() {
379
		String name = this.userName;
380
		int partsCount = this.getPartsCount();
381
		
382
		if(partsCount > 0)	{
383
			name += NLS.bind(" ({0})", partsCount);
384
		}
385
		
386
		return name;
387
	}
388
	
371 389
	/**
372 390
	 * Gets the number of parts.
373 391
	 * 
374
	 * @return the the number of parts.
392
	 * @return the number of parts.
375 393
	 */
376 394
	public int getPartsCount() {
377
		// FIXME: later should just return the direct children count
378
		try {
379
			//			if (!hasBeenComputedOnce()) {
380
			//				compute();
381
			//			}
382
			//			
383
			return getParts().size();
384
		} catch(Exception e) { }
385
		return 0;
395
		return this.getParts().size();
386 396
	}
387 397

  
388 398
	/**
......
391 401
	 * @return the part names
392 402
	 */
393 403
	public List<String> getPartNames() {
394
		if (hasBeenComputedOnce()) {
395
			List<Part> parts = getParts();
404
		if (this.hasBeenComputedOnce()) {
405
			List<Part> parts = this.getParts();
396 406
			List<String> partNames = new ArrayList<String>(parts.size());
397
			for (Subcorpus part : getParts()) {
407
			for (Subcorpus part : this.getParts()) {
398 408
				partNames.add(part.getName());
399 409
			}
400 410
			return partNames;
......
404 414
	}
405 415

  
406 416
	/**
407
	 * Gets the parts.
417
	 * Gets the children parts.
408 418
	 * 
409 419
	 * @return the parts
410 420
	 */
411 421
	@SuppressWarnings("unchecked")
412 422
	public List<Part> getParts() {
413
		return (List<Part>) getChildren(Part.class);
423
		return (List<Part>) this.getChildren(Part.class);
414 424
	}
415 425

  
416
	//	/**
417
	//	 * Gets the short name of the parts.
418
	//	 * 
419
	//	 * @return the part names
420
	//	 */
421
	//	public List<String> getPartShortNames() {
422
	//		List<Part> parts = getParts();
423
	//		List<String> partNames = new ArrayList<String>(parts.size());
424
	//		for (Part part : parts) {
425
	//			partNames.add(part.getShortName());
426
	//		}
427
	//		return partNames;
428
	//	}
429

  
430 426
	/**
431 427
	 * Gets the part sizes as int array.
432 428
	 * 
......
436 432
	 * @throws CqiClientException
437 433
	 */
438 434
	public int[] getPartSizes() throws CqiClientException {
439
		int[] partSizes = new int[getParts().size()];
435
		int[] partSizes = new int[this.getParts().size()];
440 436
		for (int i = 0 ; i < getParts().size() ; i++) {
441
			Part p = getParts().get(i);
437
			Part p = this.getParts().get(i);
442 438
			partSizes[i] = p.getSize();
443 439
		}
444 440
		return partSizes;
......
453 449
		return pProperty;
454 450
	}
455 451

  
456
	@Override
457
	public String getSimpleName() {
458
		return this.userName;
459
	}
460

  
461 452
	/**
462 453
	 * Gets the structure.
463 454
	 *
......
570 561
	 */
571 562
	public void removePart(Part p) throws CqiClientException {
572 563
		p.delete();
573
		//p.dropSubcorpus(p.getSubCorpus());
574 564
	}
575 565

  
576 566

  
......
729 719
		return (Partition) result.getFirstParent(Partition.class);
730 720
	}
731 721

  
732
	@Override
733
	public String getName() {
734
		return this.userName;
735
	}
736 722

  
723
	@Override
737 724
	public CQPCorpus getCorpus() {
738 725
		return (CQPCorpus) parent;
739 726
	}
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 1509)
899 899

  
900 900
	@Override
901 901
	public String getSimpleName() {
902
		if (pQuery != null && !pQuery.isEmpty()) {
903
			return pQuery.toString();
902
		if (this.pQuery != null && !this.pQuery.isEmpty()) {
903
			return this.pQuery.toString();
904 904
		}
905 905
		else	{
906 906
			return this.getEmptyName();
......
910 910
	@Override
911 911
	public String getName() {
912 912
		try {
913
			if (queryResult != null) {
914
				return  this.getCorpus().getName()
915
						+ " " //$NON-NLS-1$
916
						+ queryResult.getQuery().getQueryString();
917
			} else {
918
				return this.getCorpus().getName();
913
			
914
			String name = this.getCorpus().getName();
915
			
916
			if (this.pQuery != null && !this.pQuery.isEmpty()) {
917
				name += " " + this.pQuery.toString(); //$NON-NLS-1$
919 918
			}
919
//			
920
//			if (this.queryResult != null) {
921
//				return  this.getCorpus().getName()
922
//						+ " " //$NON-NLS-1$
923
//						+ this.queryResult.getQuery().getQueryString();
924
//			}
925
//			else {
926
//				return this.getCorpus().getName();
927
//			}
928
//			
929
			return name;
920 930
		}
921 931
		catch (Exception e) {
922 932
			return this.getEmptyName();
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 1509)
736 736
	@Override
737 737
	public String getDetails() {
738 738
		try {
739
			return NLS.bind(TXMCoreMessages.common_fMinEquals, this.getLexicalTable().getFMin());
739
			return this.getSimpleName() + " " + NLS.bind(TXMCoreMessages.common_fMinEquals, this.getLexicalTable().getFMin());
740 740
		}
741 741
		catch (Exception e) {
742 742
			return ""; //$NON-NLS-1$
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1509)
31 31
import java.util.List;
32 32

  
33 33
import org.txm.core.messages.TXMCoreMessages;
34
import org.txm.index.core.messages.IndexCoreMessages;
35 34
import org.txm.index.core.preferences.IndexPreferences;
36 35
import org.txm.searchengine.cqp.corpus.CQPCorpus;
37 36
import org.txm.searchengine.cqp.corpus.CQPLexicon;
......
126 125
		try {
127 126
			return this.getParent().getSimpleName() + ": " + this.getSimpleName();
128 127
		}
129
		catch(Exception e) {
128
		catch(NullPointerException e) {
130 129
			return this.getEmptyName();
131 130
		}
132 131
	}
......
135 134
	public String getSimpleName() {
136 135
		if (lexicon != null) {
137 136
			return lexicon.getSimpleName();
138
		} else if (pProperties != null && pProperties.size() > 0) {
137
		}
138
		else if (pProperties != null && pProperties.size() > 0) {
139 139
			return pProperties.get(0).getName();
140
		} else {
140
		}
141
		else {
141 142
			return getParent().getSimpleName();
142 143
		}
143 144
	}

Also available in: Unified diff