Revision 134

tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/CAHPreferences.java (revision 134)
1
package org.txm.cah.core.preferences;
2

  
3

  
4
import org.eclipse.core.runtime.preferences.DefaultScope;
5
import org.osgi.framework.FrameworkUtil;
6
import org.osgi.service.prefs.Preferences;
7
import org.txm.cah.core.functions.CAH;
8
import org.txm.core.preferences.TXMPreferences;
9

  
10
/**
11
 * Default preferences initializer.
12
 * 
13
 * @author mdecorde
14
 * @author sjacquot
15
 *
16
 */
17
public class CAHPreferences extends TXMPreferences {
18

  
19
	// auto populate the preference node qualifier from the current bundle id
20
	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(CAHPreferences.class).getSymbolicName();
21
	public static final String PREFERENCES_PREFIX = "cah_"; //$NON-NLS-1$
22
	
23
	/** The Constant DISPLAY. */
24
	public static final String DISPLAY = "cah_display_2d"; //$NON-NLS-1$
25
	
26
	/** The Constant METHOD. */
27
	public static final String METHOD = "cah_default_method"; //$NON-NLS-1$
28
	
29
	/** The Constant METRIC. */
30
	public static final String METRIC = "cah_default_metric"; //$NON-NLS-1$
31
	
32
	/** The Constant NCLUSTER. */
33
	public static final String NCLUSTER = "cah_default_ncluster"; //$NON-NLS-1$
34
	
35
	/** The Constant ID. */
36
	public static final String ID = "org.txm.rcpapplication.preferences.CAHPreferencePage"; //$NON-NLS-1$
37

  
38
	public CAHPreferences() {
39
		// TODO Auto-generated constructor stub
40
	}
41

  
42
	@Override
43
	public void initializeDefaultPreferences() {
44
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
45
		preferences.putBoolean(DISPLAY, false);
46
		preferences.putInt(NCLUSTER, 2);
47
		preferences.put(METHOD, CAH.getDefaultMethod());
48
		preferences.put(METRIC, CAH.getDefaultMetric());
49
		
50
		// shared charts rendering preferences
51
		super.initializeChartsEngineSharedPreferences(preferences);
52
	}
53
	
54
}
0 55

  
tmp/org.txm.cah.core/src/org/txm/cah/core/messages/messages_ru.properties (revision 134)
1
CAH_0=Error while exporting CAH result : 
0 2

  
tmp/org.txm.cah.core/src/org/txm/cah/core/messages/messages_fr.properties (revision 134)
1
CAH_0=Erreur durant l'export du r?sultat CAH : 
0 2

  
tmp/org.txm.cah.core/src/org/txm/cah/core/messages/TBXCAHMessages.java (revision 134)
1
package org.txm.cah.core.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4

  
5
public class TBXCAHMessages extends NLS {
6

  
7
	private static final String BUNDLE_NAME = "org.txm.cah.core.messages.messages"; //$NON-NLS-1$
8

  
9
	public static String CAH_0;
10

  
11
	public static String CAHEditor_PART_NAME_PREFIX;
12
	public static String CAHEditorTitle;
13
	
14
	static {
15
		// initialize resource bundle
16
		NLS.initializeMessages(BUNDLE_NAME, TBXCAHMessages.class);
17
	}
18

  
19
	private TBXCAHMessages() {
20
	}
21
}
0 22

  
tmp/org.txm.cah.core/src/org/txm/cah/core/messages/messages.properties (revision 134)
1
CAH_0=Error while exporting CAH result : 
0 2

  
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java (revision 134)
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.cah.core.functions;
29

  
30
import java.io.File;
31

  
32
import org.rosuda.REngine.REXP;
33
import org.rosuda.REngine.REXPMismatchException;
34
import org.txm.HasResults;
35
import org.txm.cah.core.messages.TBXCAHMessages;
36
import org.txm.functions.Function;
37
import org.txm.functions.TXMResult;
38
import org.txm.functions.ca.CA;
39
import org.txm.searchengine.cqp.corpus.Corpus;
40
import org.txm.searchengine.cqp.corpus.Partition;
41
import org.txm.stat.data.LexicalTable;
42
import org.txm.stat.engine.r.RWorkspace;
43
import org.txm.stat.engine.r.RWorkspaceException;
44

  
45
// TODO: Auto-generated Javadoc
46
/**
47
 * The Class CAH.
48
 * 
49
 * @author mdecorde
50
 *
51
 */
52
public class CAH extends Function implements TXMResult
53
{
54
	/** The metric. */
55
	String metric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$
56

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

  
60
	/** The N cluster. */
61
	int NCluster = 3;
62

  
63
	/** The columns. */
64
	boolean columns = true;
65

  
66
	/** The symbol. */
67
	String symbol = null;
68

  
69
	/** The target. */
70
	String target;
71

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

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

  
79
	/** The name. */
80
	String name;
81

  
82
	/** The display2 d. */
83
	// FIXME : to remove when charts engine will be validated
84
	@Deprecated
85
	boolean display2D;
86

  
87
	// FIXME : to remove when charts engine will be validated
88
	@Deprecated
89
	private File svgFile;
90

  
91

  
92
	/**
93
	 * The coordinates of the clusters.
94
	 */
95
	protected double[][] clusterCoords = null;
96

  
97
	/**
98
	 * The numbers of the clusters.
99
	 */
100
	protected int[] clusterNumbers = null;
101

  
102
	/**
103
	 * The names of the cluster rows.
104
	 */
105
	protected String[] clusterRowNames = null;
106

  
107
	/**
108
	 * The ordered names of the cluster rows.
109
	 */
110
	protected String[] clusterOrderedRowNames = null;
111

  
112
	/**
113
	 * The cluster tree heights.
114
	 */
115
	protected double[] clusterHeights = null;
116

  
117
	/**
118
	 * The cluster tree merges.
119
	 */
120
	protected double[][] clusterMerges = null;
121

  
122
	/**
123
	 * The inertia gains.
124
	 */
125
	protected double[] inertiaGains = null;
126

  
127
	protected CA ca;
128
	protected LexicalTable table;
129

  
130

  
131
	/**
132
	 * Instantiates a new cAH.
133
	 *
134
	 * @param ca the ca
135
	 * @param col the col
136
	 * @param method the method
137
	 * @param metric the metric
138
	 * @param NCluster the n cluster
139
	 * @param display2D the display mode
140
	 */
141
	public CAH(CA ca, boolean col, String method, String metric, int NCluster, Boolean display2D)
142
	{
143
		this.ca = ca;
144
		this.table = ca.getLexicalTable();
145
		this.columns = col;
146
		this.metric = metric;
147
		this.NCluster = NCluster;
148
		this.method = method;
149
		this.display2D = display2D;
150

  
151
		this.source = ca;
152
		this.partition = ca.getPartition();
153
		this.corpus = ca.getCorpus();
154
		this.target = ca.getSymbol();
155
		this.name = ca.getName();
156
	}
157

  
158
	/**
159
	 * Instantiates a new cAH.
160
	 *
161
	 * @param table the table
162
	 * @param col the col
163
	 * @param method the method
164
	 * @param metric the metric
165
	 * @param NCluster the n cluster
166
	 * @param displayMode the display mode
167
	 */
168
	public CAH(LexicalTable table, boolean col, String method, String metric, int NCluster, Boolean display2D)
169
	{
170
		this.columns = col;
171
		this.metric = metric;
172
		this.NCluster = NCluster;
173
		this.method = method;
174
		this.display2D = display2D;
175

  
176
		this.source = table;
177
		this.partition = table.getPartition();
178
		this.corpus = table.getCorpus();
179
		this.target = table.getSymbol();
180
		this.name = table.getName();
181
		this.table = table;
182
	}
183

  
184

  
185
	/**
186
	 * Resets the cached data so the next getter calls will request the values from R.
187
	 */
188
	public void resetCache()	{
189
		this.clusterCoords = null;
190
		this.clusterNumbers = null;
191
		this.clusterRowNames = null;
192
		this.clusterOrderedRowNames = null;
193
		this.clusterHeights = null;
194
		this.clusterMerges = null;
195
	}
196

  
197
	/**
198
	 * Gets the symbol.
199
	 *
200
	 * @return the symbol
201
	 */
202
	public String getSymbol()
203
	{
204
		return symbol;
205
	}
206

  
207
	/**
208
	 * Gets the methods.
209
	 *
210
	 * @return the methods
211
	 */
212
	public static String[] getMethods()
213
	{
214
		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$
215
		return methods;
216
	}
217

  
218
	/**
219
	 * Gets the metrics.
220
	 *
221
	 * @return the metrics
222
	 */
223
	public static String[] getMetrics()
224
	{
225
		String[] metrics = {"euclidean", "manhattan"}; //$NON-NLS-1$ //$NON-NLS-2$
226
		return metrics;
227
	}
228

  
229
	/** The prefix r. */
230
	protected static String prefixR = "FactoMineRAHC"; //$NON-NLS-1$
231

  
232
	/** The nocah. */
233
	protected static int nocah = 1;
234

  
235
	/**
236
	 * Step compute.
237
	 *
238
	 * @throws RWorkspaceException the r workspace exception
239
	 */
240
	public void stepCompute() throws RWorkspaceException
241
	{
242
		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
243

  
244
		String colOrLine = "columns"; //$NON-NLS-1$
245
		if (!columns)
246
			colOrLine ="rows"; //$NON-NLS-1$
247

  
248
		if(symbol == null)	{
249
			symbol = prefixR+(nocah++);
250
		}
251

  
252
		rw.eval("library(FactoMineR)"); //$NON-NLS-1$
253

  
254
		if (source instanceof LexicalTable)
255
		{
256
			// PCA("+target+", scale.unit = FALSE, ncp = Inf, graph = FALSE)
257
		rw.eval(symbol +" <- HCPC(PCA("+target+", scale.unit = FALSE, ncp = Inf, graph = FALSE)" + //$NON-NLS-1$ //$NON-NLS-2$
258
				", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
259
				", nb.clust="+NCluster + //$NON-NLS-1$
260
				", metric=\""+metric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
261
				", method=\""+method+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
262
				", graph=FALSE)"); //$NON-NLS-1$
263
		}
264
		else
265
		{
266
			rw.eval(symbol +" <- HCPC("+target + //$NON-NLS-1$
267
					", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
268
					", nb.clust="+NCluster + //$NON-NLS-1$
269
					", metric=\""+metric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
270
					", method=\""+method+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
271
					", graph=FALSE)"); //$NON-NLS-1$
272
		}
273

  
274
		// Reset the cached data
275
		this.resetCache();
276
	}
277

  
278
	/**
279
	 *
280
	 * @param outfile
281
	 * @param encoding
282
	 * @return
283
	 */
284
	public boolean toTxt(File outfile, String encoding)	{
285
		boolean ret = true;
286
		acquireSemaphore();
287
		RWorkspace rw;
288
		try {
289
			rw = RWorkspace.getRWorkspaceInstance();
290
			rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
291
			rw.eval("print("+symbol+"$call)"); //$NON-NLS-1$ //$NON-NLS-2$
292
			rw.eval("sink()"); //$NON-NLS-1$
293
		} catch (RWorkspaceException e) {
294
			// TODO Auto-generated catch block
295
			System.out.println(TBXCAHMessages.CAH_0+e);
296
			org.txm.utils.logger.Log.printStackTrace(e);
297
			ret = false;
298
		} finally {
299
			releaseSemaphore();
300
		}
301
		return true;
302
	}
303

  
304
	public boolean toTxt(File outfile, String encoding, String colsep, String txtsep) {
305
		return toTxt(outfile, encoding);
306
	}
307

  
308
	/**
309
	 * Gets the name.
310
	 *
311
	 * @return the name
312
	 */
313
	public String getName() {
314
		return name;
315
	}
316

  
317
	/**
318
	 * Gets the source.
319
	 *
320
	 * @return the source
321
	 */
322
	public Object getSource()	{
323
		return source;
324
	}
325

  
326
	/**
327
	 * Gets the partition.
328
	 *
329
	 * @return the partition
330
	 */
331
	public Partition getPartition() {
332
		return partition;
333
	}
334

  
335
	/**
336
	 * Gets the corpus.
337
	 * @return the corpus
338
	 */
339
	public Corpus getCorpus() {
340
		return corpus;
341
	}
342

  
343
	@Deprecated
344
	public File getSVGFile() {
345
		return svgFile;
346
	}
347

  
348
	/**
349
	 * Gets the default method.
350
	 *
351
	 * @return the default method
352
	 */
353
	public static String getDefaultMethod() {
354
		return "ward"; //$NON-NLS-1$
355
	}
356

  
357
	/**
358
	 * Gets the default metric.
359
	 *
360
	 * @return the default metric
361
	 */
362
	public static String getDefaultMetric() {
363
		return "euclidean"; //$NON-NLS-1$
364
	}
365

  
366
	@Override
367
	public void clean() {
368
		// TODO Auto-generated method stub
369

  
370
	}
371

  
372

  
373

  
374
	/**
375
	 * Gets the clusters coordinates.
376
	 * @return the clusters coordinates
377
	 */
378
	public double[][] getClusterCoords() {
379
		if (this.clusterCoords == null) {
380
			try {
381

  
382
				// FIXME: check this code for the CAH 3D chart implementation
383
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
384
				for(int i = 0; i < 2; i++) { // 2 dimensions
385
					REXP sv = rw.extractItemFromListByName(symbol, "data.clust[,"+ (i + 1)+ "]"); //$NON-NLS-1$
386
					 double[] coords = RWorkspace.toDouble(sv);
387
					 for(int j = 0; j < coords.length; j++) {
388
						 if(this.clusterCoords  == null)	{
389
							 this.clusterCoords = new double[coords.length][2];
390
						 }
391
						this.clusterCoords[j][i] = coords[j];
392
					}
393
				}
394
			}
395
			catch (Exception e) {
396
				// TODO Auto-generated catch block
397
				org.txm.utils.logger.Log.printStackTrace(e);
398
			}
399
		}
400
		return this.clusterCoords;
401
	}
402

  
403

  
404
	/**
405
	 * Gets the clusters numbers.
406
	 * @return
407
	 */
408
	public int[] getClusterNumbers() {
409
		if (this.clusterNumbers == null) {
410
			try {
411
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
412
				// FIXME: not sorted version
413
				REXP sv = rw.extractItemFromListByName(symbol, "data$clust"); //$NON-NLS-1$
414
				// FIXME: sorted version
415
				//REXP sv = rw.extractItemFromListByName(symbol, "data$clust[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
416
				this.clusterNumbers = sv.asIntegers();
417
			}
418
			catch (Exception e) {
419
				// TODO Auto-generated catch block
420
				org.txm.utils.logger.Log.printStackTrace(e);
421
			}
422
		}
423
		return this.clusterNumbers;
424
	}
425

  
426
	/**
427
	 * Gets the cluster row names.
428
	 * @return
429
	 */
430
	public String[] getClusterRowNames() {
431
		if (this.clusterRowNames == null) {
432
			try {
433
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
434

  
435
				// FIXME: old method, Save the row names in the R data frame
436
//				rw.safeEval(symbol + "$rownames <- rownames(" + symbol + "$data)");
437
//				REXP sv = rw.extractItemFromListByName(symbol, "rownames"); //$NON-NLS-1$
438

  
439

  
440
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels"); //$NON-NLS-1$
441

  
442

  
443
				this.clusterRowNames = sv.asStrings();
444

  
445
			}
446
			catch (Exception e) {
447
				// TODO Auto-generated catch block
448
				org.txm.utils.logger.Log.printStackTrace(e);
449
			}
450
		}
451
		return this.clusterRowNames;
452
	}
453

  
454

  
455

  
456
	/**
457
	 * Gets the cluster orderer row names.
458
	 * @return
459
	 */
460
	public String[] getClusterOrderedRowNames() {
461
		if (this.clusterOrderedRowNames == null) {
462
			try {
463
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
464
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
465
				this.clusterOrderedRowNames = sv.asStrings();
466
			}
467
			catch (Exception e) {
468
				// TODO Auto-generated catch block
469
				org.txm.utils.logger.Log.printStackTrace(e);
470
			}
471
		}
472
		return this.clusterOrderedRowNames;
473
	}
474

  
475

  
476
	/**
477
	 * Gets the cluster tree heights.
478
	 * @return
479
	 */
480
	public double[] getClusterTreeHeights() {
481
		if (this.clusterHeights == null) {
482
			try {
483
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
484
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$height"); //$NON-NLS-1$
485
				this.clusterHeights = sv.asDoubles();
486
			}
487
			catch (Exception e) {
488
				// TODO Auto-generated catch block
489
				org.txm.utils.logger.Log.printStackTrace(e);
490
			}
491
		}
492
		return this.clusterHeights;
493
	}
494

  
495

  
496
	/**
497
	 * Gets the inertia gains.
498
	 * @return
499
	 */
500
	// FIXME: for test purpose, this method is not used for the chart computing
501
	public double[] getInertiaGains() {
502
		if (this.inertiaGains == null) {
503
			try {
504
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
505
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$inert.gain"); //$NON-NLS-1$
506
				// FIXME: tests
507
	//			REXP sv = rw.extractItemFromListByName(symbol, "call$t$within"); //$NON-NLS-1$
508

  
509
				this.inertiaGains = sv.asDoubles();
510
			}
511
			catch (Exception e) {
512
				// TODO Auto-generated catch block
513
				org.txm.utils.logger.Log.printStackTrace(e);
514
			}
515
		}
516
		return this.inertiaGains;
517
	}
518

  
519

  
520
	/**
521
	 * Gets the cluster tree merges.
522
	 * @return
523
	 */
524
	public double[][] getClusterTreeMerges() {
525
		if (this.clusterMerges == null) {
526
			try {
527
				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
528
				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$merge"); //$NON-NLS-1$
529
				this.clusterMerges = sv.asDoubleMatrix();
530
			}
531
			catch (Exception e) {
532
				// TODO Auto-generated catch block
533
				org.txm.utils.logger.Log.printStackTrace(e);
534
			}
535
		}
536
		return this.clusterMerges;
537
	}
538

  
539

  
540

  
541

  
542

  
543

  
544
	/**
545
	 * Sets the metric to use for computing.
546
	 * @param metric the metric to set
547
	 */
548
	public void setMetric(String metric) {
549
		this.metric = metric;
550
	}
551

  
552
	/**
553
	 * Sets the method to use for computing
554
	 * @param method the method to set
555
	 */
556
	public void setMethod(String method) {
557
		this.method = method;
558
	}
559

  
560
	/**
561
	 * Sets the computing to columns or rows.
562
	 * @param columns the columns to set
563
	 */
564
	public void setColumnsComputing(boolean columns) {
565
		this.columns = columns;
566
	}
567

  
568
	/**
569
	 * Sets the number of clusters to use for computing
570
	 * @param nCluster the nCluster to set
571
	 */
572
	public void setNCluster(int nCluster) {
573
		NCluster = nCluster;
574
	}
575

  
576
	/**
577
	 * Checks if the computing mode is set as columns. If not, the computing mode is set as rows.
578
	 * @return the columns
579
	 */
580
	public boolean isColumnsComputing() {
581
		return columns;
582
	}
583

  
584
	/**
585
	 * Gets the maximum clusters available according to the current computing mode (columns or rows) and according to current source (<code>CA</code> or <code>LexicalTable</code>).
586
	 * The maximum numbers of available clusters is for now limited to 16 by this method due of a limitation of FactoMineR plot.HCPC().
587
	 * @return the maximum clusters available according to the current computing mode
588
	 */
589
	public int getMaxClustersCount()	{
590

  
591
		int maxClustersCount = -1;
592

  
593
		try {
594
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
595
			REXP sv = rw.eval("min(length(" + symbol + "$data$clust) - 1, 16)"); //$NON-NLS-1$ //$NON-NLS-2$
596
			maxClustersCount = sv.asInteger();
597
		}
598

  
599
		catch(RWorkspaceException e) {
600
			// TODO Auto-generated catch block
601
			e.printStackTrace();
602
		}
603
		catch(REXPMismatchException e) {
604
			// TODO Auto-generated catch block
605
			e.printStackTrace();
606
		}
607

  
608

  
609
		// 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
610
		// the real maximum available clusters count
611
//		// CA
612
//		if(this.source instanceof CA)	{
613
//			if(this.columns == true)	{
614
//				maxClustersCount = ((CA)this.source).getColumnsCount() - 1;
615
//			}
616
//			else	{
617
//				maxClustersCount = ((CA)this.source).getRowsCount() - 1;
618
//			}
619
//		}
620
//		// Lexical table
621
//		else if(this.source instanceof LexicalTable)	{
622
//			if(this.columns == true)	{
623
//				maxClustersCount = ((LexicalTable)this.source).getColumnsCount() - 1;
624
//			}
625
//			else	{
626
//				maxClustersCount = ((LexicalTable)this.source).getRowsCount() - 1;
627
//			}
628
//		}
629

  
630
		return maxClustersCount;
631
	}
632

  
633
	/**
634
	 * @return the display2D
635
	 */
636
	public boolean isDisplay2D() {
637
		return display2D;
638
	}
639

  
640
	@Override
641
	public boolean delete() {
642
		return getParent().removeResult(this);
643
	}
644

  
645
	@Override
646
	public String[] getExportTXTExtensions() {
647
		return new String[]{"*.txt"};
648
	}
649

  
650
	@Override
651
	public HasResults getParent() {
652
		if (ca != null)
653
			return ca;
654
		return table;
655
	}
656

  
657
	/**
658
	 * Returns the number of clusters.
659
	 * @return the nCluster
660
	 */
661
	public int getNCluster() {
662
		return NCluster;
663
	}
664

  
665
	public CA getCA() {
666
		return ca;
667
	}
668
	
669
	public LexicalTable getLexicalTable() {
670
		return table;
671
	}
672
}
0 673

  
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/package.html (revision 134)
1
<html>
2
<body>
3
<p>Classifcation using FactoMineR's CAH.</p>
4
</body>
5
</html>
0 6

  
tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCCAHChartCreator.java (revision 134)
1
package org.txm.cah.core.chartsengine.jfreechart;
2

  
3
import org.jfree.chart.JFreeChart;
4
import org.txm.cah.core.functions.CAH;
5
import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
6

  
7
/**
8
 * 
9
 * @author mdecorde
10
 * 
11
 * TODO: not done
12
 *
13
 */
14
public class JFCCAHChartCreator extends JFCChartCreator {
15

  
16
	public JFCCAHChartCreator() {
17
		// TODO Auto-generated constructor stub
18
	}
19

  
20
	@Override
21
	public JFreeChart createChart(Object resultData, String preferencesNode) {
22

  
23
		final CAH cah = (CAH) resultData;
24
		
25
		
26
		return null;
27
		
28
	}
29

  
30

  
31
	@Override
32
	public Class getResultDataClass() {
33
		return CAH.class;
34
	}
35

  
36

  
37

  
38

  
39

  
40
	
41

  
42
}
0 43

  
tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RCAHChartCreator.java (revision 134)
1
package org.txm.cah.core.chartsengine.r;
2

  
3
import java.io.File;
4

  
5
import org.txm.cah.core.functions.CAH;
6
import org.txm.chartsengine.r.core.RChartCreator;
7
import org.txm.chartsengine.r.core.RChartsEngine;
8

  
9
public class RCAHChartCreator extends RChartCreator {
10

  
11
	public RCAHChartCreator() {
12
		// TODO Auto-generated constructor stub
13
	}
14

  
15
	@Override
16
	public Object createChart(Object resultData, String preferencesNode) {
17
		// TODO Auto-generated method stub
18
		return null;
19
	}
20
	
21

  
22
	public String createCAH2dChartFile(CAH cah) {
23
		return "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\")";
24
	}
25

  
26
	public String createCAH3dChartFile(CAH cah) {
27
		return "plot.HCPC("+ cah.getSymbol() +", new.plot=FALSE)";
28
	}
29

  
30
	@Override
31
	public File createChartFile(Object resultData, File file, String preferencesNode) {
32

  
33
		try {
34
			CAH cah = (CAH) resultData;
35
			
36
			// parameters
37
//			int maxWords = TXMPreferences.getInt(preferencesNode, resultData, WordCloudPreferences.MAX_WORDS);
38
//			int minFreq = TXMPreferences.getInt(preferencesNode, resultData, WordCloudPreferences.FMIN);
39
//			float rotPer = TXMPreferences.getFloat(preferencesNode, resultData, WordCloudPreferences.ROT);
40
//			boolean randomOrder = TXMPreferences.getBoolean(preferencesNode, resultData, WordCloudPreferences.RANDOM_POSITION);
41
			
42
			String cmd = null;
43
			if (cah.isDisplay2D()) {
44
				cmd = createCAH2dChartFile(cah);
45
			} else {
46
				cmd = createCAH3dChartFile(cah);
47
			}
48
			
49
			((RChartsEngine) this.chartsEngine).plot(file, cmd);
50
		}
51
		catch(Exception e) {
52
			// TODO Auto-generated catch block
53
			e.printStackTrace();
54
		}
55
		
56
		return file;
57
	}
58

  
59
	
60
	@Override
61
	// FIXME: to not load the chart creator, to remove when implemented 
62
	public Class getChartsEngineClass() {
63
		return null;
64
	}
65
	
66
	@Override
67
	public Class getResultDataClass() {
68
		return CAH.class;
69
	}
70

  
71

  
72

  
73
}
0 74

  
tmp/org.txm.cah.core/build.properties (revision 134)
1 1
source.. = src/
2 2
output.. = bin/
3 3
bin.includes = META-INF/,\
4
               .
4
               .,\
5
               plugin.xml
tmp/org.txm.cah.core/plugin.xml (revision 134)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         point="org.txm.chartsengine.chartcreator">
6
      <ChartCreator
7
            class="org.txm.cah.core.chartsengine.jfreechart.JFCCAHChartCreator"
8
            fileNamePrefix="cah_">
9
      </ChartCreator>
10
      <ChartCreator
11
            class="org.txm.cah.core.chartsengine.r.RCAHChartCreator"
12
            fileNamePrefix="cah_">
13
      </ChartCreator>
14
   </extension>
15
   <extension
16
         point="org.eclipse.core.runtime.preferences">
17
      <initializer
18
            class="org.txm.cah.core.preferences.CAHPreferences">
19
      </initializer>
20
   </extension>
21

  
22
</plugin>
0 23

  
tmp/org.txm.cah.core/META-INF/MANIFEST.MF (revision 134)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: CAH TBX
4
Bundle-SymbolicName: org.txm.cah.core
4
Bundle-SymbolicName: org.txm.cah.core;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-Activator: org.txm.cah.core.Activator
7 7
Require-Bundle: org.eclipse.ui,
......
13 13
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
14 14
Bundle-ActivationPolicy: lazy
15 15
Export-Package: org.txm.cah.core,
16
 org.txm.cah.functions
16
 org.txm.cah.core.chartsengine.jfreechart,
17
 org.txm.cah.core.chartsengine.r,
18
 org.txm.cah.core.functions,
19
 org.txm.cah.core.messages,
20
 org.txm.cah.core.preferences
tmp/org.txm.cah.rcp/META-INF/MANIFEST.MF (revision 134)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: CAH RCP
4
Bundle-SymbolicName: org.txm.cah.rcp
4
Bundle-SymbolicName: org.txm.cah.rcp;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-Activator: org.txm.cah.rcp.Activator
7 7
Require-Bundle: org.txm.chartsengine.rcp;bundle-version="1.0.0",
......
19 19
 org.txm.chartsengine.svgbatik.rcp;bundle-version="1.0.0"
20 20
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
21 21
Bundle-ActivationPolicy: lazy
22
Export-Package: org.txm.cah.rcp.chartsengine.jfreechart.events,
23
 org.txm.cah.rcp.editors
22
Export-Package: org.txm.cah.rcp,
23
 org.txm.cah.rcp.adapters,
24
 org.txm.cah.rcp.chartsengine.jfreechart.events,
25
 org.txm.cah.rcp.commands,
26
 org.txm.cah.rcp.editors,
27
 org.txm.cah.rcp.messages,
28
 org.txm.cah.rcp.preferences
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/commands/ComputeCAH.java (revision 134)
53 53
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
54 54
import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider;
55 55
import org.txm.functions.ca.CA;
56
import org.txm.cah.functions.CAH;
56
import org.txm.cah.core.functions.CAH;
57
import org.txm.cah.core.preferences.CAHPreferences;
57 58
import org.txm.cah.rcp.editors.CAHChartEditor;
59
import org.txm.cah.rcp.messages.RCPCAHMessages;
58 60
import org.txm.rcpapplication.IImageKeys;
59 61
import org.txm.rcpapplication.JobsTimer;
60 62
import org.txm.rcpapplication.Messages;
61 63
import org.txm.rcpapplication.TxmPreferences;
62 64
import org.txm.rcpapplication.actions.LexicalTableDialog;
63
import org.txm.rcpapplication.preferences.CAHPreferencePage;
64 65
import org.txm.rcpapplication.preferences.CAPreferencePage;
65 66
import org.txm.rcpapplication.utils.JobHandler;
66 67
import org.txm.rcpapplication.views.CorporaView;
......
96 97

  
97 98

  
98 99
		if (!Toolbox.isStatEngineInitialized()) {
99
			System.out.println(Messages.ComputeCAH_4);
100
			System.out.println(RCPCAHMessages.ComputeCAH_4);
100 101
			return null;
101 102
		}
102 103

  
......
133 134
			//System.out.println("Compute CAH with Partition : "+((Partition)selection.getFirstElement()).getName());
134 135
			partition = (Partition)selection.getFirstElement();
135 136
			try {
136
				String title = Messages.bind(Messages.ComputeCAH_0, partition.getName());
137
				String title = RCPCAHMessages.bind(RCPCAHMessages.ComputeCAH_0, partition.getName());
137 138
				int vmax = TxmPreferences.getInt(CAPreferencePage.VMAX, 200);
138 139
				int fmin = TxmPreferences.getInt(CAPreferencePage.FMIN, 10);
139 140
				Shell shell = Display.getCurrent().getActiveShell();
......
163 164
			} 
164 165
		}
165 166

  
166
		final int ncluster = TxmPreferences.getInt(CAHPreferencePage.NCLUSTER, 2);
167
		final String metric = TxmPreferences.getString(CAHPreferencePage.METRIC, CAH.getDefaultMetric());
168
		final String method = TxmPreferences.getString(CAHPreferencePage.METHOD, CAH.getDefaultMethod());
169
		final Boolean display2D = "2D".equals(TxmPreferences.getString(CAHPreferencePage.DISPLAY, "3D")); //$NON-NLS-1$ //$NON-NLS-2$
167
		final int ncluster = TxmPreferences.getInt(CAHPreferences.NCLUSTER, 2);
168
		final String metric = TxmPreferences.getString(CAHPreferences.METRIC, CAH.getDefaultMetric());
169
		final String method = TxmPreferences.getString(CAHPreferences.METHOD, CAH.getDefaultMethod());
170
		final Boolean display2D = "2D".equals(TxmPreferences.getString(CAHPreferences.DISPLAY, "3D")); //$NON-NLS-1$ //$NON-NLS-2$
170 171
		final boolean computeColumns = true;
171 172

  
172 173
		// Use existent CAH (used when reopening an editor from a CAH result node)
......
198 199
	 */
199 200
	public static void compute(final CAH cah, final ChartEditorPart chartEditor) throws RWorkspaceException {
200 201

  
201
		JobHandler jobhandler = new JobHandler(Messages.CAHEditor_0) {
202
		JobHandler jobhandler = new JobHandler(RCPCAHMessages.CAHEditor_0) {
202 203
			@Override
203 204
			protected IStatus run(IProgressMonitor monitor) {
204 205
				this.runInit(monitor);
......
320 321
////
321 322
////		if (d.open() == Window.OK) {
322 323
////			final int ncluster = d.getNcluster();
323
////			final String metric = TxmPreferences.getString(CAHPreferencePage.METRIC, CAH.getDefaultMetric());
324
////			final String method = TxmPreferences.getString(CAHPreferencePage.METHOD, CAH.getDefaultMethod());
325
////			final Boolean displayMode = TxmPreferences.getBoolean(CAHPreferencePage.DISPLAY, false);
324
////			final String metric = TxmPreferences.getString(CAHPreferences.METRIC, CAH.getDefaultMetric());
325
////			final String method = TxmPreferences.getString(CAHPreferences.METHOD, CAH.getDefaultMethod());
326
////			final Boolean displayMode = TxmPreferences.getBoolean(CAHPreferences.DISPLAY, false);
326 327
////			final boolean docol = d.isDoculumns();
327 328
////
328
////			JobHandler jobhandler = new JobHandler(Messages.ComputeCAH_3+ca.getName()) {
329
////			JobHandler jobhandler = new JobHandler(RCPCAHMessages.ComputeCAH_3+ca.getName()) {
329 330
////				@Override
330 331
////				protected IStatus run(IProgressMonitor monitor) {
331 332
////					try {
332 333
////						JobsTimer.start();
333 334
////						monitor.beginTask("", 100); //$NON-NLS-1$
334 335
////
335
////						monitor.subTask(Messages.ComputeCAH_0);
336
////						monitor.subTask(RCPCAHMessages.ComputeCAH_0);
336 337
////
337 338
////						final CAH cah;
338 339
////						if (ca != null) {
......
349 350
////
350 351
////						monitor.worked(20);
351 352
////
352
////						monitor.subTask(Messages.ComputeCAH_1);
353
////						monitor.subTask(RCPCAHMessages.ComputeCAH_1);
353 354
////
354 355
////						syncExec(new Runnable() {
355 356
////							@Override
......
363 364
////								try {
364 365
////									outfile = File.createTempFile("cah", device.getExt(), resultDir); //$NON-NLS-1$
365 366
////									if (!outfile.canWrite()) {
366
////										System.out.println(NLS.bind(Messages.ComputeCAH_2, outfile));
367
////										System.out.println(NLS.bind(RCPCAHMessages.ComputeCAH_2, outfile));
367 368
////									}
368 369
////								} catch (IOException e1) {
369 370
////									// TODO Auto-generated catch block
......
435 436
		 */
436 437
		public CAHParamDialog(Shell parentShell) {
437 438
			super(parentShell);
438
			this.title = Messages.CAHEditorTitle;
439
			this.title = RCPCAHMessages.CAHEditorTitle;
439 440
		}
440 441

  
441 442
		/* (non-Javadoc)
......
448 449
			if (title != null)
449 450
				newShell.setText(title);
450 451
			else
451
				newShell.setText(Messages.CAHEditorTitle);
452
				newShell.setText(RCPCAHMessages.CAHEditorTitle);
452 453
		}
453 454

  
454 455
		/** The composite. */
......
477 478

  
478 479
			// N CLUSTERS
479 480
			Label label = new Label(composite, SWT.NONE);
480
			label.setText(Messages.CAHPreferencePage_2);
481
			label.setText(RCPCAHMessages.CAHPreferencePage_2);
481 482

  
482 483
			nclusterSpinner = new Spinner(composite, SWT.BORDER);
483 484
			nclusterSpinner.setMinimum(2);
484 485
			nclusterSpinner.setIncrement(1);
485
			nclusterSpinner.setSelection(TxmPreferences.getInt(CAHPreferencePage.NCLUSTER, 2));
486
			nclusterSpinner.setSelection(TxmPreferences.getInt(CAHPreferences.NCLUSTER, 2));
486 487
			nclusterSpinner.setMaximum(50);
487 488

  
488 489
			// ROWS OR COLS
489 490
			docolumnsButton = new Button(composite, SWT.RADIO);
490
			docolumnsButton.setText(Messages.ComputeClassification_5);
491
			docolumnsButton.setText(RCPCAHMessages.ComputeClassification_5);
491 492
			docolumnsButton.setSelection(true);
492 493

  
493 494
			Button dorowsButton = new Button(composite, SWT.RADIO);
494
			dorowsButton.setText(Messages.ComputeClassification_6);
495
			dorowsButton.setText(RCPCAHMessages.ComputeClassification_6);
495 496

  
496 497
			/*
497 498
			// METHODS
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/CAHPreferencePage.java (revision 134)
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.cah.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.BooleanFieldEditor;
31
import org.eclipse.jface.preference.ComboFieldEditor;
32
import org.eclipse.jface.preference.IntegerFieldEditor;
33
import org.eclipse.jface.preference.RadioGroupFieldEditor;
34
import org.eclipse.swt.widgets.Composite;
35
import org.eclipse.swt.widgets.Group;
36
import org.eclipse.ui.IWorkbench;
37
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
38
import org.txm.cah.core.functions.CAH;
39
import org.txm.cah.core.preferences.CAHPreferences;
40
import org.txm.cah.rcp.adapters.CAHAdapterFactory;
41
import org.txm.cah.rcp.messages.RCPCAHMessages;
42
import org.txm.rcp.preferences.TXMPreferencePage;
43
import org.txm.rcp.preferences.TXMPreferenceStore;
44
import org.txm.rcpapplication.Messages;
45
import org.txm.rcpapplication.TxmPreferences;
46
import org.txm.rcpapplication.jface.DoubleFieldEditor;
47
// TODO: Auto-generated Javadoc
48
/**
49
 * This class represents a preference page that is contributed to the
50
 * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we
51
 * can use the field support built into JFace that allows us to create a page
52
 * that is small and knows how to save, restore and apply itself.
53
 * <p>
54
 * This page is used to modif y preferences only. They are stored in the
55
 * preference store that belongs to the main plug-in class. That way,
56
 * preferences can be accessed directly via the preference store.
57
 */
58

  
59
public class CAHPreferencePage extends TXMPreferencePage {
60

  
61

  
62
	/**
63
	 * Instantiates a new cah preference page.
64
	 */
65
	public CAHPreferencePage() {
66
		super();
67
	}
68

  
69
	
70
	/**
71
	 * 
72
	 * @return
73
	 */
74
	public static TXMPreferenceStore getNewPreferenceStore()	{
75
		return new TXMPreferenceStore(CAHPreferences.PREFERENCES_NODE);
76
	}
77

  
78
	
79
	/**
80
	 * Creates the field editors. Field editors are abstractions of the common
81
	 * GUI blocks needed to manipulate various types of preferences. Each field
82
	 * editor knows how to save and restore itself.
83
	 */
84
	@Override
85
	public void createFieldEditors() {
86

  
87
		
88
		IntegerFieldEditor defaultncluster = new IntegerFieldEditor(CAHPreferences.NCLUSTER,
89
				RCPCAHMessages.CAHPreferencePage_2, getFieldEditorParent());
90
		addField(defaultncluster);
91

  
92
		String list[] = CAH.getMethods(); 
93
		String methods[][] = new String[list.length][2];
94
		for(int i = 0 ; i < list.length ; i++)
95
			methods[i][0] = methods[i][1] = list[i];
96
				
97
		ComboFieldEditor defaultmethod = new ComboFieldEditor(CAHPreferences.METHOD,
98
				RCPCAHMessages.CAHPreferencePage_3, methods, getFieldEditorParent());
99
		addField(defaultmethod);
100

  
101
		list = CAH.getMetrics(); 
102
		String metrics[][] = new String[list.length][2];
103
		for(int i = 0 ; i < list.length ; i++)
104
			metrics[i][0] = metrics[i][1] = list[i];
105
		
106
		ComboFieldEditor defaultmetric = new ComboFieldEditor(CAHPreferences.METRIC,
107
				RCPCAHMessages.CAHPreferencePage_4, metrics, getFieldEditorParent());
108
		addField(defaultmetric);
109
		
110
		
111
		// Charts
112
		Group chartsGroup = SWTChartsComponentsProvider.createChartsRenderingPreferencesGroup(getFieldEditorParent());
113

  
114
		// FIXME : these preferences should be renamed and moved to charts engine preference level (associated messages too)
115
		String[][] labelAndValues = {{"2D", "2D"}, {"3D", "3D"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
116
		RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(CAHPreferences.DISPLAY, RCPCAHMessages.CAHPreferencePage_0, 2, labelAndValues, chartsGroup);
117
		addField(default2D3Ddisplay);
118
		
119
		
120
		
121

  
122
	}
123

  
124
	@Override
125
	public void init(IWorkbench workbench) {
126
		this.setPreferenceStore(getNewPreferenceStore());
127
		//setDescription("CAH");
128
		this.setTitle(RCPCAHMessages.CAHPreferencePage_2);
129
		this.setImageDescriptor(CAHAdapterFactory.ICON);
130
	}
131

  
132
}
0 133

  
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages.properties (revision 134)
1
CAHPreferencePage_0=Display graphics in
2
CAHPreferencePage_1=Classification
3
CAHPreferencePage_2=Number of clusters
4
CAHPreferencePage_3=Method
5
CAHPreferencePage_4=Metric
0 6

  
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/adapters/CAHAdapterFactory.java (revision 134)
1
// Copyright © 2010-2013 ENS de Lyon.
2
package org.txm.cah.rcp.adapters;
3

  
4
import org.eclipse.jface.resource.ImageDescriptor;
5
import org.eclipse.ui.model.IWorkbenchAdapter;
6
import org.eclipse.ui.plugin.AbstractUIPlugin;
7
import org.osgi.framework.FrameworkUtil;
8
import org.txm.cah.core.functions.CAH;
9
import org.txm.rcp.adapters.BaseAdapterFactory;
10

  
11
/**
12
 * A factory for creating Adapter objects.
13
 *  
14
 * @author mdecorde
15
 * @author sjacquot
16
 */
17
public class CAHAdapterFactory extends BaseAdapterFactory {
18

  
19
	
20
	public static final ImageDescriptor ICON =
21
			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(CAHAdapterFactory.class).getSymbolicName(),
22
					"platform:/plugin/"+ FrameworkUtil.getBundle(CAHAdapterFactory.class).getSymbolicName() + "/icons/functions/cah.png"); //$NON-NLS-1$
23
	
24
	/**
25
	 * Gets the adapter.
26
	 *
27
	 * @param adaptableObject the adaptable object
28
	 * @param adapterType the adapter type
29
	 * @return the adapter
30
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
31
	 */
32
	@Override
33
	public Object getAdapter(Object adaptableObject, Class adapterType) {
34
		
35
		if(adapterType == IWorkbenchAdapter.class)	{
36
			if(adaptableObject instanceof CAH)	{
37
				return new IWorkbenchAdapter() {
38
					@Override
39
					public Object[] getChildren(Object resultData) {
40
						return new Object[0];
41
					}
42
	
43
					@Override
44
					public ImageDescriptor getImageDescriptor(Object object) {
45
						return ICON;
46
					}
47
	
48
					@Override
49
					public String getLabel(Object resultData) {
50
						return ((CAH) resultData).getName(); 
51
					}
52
	
53
					@Override
54
					public Object getParent(Object resultData) {
55
						return ((CAH) resultData).getCorpus();
56
					}
57
				};
58
			}
59
		}
60
		return null;
61
	}
62

  
63

  
64
}
0 65

  
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/RCPCAHMessages.java (revision 134)
1
package org.txm.cah.rcp.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMMessages;
5

  
6
public class RCPCAHMessages extends NLS {
7

  
8
	// FIXME: use the same properties file than the bundle
9
	private static final String BUNDLE_NAME = "l10n.bundle"; //$NON-NLS-1$
10
	public static String CAHPreferencePage_0;
11
	public static String CAHPreferencePage_2;
12
	public static String CAHPreferencePage_3;
13
	public static String CAHPreferencePage_4;
14
	
15
	public static String CAHEditor_0;
16
	
17
	public static String ComputeCAH_0;
18
	public static String ComputeCAH_1;
19
	public static String ComputeCAH_2;
20
	public static String ComputeCAH_3;
21

  
22
	public static String ComputeCAH_4;
23

  
24
	public static String ComputeCAH_5;
25

  
26
	public static String ComputeCAH_6;
27
	public static String ComputeClassification_5;
28
	public static String ComputeClassification_6;
29
	
30
	public static String CAHEditorTitle;
31
	
32
	static {
33
		// initializes resource bundle
34
		TXMMessages.initializeMessages(BUNDLE_NAME, RCPCAHMessages.class);
35
		//NLS.initializeMessages(BUNDLE_NAME, RCPProgressionMessages.class);
36
	}
37
	
38
	private RCPCAHMessages() {
39
	}
40
}
0 41

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff