Revision 491

tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor2.java (revision 491)
64 64
import org.eclipse.ui.IEditorSite;
65 65
import org.eclipse.ui.PartInitException;
66 66
import org.txm.core.messages.TXMCoreMessages;
67
import org.txm.core.results.TXMResult;
67 68
import org.txm.lexicaltable.core.functions.LexicalTable;
68 69
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
69 70
import org.txm.lexicaltable.rcp.handlers.MergeLines;
70 71
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
71 72
import org.txm.rcp.Messages;
72 73
import org.txm.rcp.StatusLine;
73
import org.txm.rcp.commands.editor.CustomizableEditor;
74 74
import org.txm.rcp.editors.TXMEditorPart;
75 75
import org.txm.rcp.editors.TableKeyListener;
76 76
import org.txm.rcp.swt.widget.ObjectSelector;
......
86 86
 * the lexical table too
87 87
 * @author mdecorde
88 88
 */
89
public class LexicalTableEditor2 extends TXMEditorPart implements CustomizableEditor	{
89
public class LexicalTableEditor2 extends TXMEditorPart	{
90 90

  
91 91
	
92 92
	public static final String ID = "LexicalTableEditor"; //$NON-NLS-1$
......
716 716
		}
717 717
	}
718 718

  
719
	/* (non-Javadoc)
720
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setName(java.lang.String)
721
	 */
722
	@Override
723
	public void setName(String name) {
724
		this.setPartName(name);
725
	}
726 719

  
727
	/* (non-Javadoc)
728
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setIcon(org.eclipse.swt.graphics.Image)
729
	 */
730 720
	@Override
731
	public void setIcon(Image image) {
732
		this.setTitleImage(image);
733
	}
734

  
735
	/* (non-Javadoc)
736
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setSource(java.lang.Object)
737
	 */
738
	@Override
739
	public void setSource(Object source)
740
	{
741
		this.source = source;
742
	}
743

  
744
	/* (non-Javadoc)
745
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#getSource()
746
	 */
747
	@Override
748
	public Object getSource() {
749
		return table;
750
	}
751
	
752
	@Override
753
	public Object toConcordance() { return null;}
754
	@Override
755
	public Object toIndex() { return null;}
756
	@Override
757
	public Object toProgression() { return null;}
758
	
759
	@Override
760
	public boolean usingCorpus(Corpus corpus) {
721
	public boolean isResultUsingParent(TXMResult parent) {
761 722
		Corpus c = getCorpus();
762 723
		if (c == null) return false;
763
		return c.getName().equals(corpus.getName());
724
		return c.getName().equals(parent.getName());
764 725
	}
765 726

  
766
	@Override
767
	public boolean updateCorpus(Corpus corpus) {
768
		// TODO Auto-generated method stub
769
		return false;
770
	}
771
	
772 727
	/**
773 728
	 * Do save.
774 729
	 *
......
790 745

  
791 746
	}
792 747

  
793

  
794 748
	/**
795 749
	 * Checks if is dirty.
796 750
	 *
......
813 767
		return false;
814 768
	}
815 769

  
816

  
817

  
818 770
	@Override
819
	public void computeResult(boolean update) {
771
	public void computeResult() {
820 772
		// FIXME! not yet implemented
821 773
		System.err.println("LexicalTableEditor2.computeResult(): not yet implemented.");
822 774
	}
823 775

  
824 776

  
825 777

  
778
	@Override
779
	protected void initializeFields() {
780
		// TODO Auto-generated method stub
781
		
782
	}
826 783
}
tmp/org.txm.lexicaltable.rcp/plugin.xml (revision 491)
15 15
      <menuContribution
16 16
            locationURI="popup:org.txm.rcp.views.CorporaView">
17 17
         <command
18
               commandId="ComputeLexicalTable"
18
               commandId="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
19 19
               icon="icons/lexicaltable.png"
20 20
               style="push">
21 21
            <visibleWhen
......
37 37
      <menuContribution
38 38
            locationURI="menu:menu.tools">
39 39
         <command
40
               commandId="ComputeLexicalTable"
40
               commandId="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
41 41
               icon="icons/lexicaltable.png"
42 42
               style="push">
43 43
            <visibleWhen
......
60 60
            allPopups="false"
61 61
            locationURI="toolbar:org.txm.rcp.toolbartools">
62 62
         <command
63
               commandId="ComputeLexicalTable"
63
               commandId="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
64 64
               icon="icons/lexicaltable.png"
65 65
               style="push"
66 66
               tooltip="%command.tooltip">
......
83 83
            <menuContribution
84 84
            locationURI="popup:LexicalTableEditor">
85 85
         <command
86
               commandId="DeleteLexicalTableLines"
86
               commandId="org.txm.lexicaltable.rcp.handlers.DeleteLines"
87 87
               style="push">
88 88
         </command>
89 89
         <command
90
               commandId="MergeLines"
90
               commandId="org.txm.lexicaltable.rcp.handlers.MergeLines"
91 91
               style="push">
92 92
         </command>
93 93
         <separator
......
95 95
               visible="true">
96 96
         </separator>
97 97
         <command
98
               commandId="ExportLexicalTable"
98
               commandId="org.txm.lexicaltable.rcp.handlers.ExportLexicalTable"
99 99
               style="push">
100 100
         </command>
101 101
         <command
102
               commandId="ImportTable"
102
               commandId="org.txm.lexicaltable.rcp.handlers.ImportTable"
103 103
               style="push">
104 104
         </command>
105 105
      </menuContribution>
......
110 110
      <command
111 111
            categoryId="org.txm.rcp.category.txm"
112 112
            defaultHandler="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
113
            id="ComputeLexicalTable"
113
            id="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
114 114
            name="%command.name">
115 115
      </command>
116 116
            <command
117 117
            defaultHandler="org.txm.lexicaltable.rcp.handlers.DeleteLines"
118
            id="DeleteLexicalTableLines"
118
            id="org.txm.lexicaltable.rcp.handlers.DeleteLines"
119 119
            name="%command.name.37">
120 120
      </command>
121 121
      
122 122
      <command
123 123
            defaultHandler="org.txm.lexicaltable.rcp.handlers.MergeLines"
124
            id="MergeLines"
124
            id="org.txm.lexicaltable.rcp.handlers.MergeLines"
125 125
            name="%command.name.38">
126 126
      </command>
127 127
      <command
128 128
            defaultHandler="org.txm.lexicaltable.rcp.handlers.ExportLexicalTable"
129
            id="ExportLexicalTable"
129
            id="org.txm.lexicaltable.rcp.handlers.ExportLexicalTable"
130 130
            name="%command.name.39">
131 131
      </command>
132 132
      <command
133 133
            defaultHandler="org.txm.lexicaltable.rcp.handlers.ImportTable"
134
            id="ImportTable"
134
            id="org.txm.lexicaltable.rcp.handlers.ImportTable"
135 135
            name="%command.name.40">
136 136
      </command>
137 137
   </extension>
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java (revision 491)
28 28
package org.txm.cah.core.functions;
29 29

  
30 30
import java.io.File;
31
import java.util.Arrays;
31 32

  
33
import org.eclipse.core.runtime.IProgressMonitor;
32 34
import org.rosuda.REngine.REXP;
33 35
import org.rosuda.REngine.REXPMismatchException;
34 36
import org.txm.ca.core.functions.CA;
35 37
import org.txm.cah.core.messages.CAHCoreMessages;
36 38
import org.txm.cah.core.preferences.CAHPreferences;
37 39
import org.txm.core.preferences.TXMPreferences;
38
import org.eclipse.core.runtime.IProgressMonitor;
40
import org.txm.core.results.TXMParameters;
39 41
import org.txm.functions.TXMCommand;
40 42
import org.txm.lexicaltable.core.functions.LexicalTable;
41
import org.txm.searchengine.cqp.corpus.Corpus;
42
import org.txm.searchengine.cqp.corpus.Partition;
43 43
import org.txm.statsengine.r.core.RWorkspace;
44 44
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
45 45
import org.txm.utils.logger.Log;
......
52 52
 *
53 53
 */
54 54
public class CAH extends TXMCommand	{
55

  
55 56
	/** The metric. */
56
	String metric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$
57
	String pMetric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$
57 58

  
58 59
	/** The method. */
59
	String method = "ward"; // METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible") //$NON-NLS-1$
60
	String pMethod = "ward"; // METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible") //$NON-NLS-1$
60 61

  
61 62
	/** The N cluster. */
62
	int NCluster = 3;
63
	Integer pNCluster = 3;
63 64

  
64
	/** The columns. */
65
	boolean columns = true;
65
	/** if true classify columns values. */
66
	Boolean pColumns = true;
66 67

  
67 68
	/** The symbol. */
68 69
	String symbol = null;
69 70

  
70
	/** The target. */
71
	/** The CA symbol target. */
71 72
	String target;
72 73

  
73
	/** The partition. */
74
	Partition partition;
75
	Corpus corpus;
76

  
77
	/** The source. */
78
	Object source;
79

  
80 74
	/**
81 75
	 * The coordinates of the clusters.
82 76
	 */
......
120 114
	 *
121 115
	 * @param ca the ca
122 116
	 * @param col the col
123
	 * @param method the method
124
	 * @param metric the metric
125
	 * @param NCluster the n cluster
117
	 * @param pMethod the method
118
	 * @param pMetric the metric
119
	 * @param pNCluster the n cluster
126 120
	 * @param display2D the display mode
127 121
	 */
128
	public CAH(CA ca, boolean col, String method, String metric, int NCluster)	{
122
	public CAH(CA ca)	{
129 123
		super(ca);
130 124
		this.ca = ca;
131 125
		this.table = ca.getLexicalTable();
132
		this.columns = col;
133
		this.metric = metric;
134
		this.NCluster = NCluster;
135
		this.method = method;
136

  
137
		this.source = ca;
138
		this.partition = ca.getPartition();
139
		this.corpus = ca.getCorpus();
140 126
		this.target = ca.getSymbol();
141 127
	}
142 128

  
143
	/**
144
	 * Instantiates a new cAH.
145
	 *
146
	 * @param table the table
147
	 * @param col the col
148
	 * @param method the method
149
	 * @param metric the metric
150
	 * @param NCluster the n cluster
151
	 * @param displayMode the display mode
152
	 */
153
	//FIXME: not used?
154
	public CAH(LexicalTable table, boolean col, String method, String metric, int NCluster)	{
155
		super(table);
156
		this.columns = col;
157
		this.metric = metric;
158
		this.NCluster = NCluster;
159
		this.method = method;
129
	public void setParameters(Boolean columns, String metric, Integer nCluster, String method) {
130
		if (columns != null) this.pColumns = columns;
131
		if (metric != null) this.pMetric = metric;
132
		if (nCluster != null) this.pNCluster = nCluster;
133
		if (method != null) this.pMethod = method;
134
		dirty = true;
135
	}
160 136

  
161
		this.source = table;
162
		this.partition = table.getPartition();
163
		this.corpus = table.getCorpus();
164
		this.target = table.getData().getSymbol();
165
		this.table = table;
137
	@Override
138
	public boolean setParameters(TXMParameters parameters) {
139
		this.parameters = parameters;
140
		
141
		try {
142
			Boolean columns = this.getBooleanParameterValue(CAHPreferences.COLUMNS_COMPUTING);
143
			String metric = this.getStringParameterValue(CAHPreferences.METRIC);
144
			Integer nCluster = this.getIntParameterValue(CAHPreferences.N_CLUSTERS);
145
			String method = this.getStringParameterValue(CAHPreferences.METHOD);
146
			this.setParameters(columns, metric, nCluster, method);
147
		} catch(Exception e) {
148
			System.out.println("Error while setting CAH parameters: "+e.getLocalizedMessage());
149
			return false;
150
		}
151
		return true;
166 152
	}
167 153

  
168

  
169 154
	/**
170 155
	 * Resets the cached data so the next getter calls will request the values from R.
171 156
	 */
172
	public void resetCache()	{
157
	public void resetCache() {
173 158
		this.clusterCoords = null;
174 159
		this.clusterNumbers = null;
175 160
		this.clusterRowNames = null;
......
183 168
	 *
184 169
	 * @return the symbol
185 170
	 */
186
	public String getSymbol()
187
	{
171
	public String getSymbol() {
188 172
		return symbol;
189 173
	}
190 174

  
......
193 177
	 *
194 178
	 * @return the methods
195 179
	 */
196
	public static String[] getMethods()
197
	{
180
	public static String[] getMethods() {
198 181
		String[] methods = {"average", "single", "complete", "ward", "weighted", "flexible"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
199 182
		return methods;
200 183
	}
......
204 187
	 *
205 188
	 * @return the metrics
206 189
	 */
207
	public static String[] getMetrics()
208
	{
190
	public static String[] getMetrics() {
209 191
		String[] metrics = {"euclidean", "manhattan"}; //$NON-NLS-1$ //$NON-NLS-2$
210 192
		return metrics;
211 193
	}
......
218 200

  
219 201
	@Override
220 202
	public boolean compute(IProgressMonitor watcher)	{
221
		
203

  
222 204
		Log.info("Computing CAH...");
223 205
		try {
224 206
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
225 207

  
226 208
			String colOrLine = "columns"; //$NON-NLS-1$
227
			if (!columns)
209
			if (!pColumns)
228 210
				colOrLine ="rows"; //$NON-NLS-1$
229 211

  
230
			if(symbol == null)	{
212
			if (symbol == null)	{
231 213
				symbol = prefixR+(nocah++);
232 214
			}
233 215

  
234 216
			rw.eval("library(FactoMineR)"); //$NON-NLS-1$
235 217

  
236
			if (source instanceof LexicalTable)
237
			{
238
				// PCA("+target+", scale.unit = FALSE, ncp = Inf, graph = FALSE)
239
			rw.eval(symbol +" <- HCPC(PCA("+target+", scale.unit = FALSE, ncp = Inf, graph = FALSE)" + //$NON-NLS-1$ //$NON-NLS-2$
218

  
219
			rw.eval(symbol +" <- HCPC("+target + //$NON-NLS-1$
240 220
					", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
241
					", nb.clust="+NCluster + //$NON-NLS-1$
242
					", metric=\""+metric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
243
					", method=\""+method+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
221
					", nb.clust="+pNCluster + //$NON-NLS-1$
222
					", metric=\""+pMetric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
223
					", method=\""+pMethod+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
244 224
					", graph=FALSE)"); //$NON-NLS-1$
245
			}
246
			else
247
			{
248
				rw.eval(symbol +" <- HCPC("+target + //$NON-NLS-1$
249
						", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
250
						", nb.clust="+NCluster + //$NON-NLS-1$
251
						", metric=\""+metric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
252
						", method=\""+method+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
253
						", graph=FALSE)"); //$NON-NLS-1$
254
			}
255
		}
256
		catch(RWorkspaceException e) {
225
		} catch(RWorkspaceException e) {
257 226
			System.out.println("Failed to compute CAH: "+e);
258 227
			Log.printStackTrace(e);
259 228
			return false;
260 229
		}
261 230

  
262 231
		// FIXME: persistence
263
		TXMPreferences.putLocalInt(this, CAHPreferences.N_CLUSTERS, this.NCluster);
264
		TXMPreferences.putLocalBoolean(this, CAHPreferences.COLUMNS_COMPUTING, this.columns);
232
		TXMPreferences.putLocalInt(this, CAHPreferences.N_CLUSTERS, this.pNCluster);
233
		TXMPreferences.putLocalBoolean(this, CAHPreferences.COLUMNS_COMPUTING, this.pColumns);
265 234

  
266
		
267 235
		// Reset the cached data
268 236
		this.resetCache();
237
		dirty = false;
269 238
		return true;
270 239
	}
271 240

  
......
304 273
	}
305 274

  
306 275
	/**
307
	 * Gets the source.
308
	 *
309
	 * @return the source
310
	 */
311
	public Object getSource()	{
312
		return source;
313
	}
314

  
315
	/**
316
	 * Gets the partition.
317
	 *
318
	 * @return the partition
319
	 */
320
	public Partition getPartition() {
321
		return partition;
322
	}
323

  
324
	/**
325
	 * Gets the corpus.
326
	 * @return the corpus
327
	 */
328
	public Corpus getCorpus() {
329
		return corpus;
330
	}
331

  
332
	/**
333 276
	 * Gets the default method.
334 277
	 *
335 278
	 * @return the default method
......
353 296

  
354 297
	}
355 298

  
356

  
357

  
358 299
	/**
359 300
	 * Gets the clusters coordinates.
360 301
	 * @return the clusters coordinates
......
367 308
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
368 309
				for(int i = 0; i < 2; i++) { // 2 dimensions
369 310
					REXP sv = rw.extractItemFromListByName(symbol, "data.clust[,"+ (i + 1)+ "]"); //$NON-NLS-1$
370
					 double[] coords = RWorkspace.toDouble(sv);
371
					 for(int j = 0; j < coords.length; j++) {
372
						 if(this.clusterCoords  == null)	{
373
							 this.clusterCoords = new double[coords.length][2];
374
						 }
311
					double[] coords = RWorkspace.toDouble(sv);
312
					for(int j = 0; j < coords.length; j++) {
313
						if(this.clusterCoords  == null)	{
314
							this.clusterCoords = new double[coords.length][2];
315
						}
375 316
						this.clusterCoords[j][i] = coords[j];
376 317
					}
377 318
				}
......
417 358
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
418 359

  
419 360
				// FIXME: old method, Save the row names in the R data frame
420
//				rw.safeEval(symbol + "$rownames <- rownames(" + symbol + "$data)");
421
//				REXP sv = rw.extractItemFromListByName(symbol, "rownames"); //$NON-NLS-1$
361
				//				rw.safeEval(symbol + "$rownames <- rownames(" + symbol + "$data)");
362
				//				REXP sv = rw.extractItemFromListByName(symbol, "rownames"); //$NON-NLS-1$
422 363

  
423 364

  
424 365
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels"); //$NON-NLS-1$
......
488 429
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
489 430
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$inert.gain"); //$NON-NLS-1$
490 431
				// FIXME: tests
491
	//			REXP sv = rw.extractItemFromListByName(symbol, "call$t$within"); //$NON-NLS-1$
432
				//			REXP sv = rw.extractItemFromListByName(symbol, "call$t$within"); //$NON-NLS-1$
492 433

  
493 434
				this.inertiaGains = sv.asDoubles();
494 435
			}
......
530 471
	 * @param metric the metric to set
531 472
	 */
532 473
	public void setMetric(String metric) {
533
		this.metric = metric;
474
		this.pMetric = metric;
534 475
	}
535 476

  
536 477
	/**
......
538 479
	 * @param method the method to set
539 480
	 */
540 481
	public void setMethod(String method) {
541
		this.method = method;
482
		this.pMethod = method;
542 483
	}
543 484

  
544 485
	/**
......
546 487
	 * @param columns the columns to set
547 488
	 */
548 489
	public void setColumnsComputing(boolean columns) {
549
		this.columns = columns;
490
		this.pColumns = columns;
550 491
	}
551 492

  
552 493
	/**
......
554 495
	 * @param nCluster the nCluster to set
555 496
	 */
556 497
	public void setNCluster(int nCluster) {
557
		NCluster = nCluster;
498
		pNCluster = nCluster;
558 499
	}
559 500

  
560 501
	/**
......
562 503
	 * @return the columns
563 504
	 */
564 505
	public boolean isColumnsComputing() {
565
		return columns;
506
		return pColumns;
566 507
	}
567 508

  
568 509
	/**
......
578 519
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
579 520
			REXP sv = rw.eval("min(length(" + symbol + "$data$clust) - 1, 16)"); //$NON-NLS-1$ //$NON-NLS-2$
580 521
			maxClustersCount = sv.asInteger();
522
		} catch(Exception e) {
523
			System.out.println("Error: "+e.getLocalizedMessage());
524
			Log.printStackTrace(e);
581 525
		}
582 526

  
583
		catch(RWorkspaceException e) {
584
			// TODO Auto-generated catch block
585
			e.printStackTrace();
586
		}
587
		catch(REXPMismatchException e) {
588
			// TODO Auto-generated catch block
589
			e.printStackTrace();
590
		}
591

  
592

  
593 527
		// FIXME: FactoMineR plot.HCPC doesn't manage more than 16 clusters when tree.barplot=TRUE, therefore we can't plot a SVG with more than that, see ticket #836 then use the code below in ChartsEngine to compute
594 528
		// the real maximum available clusters count
595
//		// CA
596
//		if(this.source instanceof CA)	{
597
//			if(this.columns == true)	{
598
//				maxClustersCount = ((CA)this.source).getColumnsCount() - 1;
599
//			}
600
//			else	{
601
//				maxClustersCount = ((CA)this.source).getRowsCount() - 1;
602
//			}
603
//		}
604
//		// Lexical table
605
//		else if(this.source instanceof LexicalTable)	{
606
//			if(this.columns == true)	{
607
//				maxClustersCount = ((LexicalTable)this.source).getColumnsCount() - 1;
608
//			}
609
//			else	{
610
//				maxClustersCount = ((LexicalTable)this.source).getRowsCount() - 1;
611
//			}
612
//		}
529
		//		// CA
530
		//		if(this.source instanceof CA)	{
531
		//			if(this.columns == true)	{
532
		//				maxClustersCount = ((CA)this.source).getColumnsCount() - 1;
533
		//			}
534
		//			else	{
535
		//				maxClustersCount = ((CA)this.source).getRowsCount() - 1;
536
		//			}
537
		//		}
538
		//		// Lexical table
539
		//		else if(this.source instanceof LexicalTable)	{
540
		//			if(this.columns == true)	{
541
		//				maxClustersCount = ((LexicalTable)this.source).getColumnsCount() - 1;
542
		//			}
543
		//			else	{
544
		//				maxClustersCount = ((LexicalTable)this.source).getRowsCount() - 1;
545
		//			}
546
		//		}
613 547

  
614 548
		return maxClustersCount;
615 549
	}
......
627 561
	 * @return the nCluster
628 562
	 */
629 563
	public int getNCluster() {
630
		return NCluster;
564
		return pNCluster;
631 565
	}
632 566

  
633 567
	public CA getCA() {
634 568
		return ca;
635 569
	}
636
	
570

  
637 571
	public LexicalTable getLexicalTable() {
638 572
		return table;
639 573
	}
640 574

  
641
	
575

  
642 576
	@Override
643 577
	public String getName() {
644
		return "TODO : getName(), etc.";
578
		return getParent().getName();
645 579
	}
646 580

  
647
	
581

  
648 582
	@Override
649 583
	public String getSimpleName() {
584
		StringBuffer buffer = new StringBuffer();
585
		if (pColumns != null) buffer.append(pColumns?"cols":"rows");
586
		if (pMethod != null) buffer.append(" "+pMethod);
587
		if (pMetric != null) buffer.append(" "+pMetric);
588
		if (pNCluster != null) buffer.append(" "+pNCluster);
650 589
		return this.getName();
651 590
	}
652 591

  
653 592
	@Override
654 593
	public String getDetails() {
655
		// TODO Auto-generated method stub
656
		return null;
594
		return this.getName();
657 595
	}
596

  
597
	@Override
598
	public boolean validateParameters() {
599

  
600
		return ca != null 
601
				&& Arrays.binarySearch(CAH.getMethods(), pMethod) >= 0 
602
				&& Arrays.binarySearch(CAH.getMetrics(), pMetric) >= 0
603
				&& pNCluster >= 2;
604
	}
658 605
}
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java (revision 491)
47 47

  
48 48
	public TSIndex(Corpus corpus, List<Property> props)
49 49
			throws CqiClientException, IOException, CqiServerError {
50
		super(corpus, new Query("[]"), props);
50
		super(corpus);
51
		this.setParameters(new Query("[]"), props, null, null, null, null);
51 52
	}
52 53

  
53 54
	public TSIndex(Corpus corpus, Query query, List<Property> props)
54 55
			throws CqiClientException, IOException, CqiServerError {
55
		super(corpus, query, props);
56
		super(corpus);
57
		this.setParameters(query, props, null, null, null, null);
56 58
	}
57 59

  
58 60
	public TSIndex(Partition partition, Query query, List<Property> props)
59 61
			throws CqiClientException, IOException, CqiServerError {
60
		super(partition, query, props);
62
		super(partition);
63
		this.setParameters(query, props, null, null, null, null);
61 64
	}
62 65

  
63 66

  
......
141 144

  
142 145
		// time = System.currentTimeMillis();
143 146
		HashMap<Property, int[]> propsId = new HashMap<Property, int[]>();
144
		for (Property property : props) {
147
		for (Property property : pProperties) {
145 148
			try {
146 149
				if (property instanceof StructuralUnitProperty) {
147 150
					int[] structs = CorpusManager.getCorpusManager()
......
170 173
			Match match = matches.get(i);
171 174
			int size = match.size();
172 175
			if (isTargetUsed) size = 1;
173
			for (int p = 0; p < props.size(); p++) {
174
				Property property = props.get(p);
176
			for (int p = 0; p < pProperties.size(); p++) {
177
				Property property = pProperties.get(p);
175 178
				int[] allprosids = propsId.get(property);
176 179
				int[] ids = new int[size];
177 180
				System.arraycopy(allprosids, currentIndex, ids, 0, size);
......
209 212

  
210 213
	private List<Match> getMatchesFromTSQuery(Corpus corp) throws Exception {
211 214
		ArrayList<Match> matches =  new ArrayList<Match>();
212
		tsresult = tscorpus.query(query.toString());
215
		tsresult = tscorpus.query(pQuery.toString());
213 216
		boolean debug = false;
214 217
		ResultForest forest = tsresult.getForest();
215 218
		MatchResult result = tsresult.getMatchResult();
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 491)
9 9
import org.eclipse.ui.model.IWorkbenchAdapter;
10 10
import org.eclipse.ui.plugin.AbstractUIPlugin;
11 11
import org.eclipse.core.runtime.IProgressMonitor;
12
import org.txm.core.results.TXMParameters;
12 13
import org.txm.functions.TXMCommand;
13 14
import org.txm.searchengine.cqp.corpus.Corpus;
14 15
import org.txm.searchengine.cqp.corpus.MainCorpus;
......
238 239
	public String getDetails() {
239 240
		return query;
240 241
	}
242

  
243
	@Override
244
	public boolean validateParameters() {
245
		return corpus != null && query.length() > 0;
246
	}
247

  
248
	@Override
249
	public boolean setParameters(TXMParameters parameters) {
250
		return false;
251
	}
241 252
}
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/ComputeTSIndex.java (revision 491)
35 35
import org.eclipse.ui.handlers.HandlerUtil;
36 36
import org.txm.function.tigersearch.TIGERSearch;
37 37
import org.txm.rcp.TXMWindows;
38
import org.txm.rcp.editors.TXMResultEditorInput;
38 39
import org.txm.searchengine.cqp.corpus.Corpus;
39 40
import org.txm.searchengine.cqp.corpus.Partition;
40 41
import org.txm.tigersearch.editors.TIGERSearchEditor;
41 42
import org.txm.tigersearch.editors.TIGERSearchEditorInput;
42 43
import org.txm.tigersearch.editors.TSIndexEditor;
43
import org.txm.tigersearch.editors.TSIndexEditorInput;
44 44
import org.txm.utils.logger.Log;
45 45

  
46 46

  
......
74 74

  
75 75
	public static void openEditor(Corpus corpus) {
76 76
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
77
		TSIndexEditorInput editorInput = new TSIndexEditorInput(corpus);
77
		TXMResultEditorInput editorInput = new TXMResultEditorInput(corpus);
78 78
		try {
79 79
			TSIndexEditor editor = (TSIndexEditor) page
80 80
					.openEditor(editorInput,TSIndexEditor.ID); //$NON-NLS-1$
......
86 86
	
87 87
	public static void openEditor(Partition partition) {
88 88
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
89
		TSIndexEditorInput editorInput = new TSIndexEditorInput(partition);
89
		TXMResultEditorInput editorInput = new TXMResultEditorInput(partition);
90 90
		try {
91 91
			TSIndexEditor editor = (TSIndexEditor) page
92 92
					.openEditor(editorInput,TSIndexEditor.ID); //$NON-NLS-1$
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditorInput.java (revision 491)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.tigersearch.editors;
29

  
30
import org.txm.function.tigersearch.TSIndex;
31
import org.txm.searchengine.cqp.corpus.Corpus;
32
import org.txm.searchengine.cqp.corpus.Partition;
33
// TODO: Auto-generated Javadoc
34
/**
35
 *
36
 * @author mdecorde
37
 */
38
public class TSIndexEditorInput extends org.txm.index.rcp.editors.IndexEditorInput {
39

  
40
	TSIndex tsindex;
41
	
42
	
43
	public TSIndexEditorInput(Corpus corpus) {
44
		super(corpus);
45
	}
46
	
47
	public TSIndexEditorInput(Partition partition) {
48
		super(partition);
49
	}
50

  
51
	/**
52
	 * Gets the index.
53
	 *
54
	 * @return the index
55
	 */
56
	public TSIndex getTSIndex() {
57
		return tsindex;
58
	}
59
}
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java (revision 491)
51 51
import org.eclipse.swt.events.SelectionListener;
52 52
import org.eclipse.swt.graphics.Font;
53 53
import org.eclipse.swt.graphics.FontData;
54
import org.eclipse.swt.graphics.Image;
55 54
import org.eclipse.swt.graphics.Point;
56 55
import org.eclipse.swt.graphics.Rectangle;
57 56
import org.eclipse.swt.layout.FormAttachment;
......
71 70
import org.eclipse.ui.IEditorInput;
72 71
import org.eclipse.ui.IEditorSite;
73 72
import org.eclipse.ui.PartInitException;
74
import org.eclipse.ui.part.EditorPart;
75 73
import org.txm.core.preferences.TXMPreferences;
74
import org.txm.core.results.TXMResult;
76 75
import org.txm.function.tigersearch.TSIndex;
77 76
import org.txm.index.core.functions.Line;
78 77
import org.txm.index.core.functions.LineComparator.SortMode;
......
82 81
import org.txm.rcp.JobsTimer;
83 82
import org.txm.rcp.Messages;
84 83
import org.txm.rcp.StatusLine;
85
import org.txm.rcp.commands.editor.CustomizableEditor;
84
import org.txm.rcp.editors.TXMEditorPart;
85
import org.txm.rcp.editors.TXMResultEditorInput;
86 86
import org.txm.rcp.editors.TableKeyListener;
87 87
import org.txm.rcp.preferences.RCPPreferences;
88 88
import org.txm.rcp.swt.widget.NavigationWidget;
......
105 105
 *
106 106
 * @author mdecorde
107 107
 */
108
public class TSIndexEditor extends EditorPart implements CustomizableEditor {
108
public class TSIndexEditor extends TXMEditorPart {
109 109

  
110 110
	/** The Constant ID. */
111 111
	public static final String ID = "org.txm.tigersearch.editors.TSIndexEditor"; //$NON-NLS-1$
......
250 250
		setSite(site);
251 251
		setInput(input);
252 252

  
253
		this.corpus = ((TSIndexEditorInput) input).getCorpus();
254
		this.partition = ((TSIndexEditorInput) input).getPartition();
255
		this.index = ((TSIndexEditorInput) input).getTSIndex();
253
		TXMResult result = ((TXMResultEditorInput) input).getResult();
254
		if (result != null && result instanceof TSIndex) {
255
			this.index = (TSIndex)result;
256
			this.corpus = index.getCorpus();
257
			this.partition = index.getPartition();
258
		} else {
259
			throw new PartInitException("TXMResult is not a TSIndex: "+result);
260
		}
256 261
	}
257 262

  
258 263
	/**
......
334 339
							return Status.CANCEL_STATUS;
335 340
						}
336 341
						Log.info("Filtering Fmin="+Fmin+" and Fmax="+Fmax);
337
						index.setCurrentMonitor(this);
338
						index.filterLines(Fmin, Fmax);
342
						index.filterLines(); // Fmin, Fmax
339 343
						Log.info("Sorting...");
340 344
						index.sortLines(SortMode.FREQUNIT, true);
341 345
						Log.info("Cutting Tmax="+Tmax);
342
						index.cut(Tmax);
346
						index.cut(); // Tmax
343 347
						Log.info("TSIndex done.");
344 348

  
345 349
						if (monitor.isCanceled())
......
347 351

  
348 352
						this.acquireSemaphore();
349 353

  
350
//						if (index.isComputedWithPartition())
351
//							partition.storeResult(index);
352
//						else
353
//							corpus.storeResult(index);
354
						
354
						//						if (index.isComputedWithPartition())
355
						//							partition.storeResult(index);
356
						//						else
357
						//							corpus.storeResult(index);
358

  
355 359
						this.releaseSemaphore();
356 360

  
357 361
						final String message;
......
1064 1068
				setPartName(index.getCorpus().getName()+": "+index.getName()); //$NON-NLS-1$
1065 1069
			queryWidget.setFocus();
1066 1070

  
1067
			index.filterLines(index.getFilterFmin(), index
1068
					.getFilterFmax());
1069
			index.sortLines(SortMode.FREQUNIT, true);
1071
			//			index.filterLines(index.getFilterFmin(), index
1072
			//					.getFilterFmax());
1073
			//			index.sortLines(SortMode.FREQUNIT, true);
1070 1074

  
1071 1075
			fillDisplayArea(0, NLignePPageSpinner.getSelection());
1072 1076
		} else if (this.corpus != null) {
......
1206 1210
		return this.index;
1207 1211
	}
1208 1212

  
1209
	/* (non-Javadoc)
1210
	 * @see org.txm.rcpapplication.commands.editor.CustomizableEditor#setName(java.lang.String)
1211
	 */
1212
	@Override
1213
	public void setName(String name) {
1214
		this.setPartName(name);
1215
	}
1216 1213

  
1217
	/* (non-Javadoc)
1218
	 * @see org.txm.rcpapplication.commands.editor.CustomizableEditor#setIcon(org.eclipse.swt.graphics.Image)
1219
	 */
1220
	@Override
1221
	public void setIcon(Image image) {
1222
		this.setTitleImage(image);
1223
	}
1224

  
1225
	/* (non-Javadoc)
1226
	 * @see org.txm.rcpapplication.commands.editor.CustomizableEditor#setSource(java.lang.Object)
1227
	 */
1228
	@Override
1229
	public void setSource(Object source)
1230
	{
1231
		this.source = source;
1232
	}
1233

  
1234
	/* (non-Javadoc)
1235
	 * @see org.txm.rcpapplication.commands.editor.CustomizableEditor#getSource()
1236
	 */
1237
	@Override
1238
	public Object getSource() {
1239
		return index;
1240
	}
1241

  
1242
	@Override
1243
	public Object toConcordance() { return null;}
1244
	@Override
1245
	public Object toIndex() { return null;}
1246
	@Override
1247
	public Object toProgression() { return null;}
1248

  
1249 1214
	public Query getQuery() {
1250 1215
		return new Query(queryWidget.getText());
1251 1216
	}
1252 1217

  
1253 1218
	@Override
1254
	public boolean usingCorpus(Corpus corpus) {
1255
		return this.corpus.getName().equals(corpus.getName());
1219
	public boolean isResultUsingParent(TXMResult parent) {
1220
		return this.corpus.getName().equals(parent.getName());
1256 1221
	}
1257 1222

  
1258 1223
	@Override
1259
	public boolean updateCorpus(Corpus corpus) {
1260
		// TODO Auto-generated method stub
1261
		return false;
1224
	public void computeResult() {
1225
		System.out.println("not implemented.");
1262 1226
	}
1263 1227
}
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 491)
30 30
import org.txm.Toolbox;
31 31
import org.txm.core.preferences.TBXPreferences;
32 32
import org.txm.core.preferences.TXMPreferences;
33
import org.txm.core.results.TXMResult;
33 34
import org.txm.function.tigersearch.TIGERSearch;
34 35
import org.txm.rcp.IImageKeys;
35 36
import org.txm.rcp.JobsTimer;
36
import org.txm.rcp.commands.editor.CustomizableEditor;
37
import org.txm.rcp.editors.TXMEditorPart;
37 38
import org.txm.rcp.svg.SVGComposite;
38 39
import org.txm.rcp.utils.JobHandler;
39 40
import org.txm.rcp.views.QueriesView;
......
45 46
//import org.txm.functions.queryindex.QueryIndex;
46 47

  
47 48

  
48
public class TIGERSearchEditor extends EditorPart implements CustomizableEditor {
49
	public TIGERSearchEditor() {
50
		
51
		
52
	}
49
public class TIGERSearchEditor extends TXMEditorPart {
50
	
53 51
	/** The Constant ID. */
54 52
	public static final String ID = "org.txm.tigersearch.editors.TIGERSearchEditor"; //$NON-NLS-1$
55 53

  
......
191 189
		initializeFields();
192 190
	}
193 191

  
194
	private void initializeFields() {
192
	protected void initializeFields() {
195 193
		String id = corpus.getName();
196 194
		File configfile = new File(corpus.getBaseDirectory(),"tiger/tigersearch.logprop");
197 195
		File registrydir = new File(corpus.getBaseDirectory(), "tiger");
......
432 430
	}
433 431

  
434 432
	@Override
435
	public void setName(String name) {
436
		this.setPartName(name);
433
	public boolean isResultUsingParent(TXMResult parent) {
434
		if (parent instanceof Corpus) {
435
			Corpus c = (Corpus) parent;
436
			return this.corpus.getQualifiedCqpId().equals(c.getQualifiedCqpId());
437
		}
438
		return false;
437 439
	}
438 440

  
439 441
	@Override
440
	public void setIcon(Image titleImage) {
441
		this.setTitleImage(titleImage);
442
	public void computeResult() {
443
		System.out.println("not implemented.");
442 444
	}
443

  
444
	@Override
445
	public void setSource(Object source) {
446
		//this.source = source;
447
	}
448

  
449
	@Override
450
	public Object getSource() {
451
		return ts;
452
	}
453

  
454
	@Override
455
	public Object toConcordance() {
456
		return null;
457
	}
458
	@Override
459
	public Object toIndex() {
460
		return null;
461
	}
462
	@Override
463
	public Object toProgression() {
464
		return null;
465
	}
466

  
467
	@Override
468
	public boolean usingCorpus(Corpus corpus) {
469
		return this.corpus.getQualifiedCqpId().equals(corpus.getQualifiedCqpId());
470
	}
471

  
472
	@Override
473
	public boolean updateCorpus(Corpus corpus) {
474
		return false;
475
	}
476 445
}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpII.java (revision 491)
22 22
import org.eclipse.jface.resource.ImageDescriptor;
23 23
import org.eclipse.ui.model.IWorkbenchAdapter;
24 24
import org.txm.core.messages.TXMCoreMessages;
25
import org.txm.core.results.TXMParameters;
25 26
import org.txm.core.results.TXMResult;
26 27
import org.eclipse.core.runtime.IProgressMonitor;
27 28
import org.txm.functions.TXMCommand;
......
695 696
	public String getDetails() {
696 697
		return texts.toString();
697 698
	}
699

  
700
	@Override
701
	public boolean validateParameters() {
702
		return corpus != null;
703
	}
704

  
705
	@Override
706
	public boolean setParameters(TXMParameters parameters) {
707
		return false;
708
	}
698 709
}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpI.java (revision 491)
19 19
import org.eclipse.jface.resource.ImageDescriptor;
20 20
import org.eclipse.ui.model.IWorkbenchAdapter;
21 21
import org.txm.core.messages.TXMCoreMessages;
22
import org.txm.core.results.TXMParameters;
22 23
import org.eclipse.core.runtime.IProgressMonitor;
23 24
import org.txm.functions.TXMCommand;
24 25
import org.txm.index.core.functions.LineComparator.SortMode;
......
393 394
	public String getDetails() {
394 395
		return texts.toString();
395 396
	}
397

  
398
	@Override
399
	public boolean validateParameters() {
400
		return corpus != null;
401
	}
402

  
403
	@Override
404
	public boolean setParameters(TXMParameters parameters) {
405
		return false;
406
	}
396 407
}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ContextSubcorpus.java (revision 491)
8 8
import java.util.ArrayList;
9 9
import java.util.HashMap;
10 10

  
11
import org.txm.core.results.TXMParameters;
11 12
import org.txm.core.results.TXMResult;
12 13
import org.eclipse.core.runtime.IProgressMonitor;
13 14
import org.txm.functions.TXMCommand;
......
140 141
		// TODO Auto-generated method stub
141 142
		return null;
142 143
	}
144

  
145
	@Override
146
	public boolean validateParameters() {
147
		return corpus != null;
148
	}
149

  
150
	@Override
151
	public boolean setParameters(TXMParameters parameters) {
152
		return false;
153
	}
143 154
}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ValuesOfQuery.java (revision 491)
10 10
import java.io.OutputStreamWriter;
11 11
import java.util.Arrays;
12 12

  
13
import org.txm.core.results.TXMParameters;
13 14
import org.txm.core.results.TXMResult;
14 15
import org.eclipse.core.runtime.IProgressMonitor;
15 16
import org.txm.functions.TXMCommand;
......
211 212
	public String getDetails() {
212 213
		return 	this.corpus.getName()+" "+this.query+" "+this.prop+" "+this.fmin;
213 214
	}
215

  
216
	@Override
217
	public boolean validateParameters() {
218
		return corpus != null;
219
	}
220

  
221
	@Override
222
	public boolean setParameters(TXMParameters parameters) {
223
		return false;
224
	}
214 225
}
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 491)
9 9
import java.util.List;
10 10

  
11 11
import org.txm.chartsengine.core.results.ChartResult;
12
import org.txm.core.results.TXMParameters;
12 13
import org.txm.partition.core.messages.PartitionCoreMessages;
13 14
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
14 15
import org.txm.searchengine.cqp.corpus.Corpus;
......
125 126
		
126 127
	}
127 128

  
129
	@Override
130
	public boolean validateParameters() {
131
		return getPartition() != null;
132
	}
128 133

  
134

  
135
	@Override
136
	public boolean setParameters(TXMParameters parameters) {
137
		return false;
138
	}
129 139
}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 491)
141 141
								this.releaseSemaphore();
142 142

  
143 143
								System.out.println(NLS.bind(Messages.DONE, specificitiesResult.getName()));
144
							}
145
							catch(StatException e) {
144
							} catch(Exception e) {
146 145
								System.out.println(Messages.ComputeSpecifities_4 + e);
147 146
								org.txm.rcp.utils.Logger.printStackTrace(e);
148 147
								return Status.CANCEL_STATUS;
......
186 185
							});
187 186

  
188 187
							monitor.worked(100);
189
						}
190
						catch(ThreadDeath td) {
188
						} catch(ThreadDeath td) {
191 189
							return Status.CANCEL_STATUS;
192
						}
193
						catch(CqiClientException e) {
190
						} catch(Exception e) {
194 191
							org.txm.rcp.utils.Logger.printStackTrace(e);
195
						}
196
						finally {
192
						} finally {
197 193
							monitor.done();
198 194
							JobsTimer.stopAndPrint();
199 195
						}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesBarChart.java (revision 491)
89 89
			// Create and open the chart editor
90 90
			final ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(specificitiesResult);
91 91
			editor.getEditorInput().setAlwaysRecreateEditor(true);
92

  
93 92
			
94 93
			// Contribute to the tool bar without extending ChartEditorPart
95 94
			if(!editor.wasAlreadyOpened())	{
......
110 109
					@Override
111 110
					public void widgetDefaultSelected(SelectionEvent e) {
112 111
						// TODO Auto-generated method stub
113
						
114 112
					}
115 113
				});
116 114
			}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableEditor.java (revision 491)
57 57
import org.eclipse.ui.IEditorSite;
58 58
import org.eclipse.ui.PartInitException;
59 59
import org.eclipse.ui.PlatformUI;
60
import org.txm.core.results.TXMResult;
60 61
import org.txm.objects.TxmObject;
61 62
import org.txm.rcp.editors.TXMEditorPart;
62 63
import org.txm.rcp.Messages;
63 64
import org.txm.rcp.StatusLine;
64
import org.txm.rcp.commands.editor.CustomizableEditor;
65 65
import org.txm.rcp.editors.TableKeyListener;
66 66
import org.txm.searchengine.cqp.corpus.Corpus;
67 67
import org.txm.specificities.core.functions.SpecificitesResult;
68 68
import org.txm.specificities.rcp.messages.SpecificitiesUIMessages;
69 69
import org.txm.statsengine.core.StatException;
70
// TODO: Auto-generated Javadoc
71 70
/**
72 71
 * Display a table editor with specificites index.
73 72
 * 
74 73
 * @author sloiseau
75 74
 * 
76 75
 */
77
public class SpecificitiesTableEditor extends TXMEditorPart implements CustomizableEditor{
76
public class SpecificitiesTableEditor extends TXMEditorPart {
78 77

  
79 78
	public static String ID = "SpecificitiesTableEditor";
80 79
	
81
	
82

  
83 80
	/** The specificities table. */
84 81
	private Table specificitesTable;
85 82
	private TableViewer viewer;
......
547 544
		return tableLines;
548 545
	}
549 546

  
550
	/* (non-Javadoc)
551
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setName(java.lang.String)
552
	 */
553 547
	@Override
554
	public void setName(String name) {
555
		this.setPartName(name);
556
	}
557

  
558
	/* (non-Javadoc)
559
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setIcon(org.eclipse.swt.graphics.Image)
560
	 */
561
	@Override
562
	public void setIcon(Image image) {
563
		this.setTitleImage(image);
564
	}
565

  
566
	/* (non-Javadoc)
567
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setSource(java.lang.Object)
568
	 */
569
	@Override
570
	public void setSource(Object source) {
571
		this.source = source;
572
	}
573

  
574
	/* (non-Javadoc)
575
	 * @see org.txm.rcp.commands.editor.CustomizableEditor#getSource()
576
	 */
577
	@Override
578
	public Object getSource() {
579
		return specificitiesResult;
580
	}
581
	
582
	@Override
583
	public Object toConcordance() { return null;}
584
	@Override
585
	public Object toIndex() { return null;}
586
	@Override
587
	public Object toProgression() { return null;}
588
	
589
	@Override
590
	public boolean usingCorpus(Corpus corpus) {
548
	public boolean isResultUsingParent(TXMResult parent) {
591 549
		if (this.specificitiesResult == null) return false;
592 550
		if (this.specificitiesResult.getCorpus() == null) return false;
593
		return this.specificitiesResult.getCorpus().getName().equals(corpus.getName());
551
		return this.specificitiesResult.getCorpus().getName().equals(parent.getName());
594 552
	}
595 553

  
596 554
	@Override
597
	public boolean updateCorpus(Corpus corpus) {
598
		// TODO Auto-generated method stub
599
		return false;
555
	public void computeResult() {
556
		// FIXME! not yet implemented
557
		System.err.println("SpecificitiesTableEditor.computeResult(): not yet implemented.");
600 558
	}
601 559

  
602 560
	@Override
603
	public void computeResult(boolean update) {
604
		// FIXME! not yet implemented
605
		System.err.println("SpecificitiesTableEditor.computeResult(): not yet implemented.");
561
	protected void initializeFields() {
562
		// TODO Auto-generated method stub
563
		
606 564
	}
607 565
}
tmp/org.txm.specificities.rcp/plugin.xml (revision 491)
14 14
            class="org.txm.specificities.rcp.editors.SpecificitiesTableEditor"
15 15
            default="false"
16 16
            icon="icons/functions/specificities.png"
17
            id="SpecificitiesTableEditor"
17
            id="org.txm.specificities.rcp.editors.SpecificitiesTableEditor"
18 18
            name="%editor.name">
19 19
      </editor>
20 20
   </extension>
......
23 23
      <command
24 24
            categoryId="org.txm.rcp.category.txm"
25 25
            defaultHandler="org.txm.specificities.rcp.handlers.ComputeSpecifities"
26
            id="ComputeSpecifities"
26
            id="org.txm.specificities.rcp.handlers.ComputeSpecifities"
27 27
            name="%command.name">
28 28
      </command>
29 29
      <command
30 30
            defaultHandler="org.txm.specificities.rcp.handlers.ComputeSpecifictiesBarChart"
31
            id="ComputeSpecifictiesBarChart"
31
            id="org.txm.specificities.rcp.handlers.ComputeSpecifictiesBarChart"
32 32
            name="%command.name.0">
33 33
      </command>
34 34
   </extension>
......
37 37
      <menuContribution
38 38
            locationURI="popup:SpecificitiesTableEditor">
39 39
         <command
40
               commandId="ComputeSpecifictiesBarChart"
40
               commandId="org.txm.specificities.rcp.handlers.ComputeSpecifictiesBarChart"
41 41
               icon="icons/functions/specificities.png"
42 42
               style="push">
43 43
         </command>
......
45 45
      <menuContribution
46 46
            locationURI="popup:org.txm.rcp.views.CorporaView">
47 47
         <command
48
               commandId="ComputeSpecifities"
48
               commandId="org.txm.specificities.rcp.handlers.ComputeSpecifities"
49 49
               icon="icons/functions/specificities.png"
50 50
               style="push">
51 51
            <visibleWhen
......
67 67
      <menuContribution
68 68
            locationURI="menu:menu.tools">
69 69
         <command
70
               commandId="ComputeSpecifities"
70
               commandId="org.txm.specificities.rcp.handlers.ComputeSpecifities"
71 71
               icon="icons/functions/specificities.png"
72 72
               style="push">
73 73
            <visibleWhen
......
90 90
            allPopups="false"
91 91
            locationURI="toolbar:org.txm.rcp.toolbartools">
92 92
         <command
93
               commandId="ComputeSpecifities"
93
               commandId="org.txm.specificities.rcp.handlers.ComputeSpecifities"
94 94
               icon="icons/functions/specificities.png"
95 95
               style="push"
96 96
               tooltip="%command.tooltip">
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff