Révision 282
tmp/org.txm.ca.rcp/plugin.xml (revision 282) | ||
---|---|---|
124 | 124 |
name="%page.name"> |
125 | 125 |
</page> |
126 | 126 |
</extension> |
127 |
<extension |
|
128 |
point="org.eclipse.core.expressions.definitions"> |
|
129 |
<definition |
|
130 |
id="OneICAComputableSelected"> |
|
131 |
<with |
|
132 |
variable="selection"> |
|
133 |
<iterate |
|
134 |
ifEmpty="false" |
|
135 |
operator="and"> |
|
136 |
<instanceof |
|
137 |
value="org.txm.ca.core.functions.ICAComputable"> |
|
138 |
</instanceof> |
|
139 |
</iterate> |
|
140 |
</with> |
|
141 |
</definition> |
|
142 |
<definition |
|
143 |
id="OneCASelected"> |
|
144 |
<with |
|
145 |
variable="selection"> |
|
146 |
<iterate |
|
147 |
ifEmpty="false" |
|
148 |
operator="and"> |
|
149 |
<instanceof |
|
150 |
value="org.txm.ca.core.functions.CA"> |
|
151 |
</instanceof> |
|
152 |
</iterate> |
|
153 |
</with> |
|
154 |
</definition> |
|
155 |
</extension> |
|
127 | 156 |
|
128 | 157 |
</plugin> |
tmp/org.txm.ca.rcp/META-INF/MANIFEST.MF (revision 282) | ||
---|---|---|
11 | 11 |
org.txm.rcp, |
12 | 12 |
org.eclipse.ui;bundle-version="3.106.1", |
13 | 13 |
org.eclipse.core.runtime;bundle-version="3.10.0", |
14 |
org.txm.lexicaltable.core;bundle-version="1.0.0" |
|
14 |
org.txm.lexicaltable.core;bundle-version="1.0.0", |
|
15 |
org.eclipse.core.expressions;bundle-version="3.4.600" |
|
15 | 16 |
Export-Package: org.txm.ca.rcp.adapters, |
16 | 17 |
org.txm.ca.rcp.chartsengine.events, |
17 | 18 |
org.txm.ca.rcp.editors, |
18 | 19 |
org.txm.ca.rcp.handlers, |
19 | 20 |
org.txm.ca.rcp.messages, |
20 | 21 |
org.txm.ca.rcp.preferences |
22 |
Bundle-Vendor: Textometrie.org |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditorInput.java (revision 282) | ||
---|---|---|
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.ca.rcp.editors; |
|
29 |
|
|
30 |
import java.text.DecimalFormat; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.Arrays; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
36 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
37 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
|
38 |
import org.eclipse.jface.viewers.LabelProvider; |
|
39 |
import org.eclipse.jface.viewers.Viewer; |
|
40 |
import org.eclipse.swt.graphics.Image; |
|
41 |
import org.eclipse.ui.IEditorInput; |
|
42 |
import org.eclipse.ui.IPersistableElement; |
|
43 |
import org.eclipse.ui.part.EditorPart; |
|
44 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
45 |
import org.txm.ca.core.functions.CA; |
|
46 |
import org.txm.ca.core.preferences.CAPreferences; |
|
47 |
import org.txm.ca.rcp.messages.CAUIMessages; |
|
48 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
|
49 |
import org.txm.chartsengine.rcp.editors.ChartEditorInput; |
|
50 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
|
51 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
52 |
import org.txm.rcpapplication.Application; |
|
53 |
import org.txm.rcpapplication.IImageKeys; |
|
54 |
import org.txm.rcpapplication.Messages; |
|
55 |
import org.txm.rcpapplication.editors.Tablable; |
|
56 |
import org.txm.rcpapplication.editors.input.AbstractTablable; |
|
57 |
import org.txm.rcpapplication.editors.input.FrequencyListContentProvider; |
|
58 |
import org.txm.rcpapplication.editors.input.FrequencyListLabelProvider; |
|
59 |
import org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput; |
|
60 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
61 |
import org.txm.searchengine.cqp.corpus.Property; |
|
62 |
|
|
63 |
|
|
64 |
// TODO: Auto-generated Javadoc |
|
65 |
/** |
|
66 |
* The Class CorrespondanceAnalysisEditorInput. |
|
67 |
* |
|
68 |
*@author sjacquot |
|
69 |
* @author sloiseau |
|
70 |
*/ |
|
71 |
//FIXME: extract all the UI related and move it to CAEditor |
|
72 |
public class CAEditorInput extends TXMResultEditorInput implements IProvidingMultiPageEditorInput { |
|
73 |
|
|
74 |
/** The ca. */ |
|
75 |
private CA ca; |
|
76 |
|
|
77 |
private static String SEPARATOR = "SEPARATOR"; //$NON-NLS-1$ |
|
78 |
|
|
79 |
private static String COL_TYPE = "Double"; //$NON-NLS-1$ |
|
80 |
|
|
81 |
/** The property. */ |
|
82 |
private Property property; |
|
83 |
|
|
84 |
/** The editors. */ |
|
85 |
private List<EditorPart> editors; |
|
86 |
|
|
87 |
/** The inputs. */ |
|
88 |
private List<IEditorInput> inputs; |
|
89 |
|
|
90 |
/** The names. */ |
|
91 |
private List<String> names = Arrays.asList(new String[] { |
|
92 |
CAUIMessages.CorrespondanceAnalysisEditorInput_1, |
|
93 |
CAUIMessages.CorrespondanceAnalysisEditorInput_0, |
|
94 |
CAUIMessages.CorrespondanceAnalysisEditorInput_8, |
|
95 |
CAUIMessages.CorrespondanceAnalysisEditorInput_9, |
|
96 |
CAUIMessages.CorrespondanceAnalysisEditorInput_2 }); |
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
/** |
|
101 |
* Instantiates a new correspondence analysis editor input. |
|
102 |
* |
|
103 |
* @param ca the ca |
|
104 |
* @param partition the partition |
|
105 |
* @param property the property |
|
106 |
*/ |
|
107 |
public CAEditorInput(CA ca, Partition partition, Property property) { |
|
108 |
super(ca); |
|
109 |
this.ca = ca; |
|
110 |
this.property = property; |
|
111 |
|
|
112 |
if(ca == null) { |
|
113 |
throw new IllegalArgumentException(CAUIMessages.CorrespondanceAnalysisEditorInput_3); |
|
114 |
} |
|
115 |
|
|
116 |
// Create the tab-editor |
|
117 |
editors = new ArrayList<EditorPart>(); |
|
118 |
|
|
119 |
// Create the input for each tab-editor |
|
120 |
inputs = new ArrayList<IEditorInput>(); |
|
121 |
|
|
122 |
// Initialize the editor parts and editor inputs |
|
123 |
this.initCAFactorialMapEditor(); |
|
124 |
this.initCASingularValuesTableEditor(); |
|
125 |
this.initRowsTableEditor(); |
|
126 |
this.initColumnsTableEditor(); |
|
127 |
this.initCASingularValuesBarChartEditor(); |
|
128 |
} |
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
/** |
|
136 |
* The Class CASingularValueLabelProvider. |
|
137 |
*/ |
|
138 |
private class CASingularValueLabelProvider extends LabelProvider implements ITableLabelProvider { |
|
139 |
|
|
140 |
|
|
141 |
/** |
|
142 |
* Percent values number format. |
|
143 |
*/ |
|
144 |
protected DecimalFormat percentValuesNumberFormat = new DecimalFormat(new String("0.00")); //$NON-NLS-1$ |
|
145 |
|
|
146 |
|
|
147 |
/* (non-Javadoc) |
|
148 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
|
149 |
*/ |
|
150 |
@Override |
|
151 |
public Image getColumnImage(Object element, int columnIndex) { |
|
152 |
// TODO Auto-generated method stub |
|
153 |
return null; |
|
154 |
} |
|
155 |
|
|
156 |
/* (non-Javadoc) |
|
157 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
|
158 |
*/ |
|
159 |
@Override |
|
160 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
161 |
public String getColumnText(Object element, int columnIndex) { |
|
162 |
DecimalFormat f; |
|
163 |
Object o = ((List<Object>) element).get(columnIndex); |
|
164 |
switch (columnIndex) { |
|
165 |
case 0: // factor |
|
166 |
return o.toString(); |
|
167 |
case 1: // eigenvalue |
|
168 |
if ((Double) o < 1) { |
|
169 |
if ((Double) o < 0.0001) |
|
170 |
f = new DecimalFormat("0.0000E00"); //$NON-NLS-1$ |
|
171 |
else |
|
172 |
f = new DecimalFormat("0.0000"); //$NON-NLS-1$ |
|
173 |
} else { |
|
174 |
f = new DecimalFormat("##########0.0000"); //$NON-NLS-1$ |
|
175 |
} |
|
176 |
// FIXME: printf syntax tests |
|
177 |
//return String.format("%.4f", o); |
|
178 |
return f.format(o); |
|
179 |
case 2: // percent |
|
180 |
case 3: // cumul |
|
181 |
return percentValuesNumberFormat.format(o); |
|
182 |
default: |
|
183 |
return ""; //$NON-NLS-1$ |
|
184 |
} |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
/** |
|
191 |
* Initializes CA factorial map editor. |
|
192 |
*/ |
|
193 |
public void initCAFactorialMapEditor() { |
|
194 |
|
|
195 |
// Editor part |
|
196 |
ChartEditorPart caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput(ca, CAPreferences.PREFERENCES_NODE)); |
|
197 |
editors.add(caFactorialMapEditorPart); |
|
198 |
|
|
199 |
// Editor input |
|
200 |
inputs.add(caFactorialMapEditorPart.getEditorInput()); |
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
/** |
|
207 |
* Initializes CA singular values bar chart editor. |
|
208 |
*/ |
|
209 |
public void initCASingularValuesBarChartEditor() { |
|
210 |
|
|
211 |
// Editor part |
|
212 |
EditorPart caSingularValuesEditorPart = SWTChartsComponentsProvider.getCurrent().createChartEditor(ca, CAPreferences.PREFERENCES_NODE, "Singular Values"); //$NON-NLS-1$ |
|
213 |
editors.add(caSingularValuesEditorPart); |
|
214 |
|
|
215 |
// Editor input |
|
216 |
inputs.add(caSingularValuesEditorPart.getEditorInput()); |
|
217 |
} |
|
218 |
|
|
219 |
|
|
220 |
/** |
|
221 |
* Initializes CA singular values table editor. |
|
222 |
*/ |
|
223 |
public void initCASingularValuesTableEditor() { |
|
224 |
// Editor part |
|
225 |
editors.add(new SingularValuesEditor()); |
|
226 |
|
|
227 |
// Editor input |
|
228 |
Tablable table = new AbstractTablable() { |
|
229 |
@Override |
|
230 |
public String[] getColumnTitles() { |
|
231 |
return new String[] { |
|
232 |
CAUIMessages.CorrespondanceAnalysisEditorInput_4, |
|
233 |
CAUIMessages.CorrespondanceAnalysisEditorInput_5, |
|
234 |
"%", CAUIMessages.CorrespondanceAnalysisEditorInput_11 + "%", "", ""}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
|
235 |
} |
|
236 |
|
|
237 |
@Override |
|
238 |
public String[] getColumnTypes() { |
|
239 |
return new String[] { |
|
240 |
Messages.FrequencyListEditorInput_6, |
|
241 |
COL_TYPE, |
|
242 |
COL_TYPE, |
|
243 |
COL_TYPE, |
|
244 |
COL_TYPE, |
|
245 |
SEPARATOR}; |
|
246 |
} |
|
247 |
|
|
248 |
@Override |
|
249 |
public IStructuredContentProvider getContentProvider() { |
|
250 |
return new IStructuredContentProvider() { |
|
251 |
@Override |
|
252 |
public Object[] getElements(Object inputElement) { |
|
253 |
CA ca = (CA) inputElement; |
|
254 |
List<List<Object>> tabledata = ca.getSingularValuesInfos(); |
|
255 |
return tabledata.toArray(); |
|
256 |
} |
|
257 |
|
|
258 |
@Override |
|
259 |
public void dispose() { |
|
260 |
// TODO Auto-generated method stub |
|
261 |
} |
|
262 |
|
|
263 |
@Override |
|
264 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
265 |
Object newInput) { |
|
266 |
// TODO Auto-generated method stub |
|
267 |
} |
|
268 |
}; |
|
269 |
} |
|
270 |
|
|
271 |
@Override |
|
272 |
public Object getInput() { |
|
273 |
return ca; |
|
274 |
} |
|
275 |
|
|
276 |
@Override |
|
277 |
public LabelProvider getLabelProvider() { |
|
278 |
return new CASingularValueLabelProvider(); |
|
279 |
} |
|
280 |
}; |
|
281 |
|
|
282 |
inputs.add(table); |
|
283 |
} |
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
/** |
|
288 |
* Initializes rows data table editor. |
|
289 |
*/ |
|
290 |
public void initRowsTableEditor() { |
|
291 |
// Editor part |
|
292 |
editors.add(new ColsRowsInfosEditor()); |
|
293 |
|
|
294 |
// Editor input |
|
295 |
Tablable table = new AbstractTablable() { |
|
296 |
|
|
297 |
List<String> coltypes; |
|
298 |
@Override |
|
299 |
public String[] getColumnTitles() { |
|
300 |
return ca.getRowInfosTitles(); |
|
301 |
// new String[]{"Rows"," ","Quality","Mass", "Dist", "Inertia"}; |
|
302 |
} |
|
303 |
|
|
304 |
@Override |
|
305 |
public String[] getColumnTypes() { |
|
306 |
coltypes = new ArrayList<String>(); |
|
307 |
coltypes.add(Messages.FrequencyListEditorInput_6); |
|
308 |
coltypes.add(SEPARATOR); |
|
309 |
coltypes.add(COL_TYPE); |
|
310 |
coltypes.add(COL_TYPE); |
|
311 |
coltypes.add(COL_TYPE); |
|
312 |
coltypes.add(COL_TYPE); |
|
313 |
coltypes.add(COL_TYPE); |
|
314 |
for (int c = 0; c < 3; c++)// seulement les 3 premiers axes |
|
315 |
{ |
|
316 |
coltypes.add(SEPARATOR); |
|
317 |
coltypes.add(COL_TYPE); |
|
318 |
coltypes.add(COL_TYPE); |
|
319 |
} |
|
320 |
coltypes.add(SEPARATOR); |
|
321 |
coltypes.add(COL_TYPE); |
|
322 |
coltypes.add(COL_TYPE); |
|
323 |
coltypes.add(COL_TYPE); |
|
324 |
coltypes.add(SEPARATOR); |
|
325 |
return coltypes.toArray(new String[] {}); |
|
326 |
// new String[]{Messages.FrequencyListEditorInput_6, |
|
327 |
// Messages.SpecificitiesResultEditorInput_11, |
|
328 |
// Messages.SpecificitiesResultEditorInput_11, |
|
329 |
// Messages.SpecificitiesResultEditorInput_11}; |
|
330 |
} |
|
331 |
|
|
332 |
@Override |
|
333 |
public IStructuredContentProvider getContentProvider() { |
|
334 |
|
|
335 |
return new IStructuredContentProvider() { |
|
336 |
@Override |
|
337 |
public Object[] getElements(Object inputElement) { |
|
338 |
|
|
339 |
CA ca = (CA) inputElement; |
|
340 |
return ca.getRowInfos(); |
|
341 |
} |
|
342 |
|
|
343 |
@Override |
|
344 |
public void dispose() { |
|
345 |
// TODO Auto-generated method stub |
|
346 |
} |
|
347 |
|
|
348 |
@Override |
|
349 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
350 |
Object newInput) { |
|
351 |
// TODO Auto-generated method stub |
|
352 |
} |
|
353 |
}; |
|
354 |
} |
|
355 |
|
|
356 |
@Override |
|
357 |
public Object getInput() { |
|
358 |
return ca; |
|
359 |
} |
|
360 |
|
|
361 |
@Override |
|
362 |
public LabelProvider getLabelProvider() { |
|
363 |
return new ColRowInfosLabelProvider(this.getColumnTitles()); |
|
364 |
} |
|
365 |
}; |
|
366 |
inputs.add(table); |
|
367 |
} |
|
368 |
|
|
369 |
|
|
370 |
/** |
|
371 |
* Initializes columns data table editor. |
|
372 |
*/ |
|
373 |
public void initColumnsTableEditor() { |
|
374 |
// Editor part |
|
375 |
editors.add(new ColsRowsInfosEditor()); |
|
376 |
|
|
377 |
// Editor input |
|
378 |
Tablable table = new AbstractTablable() { |
|
379 |
|
|
380 |
List<String> colnames = new ArrayList<String>(); |
|
381 |
List<String> coltypes = new ArrayList<String>(); |
|
382 |
boolean firstInit = true; |
|
383 |
|
|
384 |
@Override |
|
385 |
public String[] getColumnTitles() { |
|
386 |
return ca.getColInfosTitles(); |
|
387 |
} |
|
388 |
|
|
389 |
@Override |
|
390 |
public String[] getColumnTypes() { |
|
391 |
coltypes = new ArrayList<String>(); |
|
392 |
coltypes.add(Messages.FrequencyListEditorInput_6); |
|
393 |
coltypes.add(SEPARATOR); |
|
394 |
coltypes.add(COL_TYPE); |
|
395 |
coltypes.add(COL_TYPE); |
|
396 |
coltypes.add(COL_TYPE); |
|
397 |
coltypes.add(COL_TYPE); |
|
398 |
coltypes.add(COL_TYPE); |
|
399 |
for (int c = 0; c < 3; c++) { |
|
400 |
coltypes.add(SEPARATOR); |
|
401 |
coltypes.add(COL_TYPE); |
|
402 |
coltypes.add(COL_TYPE); |
|
403 |
} |
|
404 |
coltypes.add(SEPARATOR); |
|
405 |
coltypes.add(COL_TYPE); |
|
406 |
coltypes.add(COL_TYPE); |
|
407 |
coltypes.add(COL_TYPE); |
|
408 |
coltypes.add(SEPARATOR); |
|
409 |
return coltypes.toArray(new String[] {}); |
|
410 |
// new String[]{Messages.FrequencyListEditorInput_6, |
|
411 |
// COL_TYPE, |
|
412 |
// COL_TYPE, |
|
413 |
// COL_TYPE}; |
|
414 |
} |
|
415 |
|
|
416 |
@Override |
|
417 |
public IStructuredContentProvider getContentProvider() { |
|
418 |
|
|
419 |
return new IStructuredContentProvider() { |
|
420 |
@Override |
|
421 |
public Object[] getElements(Object inputElement) { |
|
422 |
CA ca = (CA) inputElement; |
|
423 |
return ca.getColInfos(); |
|
424 |
} |
|
425 |
|
|
426 |
@Override |
|
427 |
public void dispose() { |
|
428 |
// TODO Auto-generated method stub |
|
429 |
} |
|
430 |
|
|
431 |
@Override |
|
432 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
433 |
Object newInput) { |
|
434 |
// TODO Auto-generated method stub |
|
435 |
} |
|
436 |
}; |
|
437 |
} |
|
438 |
|
|
439 |
@Override |
|
440 |
public Object getInput() { |
|
441 |
return ca; |
|
442 |
} |
|
443 |
|
|
444 |
@Override |
|
445 |
public LabelProvider getLabelProvider() { |
|
446 |
return new ColRowInfosLabelProvider(this.getColumnTitles()); |
|
447 |
} |
|
448 |
}; |
|
449 |
inputs.add(table); |
|
450 |
} |
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
/** |
|
455 |
* Exists. |
|
456 |
* |
|
457 |
* @return true, if successful |
|
458 |
* @see org.eclipse.ui.IEditorInput#exists() |
|
459 |
*/ |
|
460 |
@Override |
|
461 |
public boolean exists() { |
|
462 |
return false; |
|
463 |
} |
|
464 |
|
|
465 |
/** |
|
466 |
* Gets the image descriptor. |
|
467 |
* |
|
468 |
* @return the image descriptor |
|
469 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
|
470 |
*/ |
|
471 |
@Override |
|
472 |
public ImageDescriptor getImageDescriptor() { |
|
473 |
return AbstractUIPlugin.imageDescriptorFromPlugin( |
|
474 |
Application.PLUGIN_ID, |
|
475 |
IImageKeys.ACTION_CORRESPONDANCE_ANALYSIS); |
|
476 |
} |
|
477 |
|
|
478 |
/** |
|
479 |
* Gets the persistable. |
|
480 |
* |
|
481 |
* @return the persistable |
|
482 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
|
483 |
*/ |
|
484 |
@Override |
|
485 |
public IPersistableElement getPersistable() { |
|
486 |
return null; |
|
487 |
} |
|
488 |
|
|
489 |
/** |
|
490 |
* Gets the adapter. |
|
491 |
* |
|
492 |
* @param arg0 the arg0 |
|
493 |
* @return the adapter |
|
494 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
|
495 |
*/ |
|
496 |
@Override |
|
497 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
498 |
public Object getAdapter(Class arg0) { |
|
499 |
return null; |
|
500 |
} |
|
501 |
|
|
502 |
/** |
|
503 |
* Gets the cA. |
|
504 |
* |
|
505 |
* @return the Correspondance analysis underlying object |
|
506 |
*/ |
|
507 |
public CA getCA() { |
|
508 |
return ca; |
|
509 |
} |
|
510 |
|
|
511 |
/** |
|
512 |
* Gets the property. |
|
513 |
* |
|
514 |
* @return the property |
|
515 |
*/ |
|
516 |
public Property getProperty() { |
|
517 |
return property; |
|
518 |
} |
|
519 |
|
|
520 |
/** |
|
521 |
* Gets the content provider. |
|
522 |
* |
|
523 |
* @return the content provider |
|
524 |
*/ |
|
525 |
public IStructuredContentProvider getContentProvider() { |
|
526 |
return new FrequencyListContentProvider(); |
|
527 |
} |
|
528 |
|
|
529 |
/** |
|
530 |
* Gets the input. |
|
531 |
* |
|
532 |
* @return the input |
|
533 |
*/ |
|
534 |
public Object getInput() { |
|
535 |
return ca; |
|
536 |
} |
|
537 |
|
|
538 |
/** |
|
539 |
* Gets the label provider. |
|
540 |
* |
|
541 |
* @return the label provider |
|
542 |
*/ |
|
543 |
public LabelProvider getLabelProvider() { |
|
544 |
return new FrequencyListLabelProvider(); |
|
545 |
} |
|
546 |
|
|
547 |
/** |
|
548 |
* Gets the column titles. |
|
549 |
* |
|
550 |
* @return the column titles |
|
551 |
*/ |
|
552 |
public String[] getColumnTitles() { |
|
553 |
return new String[] { Messages.FrequencyListEditorInput_9, |
|
554 |
Messages.FrequencyListEditorInput_4 }; |
|
555 |
} |
|
556 |
|
|
557 |
// Implementing IProvidingMultiPageEditorInput |
|
558 |
/* (non-Javadoc) |
|
559 |
* @see org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput#getEditorInputs() |
|
560 |
*/ |
|
561 |
@Override |
|
562 |
public List<IEditorInput> getEditorInputs() { |
|
563 |
return inputs; |
|
564 |
} |
|
565 |
|
|
566 |
/* (non-Javadoc) |
|
567 |
* @see org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput#getEditors() |
|
568 |
*/ |
|
569 |
@Override |
|
570 |
public List<EditorPart> getEditors() { |
|
571 |
return editors; |
|
572 |
} |
|
573 |
|
|
574 |
/* (non-Javadoc) |
|
575 |
* @see org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput#getNames() |
|
576 |
*/ |
|
577 |
@Override |
|
578 |
public List<String> getNames() { |
|
579 |
return names; |
|
580 |
} |
|
581 |
|
|
582 |
} |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/___CAEditorInput.java (revision 282) | ||
---|---|---|
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.ca.rcp.editors; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
34 |
import org.eclipse.ui.IEditorInput; |
|
35 |
import org.eclipse.ui.IPersistableElement; |
|
36 |
import org.eclipse.ui.part.EditorPart; |
|
37 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
38 |
import org.txm.ca.core.functions.CA; |
|
39 |
import org.txm.ca.rcp.messages.CAUIMessages; |
|
40 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
41 |
import org.txm.rcpapplication.Application; |
|
42 |
import org.txm.rcpapplication.IImageKeys; |
|
43 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
44 |
import org.txm.searchengine.cqp.corpus.Property; |
|
45 |
|
|
46 |
|
|
47 |
// TODO: Auto-generated Javadoc |
|
48 |
/** |
|
49 |
* The Class CorrespondanceAnalysisEditorInput. |
|
50 |
* |
|
51 |
*@author sjacquot |
|
52 |
* @author sloiseau |
|
53 |
*/ |
|
54 |
//FIXME: extract all the UI related and move it to CAEditor |
|
55 |
//FIXME: done, this class should not be useful anymore |
|
56 |
@Deprecated |
|
57 |
public class ___CAEditorInput extends TXMResultEditorInput { |
|
58 |
|
|
59 |
/** The ca. */ |
|
60 |
private CA ca; |
|
61 |
|
|
62 |
/** The property. */ |
|
63 |
private Property property; |
|
64 |
|
|
65 |
/** The editors. */ |
|
66 |
private List<EditorPart> editors; |
|
67 |
|
|
68 |
/** The inputs. */ |
|
69 |
private List<IEditorInput> inputs; |
|
70 |
|
|
71 |
|
|
72 |
/** |
|
73 |
* Instantiates a new correspondence analysis editor input. |
|
74 |
* |
|
75 |
* @param ca the ca |
|
76 |
* @param partition the partition |
|
77 |
* @param property the property |
|
78 |
*/ |
|
79 |
public ___CAEditorInput(CA ca, Partition partition, Property property) { |
|
80 |
super(ca); |
|
81 |
this.ca = ca; |
|
82 |
this.property = property; |
|
83 |
|
|
84 |
if(ca == null) { |
|
85 |
throw new IllegalArgumentException(CAUIMessages.CorrespondanceAnalysisEditorInput_3); |
|
86 |
} |
|
87 |
|
|
88 |
// Create the tab-editor |
|
89 |
editors = new ArrayList<EditorPart>(); |
|
90 |
|
|
91 |
// Create the input for each tab-editor |
|
92 |
inputs = new ArrayList<IEditorInput>(); |
|
93 |
|
|
94 |
// // Initialize the editor parts and editor inputs |
|
95 |
// this.initCAFactorialMapEditor(); |
|
96 |
// this.initCASingularValuesTableEditor(); |
|
97 |
// this.initRowsTableEditor(); |
|
98 |
// this.initColumnsTableEditor(); |
|
99 |
// this.initCASingularValuesBarChartEditor(); |
|
100 |
} |
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
/** |
|
111 |
* Exists. |
|
112 |
* |
|
113 |
* @return true, if successful |
|
114 |
* @see org.eclipse.ui.IEditorInput#exists() |
|
115 |
*/ |
|
116 |
@Override |
|
117 |
public boolean exists() { |
|
118 |
return false; |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* Gets the image descriptor. |
|
123 |
* |
|
124 |
* @return the image descriptor |
|
125 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
|
126 |
*/ |
|
127 |
@Override |
|
128 |
public ImageDescriptor getImageDescriptor() { |
|
129 |
return AbstractUIPlugin.imageDescriptorFromPlugin( |
|
130 |
Application.PLUGIN_ID, |
|
131 |
IImageKeys.ACTION_CORRESPONDANCE_ANALYSIS); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* Gets the persistable. |
|
136 |
* |
|
137 |
* @return the persistable |
|
138 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
|
139 |
*/ |
|
140 |
@Override |
|
141 |
public IPersistableElement getPersistable() { |
|
142 |
return null; |
|
143 |
} |
|
144 |
|
|
145 |
/** |
|
146 |
* Gets the adapter. |
|
147 |
* |
|
148 |
* @param arg0 the arg0 |
|
149 |
* @return the adapter |
|
150 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
|
151 |
*/ |
|
152 |
@Override |
|
153 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
154 |
public Object getAdapter(Class arg0) { |
|
155 |
return null; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Gets the cA. |
|
160 |
* |
|
161 |
* @return the Correspondance analysis underlying object |
|
162 |
*/ |
|
163 |
public CA getCA() { |
|
164 |
return ca; |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* Gets the property. |
|
169 |
* |
|
170 |
* @return the property |
|
171 |
*/ |
|
172 |
public Property getProperty() { |
|
173 |
return property; |
|
174 |
} |
|
175 |
|
|
176 |
|
|
177 |
/** |
|
178 |
* Gets the input. |
|
179 |
* |
|
180 |
* @return the input |
|
181 |
*/ |
|
182 |
public Object getInput() { |
|
183 |
return ca; |
|
184 |
} |
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
// Implementing IProvidingMultiPageEditorInput |
|
189 |
/* (non-Javadoc) |
|
190 |
* @see org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput#getEditorInputs() |
|
191 |
*/ |
|
192 |
public List<IEditorInput> getEditorInputs() { |
|
193 |
return inputs; |
|
194 |
} |
|
195 |
|
|
196 |
/* (non-Javadoc) |
|
197 |
* @see org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput#getEditors() |
|
198 |
*/ |
|
199 |
public List<EditorPart> getEditors() { |
|
200 |
return editors; |
|
201 |
} |
|
202 |
|
|
203 |
|
|
204 |
} |
|
0 | 205 |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 282) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.ca.rcp.editors; |
29 | 29 |
|
30 |
import java.text.DecimalFormat; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.Arrays; |
|
33 |
import java.util.List; |
|
34 |
|
|
30 | 35 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
36 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
37 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
|
38 |
import org.eclipse.jface.viewers.LabelProvider; |
|
31 | 39 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
32 | 40 |
import org.eclipse.jface.viewers.TableViewer; |
41 |
import org.eclipse.jface.viewers.Viewer; |
|
33 | 42 |
import org.eclipse.osgi.util.NLS; |
34 | 43 |
import org.eclipse.swt.SWT; |
35 | 44 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
53 | 62 |
import org.eclipse.ui.part.EditorPart; |
54 | 63 |
import org.txm.ca.core.chartsengine.base.Utils; |
55 | 64 |
import org.txm.ca.core.functions.CA; |
65 |
import org.txm.ca.core.preferences.CAPreferences; |
|
66 |
import org.txm.ca.rcp.messages.CAUIMessages; |
|
56 | 67 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
68 |
import org.txm.chartsengine.rcp.editors.ChartEditorInput; |
|
57 | 69 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
58 | 70 |
import org.txm.rcp.editors.SplitedGenericMultiPageEditor; |
71 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
59 | 72 |
import org.txm.rcpapplication.Messages; |
60 | 73 |
import org.txm.rcpapplication.commands.editor.CustomizableEditor; |
61 | 74 |
import org.txm.rcpapplication.editors.GenericMultiPageEditor; |
62 |
import org.txm.rcpapplication.editors.input.IProvidingMultiPageEditorInput; |
|
75 |
import org.txm.rcpapplication.editors.Tablable; |
|
76 |
import org.txm.rcpapplication.editors.input.AbstractTablable; |
|
77 |
import org.txm.rcpapplication.editors.input.FrequencyListContentProvider; |
|
78 |
import org.txm.rcpapplication.editors.input.FrequencyListLabelProvider; |
|
63 | 79 |
import org.txm.searchengine.cqp.corpus.Corpus; |
64 | 80 |
|
65 | 81 |
// TODO: Auto-generated Javadoc |
... | ... | |
77 | 93 |
/** The ca. */ |
78 | 94 |
private CA ca; |
79 | 95 |
|
96 |
/** |
|
97 |
* The main editor is the editor on the left area and that is always visible (not tabbed). |
|
98 |
*/ |
|
80 | 99 |
protected EditorPart mainEditor; |
100 |
|
|
81 | 101 |
|
102 |
private static String SEPARATOR = "SEPARATOR"; //$NON-NLS-1$ |
|
103 |
|
|
104 |
private static String COL_TYPE = "Double"; //$NON-NLS-1$ |
|
105 |
|
|
106 |
/** The names. */ |
|
107 |
private List<String> names = Arrays.asList(new String[] { |
|
108 |
CAUIMessages.CorrespondanceAnalysisEditorInput_1, |
|
109 |
CAUIMessages.CorrespondanceAnalysisEditorInput_0, |
|
110 |
CAUIMessages.CorrespondanceAnalysisEditorInput_8, |
|
111 |
CAUIMessages.CorrespondanceAnalysisEditorInput_9, |
|
112 |
CAUIMessages.CorrespondanceAnalysisEditorInput_2 }); |
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
/** |
|
117 |
* |
|
118 |
*/ |
|
82 | 119 |
public CAEditor() { |
83 | 120 |
super(); |
84 | 121 |
} |
... | ... | |
135 | 172 |
AFCgraph.setLayout(new FillLayout()); |
136 | 173 |
// ///////////////////// |
137 | 174 |
|
138 |
IEditorInput input = getEditorInput(); |
|
139 |
if (!(input instanceof IProvidingMultiPageEditorInput)) { |
|
140 |
throw new IllegalArgumentException(NLS.bind( |
|
141 |
Messages.GenericMultiPageEditor_1, input.getName())); |
|
175 |
|
|
176 |
editors = new ArrayList<EditorPart>(); |
|
177 |
inputs = new ArrayList<IEditorInput>(); |
|
178 |
|
|
179 |
TXMResultEditorInput cainput = (TXMResultEditorInput) getEditorInput(); |
|
180 |
this.ca = (CA) cainput.getResult(); |
|
181 |
|
|
182 |
if (this.ca.getPartition() != null) { |
|
183 |
setPartName(this.ca.getPartition().getName() + ":" + this.ca.getAnalysisProperty()); //$NON-NLS-1$ |
|
142 | 184 |
} |
185 |
|
|
186 |
// Initialize the editor parts and editor inputs |
|
187 |
this.initCAFactorialMapEditor(); |
|
188 |
this.initCASingularValuesTableEditor(); |
|
189 |
this.initRowsTableEditor(); |
|
190 |
this.initColumnsTableEditor(); |
|
191 |
this.initCASingularValuesBarChartEditor(); |
|
143 | 192 |
|
144 |
editors = ((IProvidingMultiPageEditorInput) input).getEditors(); |
|
145 |
inputs = ((IProvidingMultiPageEditorInput) input).getEditorInputs(); |
|
146 |
names = ((IProvidingMultiPageEditorInput) input).getNames(); |
|
147 |
|
|
193 |
|
|
148 | 194 |
if (editors.size() != inputs.size()) { |
149 |
throw new IllegalArgumentException(NLS.bind( |
|
150 |
Messages.GenericMultiPageEditor_3, editors.size(), inputs.size())); |
|
195 |
throw new IllegalArgumentException(NLS.bind(Messages.GenericMultiPageEditor_3, editors.size(), inputs.size())); |
|
151 | 196 |
} |
152 | 197 |
|
153 |
// put first editor in the left panel |
|
198 |
// put first editor in the left panel and set is as "main" editor
|
|
154 | 199 |
try { |
155 | 200 |
|
156 | 201 |
final CAFactorialMapChartEditor caFactorialMapEditorPart = (CAFactorialMapChartEditor) editors.get(0); |
... | ... | |
158 | 203 |
|
159 | 204 |
IEditorSite site = createSite(caFactorialMapEditorPart); |
160 | 205 |
// call init first so that if an exception is thrown, we have created no new widgets |
161 |
caFactorialMapEditorPart.init(site, inputs.get(0));
|
|
206 |
caFactorialMapEditorPart.init(site, editors.get(0).getEditorInput());
|
|
162 | 207 |
|
163 | 208 |
// Set the parent multi pages editor of the CA factorial map editor to activate it from the child editor |
164 | 209 |
caFactorialMapEditorPart.setParentMultiPagesEditor(this); |
... | ... | |
166 | 211 |
caFactorialMapEditorPart.createChart(); |
167 | 212 |
caFactorialMapEditorPart.createPartControl(AFCgraph); // must be called AFTER createChart() because the initItemListener checks if getChart() is null |
168 | 213 |
caFactorialMapEditorPart.loadChart(); |
214 |
caFactorialMapEditorPart.refresh(); |
|
215 |
|
|
169 | 216 |
|
170 |
|
|
171 |
|
|
172 | 217 |
caFactorialMapEditorPart.addPropertyListener(new IPropertyListener() { |
173 | 218 |
@Override |
174 | 219 |
public void propertyChanged(Object source, int propertyId) { |
... | ... | |
185 | 230 |
return; |
186 | 231 |
} |
187 | 232 |
|
233 |
// add the other editors |
|
188 | 234 |
for (int i = 1; i < editors.size(); i++) { |
189 | 235 |
int editorIndex = 0; |
190 | 236 |
try { |
... | ... | |
263 | 309 |
|
264 | 310 |
|
265 | 311 |
|
266 |
CAEditorInput cainput = (CAEditorInput) getEditorInput(); |
|
267 |
this.ca = cainput.getCA(); |
|
268 | 312 |
|
269 |
if (cainput.getCA().getPartition() != null) { |
|
270 |
setPartName(cainput.getCA().getPartition().getName() + ":" //$NON-NLS-1$ |
|
271 |
+ cainput.getCA().getAnalysisProperty()); |
|
272 |
} |
|
273 |
|
|
274 | 313 |
this.setActivePage(LAST_EDITOR_USED); |
275 | 314 |
|
276 | 315 |
this.setPartName(this.getEditorInput().getName()); |
277 | 316 |
} |
278 | 317 |
|
318 |
|
|
319 |
|
|
279 | 320 |
/** |
280 |
* Gets the cA. |
|
321 |
* Initializes CA factorial map editor. |
|
322 |
*/ |
|
323 |
public void initCAFactorialMapEditor() { |
|
324 |
|
|
325 |
// Editor part |
|
326 |
ChartEditorPart caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput(ca, CAPreferences.PREFERENCES_NODE)); |
|
327 |
editors.add(caFactorialMapEditorPart); |
|
328 |
|
|
329 |
// Editor input |
|
330 |
inputs.add(caFactorialMapEditorPart.getEditorInput()); |
|
331 |
|
|
332 |
} |
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
/** |
|
337 |
* Initializes CA singular values bar chart editor. |
|
338 |
*/ |
|
339 |
public void initCASingularValuesBarChartEditor() { |
|
340 |
|
|
341 |
// Editor part |
|
342 |
EditorPart caSingularValuesEditorPart = SWTChartsComponentsProvider.getCurrent().createChartEditor(ca, CAPreferences.PREFERENCES_NODE, "Singular Values"); //$NON-NLS-1$ |
|
343 |
editors.add(caSingularValuesEditorPart); |
|
344 |
|
|
345 |
// Editor input |
|
346 |
inputs.add(caSingularValuesEditorPart.getEditorInput()); |
|
347 |
} |
|
348 |
|
|
349 |
|
|
350 |
/** |
|
351 |
* Initializes CA singular values table editor. |
|
352 |
*/ |
|
353 |
public void initCASingularValuesTableEditor() { |
|
354 |
// Editor part |
|
355 |
editors.add(new SingularValuesEditor()); |
|
356 |
|
|
357 |
// Editor input |
|
358 |
Tablable table = new AbstractTablable() { |
|
359 |
@Override |
|
360 |
public String[] getColumnTitles() { |
|
361 |
return new String[] { |
|
362 |
CAUIMessages.CorrespondanceAnalysisEditorInput_4, |
|
363 |
CAUIMessages.CorrespondanceAnalysisEditorInput_5, |
|
364 |
"%", CAUIMessages.CorrespondanceAnalysisEditorInput_11 + "%", "", ""}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
|
365 |
} |
|
366 |
|
|
367 |
@Override |
|
368 |
public String[] getColumnTypes() { |
|
369 |
return new String[] { |
|
370 |
Messages.FrequencyListEditorInput_6, |
|
371 |
COL_TYPE, |
|
372 |
COL_TYPE, |
|
373 |
COL_TYPE, |
|
374 |
COL_TYPE, |
|
375 |
SEPARATOR}; |
|
376 |
} |
|
377 |
|
|
378 |
@Override |
|
379 |
public IStructuredContentProvider getContentProvider() { |
|
380 |
return new IStructuredContentProvider() { |
|
381 |
@Override |
|
382 |
public Object[] getElements(Object inputElement) { |
|
383 |
CA ca = (CA) inputElement; |
|
384 |
List<List<Object>> tabledata = ca.getSingularValuesInfos(); |
|
385 |
return tabledata.toArray(); |
|
386 |
} |
|
387 |
|
|
388 |
@Override |
|
389 |
public void dispose() { |
|
390 |
// TODO Auto-generated method stub |
|
391 |
} |
|
392 |
|
|
393 |
@Override |
|
394 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
395 |
Object newInput) { |
|
396 |
// TODO Auto-generated method stub |
|
397 |
} |
|
398 |
}; |
|
399 |
} |
|
400 |
|
|
401 |
@Override |
|
402 |
public Object getInput() { |
|
403 |
return ca; |
|
404 |
} |
|
405 |
|
|
406 |
@Override |
|
407 |
public LabelProvider getLabelProvider() { |
|
408 |
return new CASingularValueLabelProvider(); |
|
409 |
} |
|
410 |
}; |
|
411 |
|
|
412 |
inputs.add(table); |
|
413 |
} |
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
/** |
|
418 |
* Initializes rows data table editor. |
|
419 |
*/ |
|
420 |
public void initRowsTableEditor() { |
|
421 |
// Editor part |
|
422 |
editors.add(new ColsRowsInfosEditor()); |
|
423 |
|
|
424 |
// Editor input |
|
425 |
Tablable table = new AbstractTablable() { |
|
426 |
|
|
427 |
List<String> coltypes; |
|
428 |
@Override |
|
429 |
public String[] getColumnTitles() { |
|
430 |
return ca.getRowInfosTitles(); |
|
431 |
// new String[]{"Rows"," ","Quality","Mass", "Dist", "Inertia"}; |
|
432 |
} |
|
433 |
|
|
434 |
@Override |
|
435 |
public String[] getColumnTypes() { |
|
436 |
coltypes = new ArrayList<String>(); |
|
437 |
coltypes.add(Messages.FrequencyListEditorInput_6); |
|
438 |
coltypes.add(SEPARATOR); |
|
439 |
coltypes.add(COL_TYPE); |
|
440 |
coltypes.add(COL_TYPE); |
|
441 |
coltypes.add(COL_TYPE); |
|
442 |
coltypes.add(COL_TYPE); |
|
443 |
coltypes.add(COL_TYPE); |
|
444 |
for (int c = 0; c < 3; c++)// seulement les 3 premiers axes |
|
445 |
{ |
|
446 |
coltypes.add(SEPARATOR); |
|
447 |
coltypes.add(COL_TYPE); |
|
448 |
coltypes.add(COL_TYPE); |
|
449 |
} |
|
450 |
coltypes.add(SEPARATOR); |
|
451 |
coltypes.add(COL_TYPE); |
|
452 |
coltypes.add(COL_TYPE); |
|
453 |
coltypes.add(COL_TYPE); |
|
454 |
coltypes.add(SEPARATOR); |
|
455 |
return coltypes.toArray(new String[] {}); |
|
456 |
// new String[]{Messages.FrequencyListEditorInput_6, |
|
457 |
// Messages.SpecificitiesResultEditorInput_11, |
|
458 |
// Messages.SpecificitiesResultEditorInput_11, |
|
459 |
// Messages.SpecificitiesResultEditorInput_11}; |
|
460 |
} |
|
461 |
|
|
462 |
@Override |
|
463 |
public IStructuredContentProvider getContentProvider() { |
|
464 |
|
|
465 |
return new IStructuredContentProvider() { |
|
466 |
@Override |
|
467 |
public Object[] getElements(Object inputElement) { |
|
468 |
|
|
469 |
CA ca = (CA) inputElement; |
|
470 |
return ca.getRowInfos(); |
|
471 |
} |
|
472 |
|
|
473 |
@Override |
|
474 |
public void dispose() { |
|
475 |
// TODO Auto-generated method stub |
|
476 |
} |
|
477 |
|
|
478 |
@Override |
|
479 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
480 |
Object newInput) { |
|
481 |
// TODO Auto-generated method stub |
|
482 |
} |
|
483 |
}; |
|
484 |
} |
|
485 |
|
|
486 |
@Override |
|
487 |
public Object getInput() { |
|
488 |
return ca; |
|
489 |
} |
|
490 |
|
|
491 |
@Override |
|
492 |
public LabelProvider getLabelProvider() { |
|
493 |
return new ColRowInfosLabelProvider(this.getColumnTitles()); |
|
494 |
} |
|
495 |
}; |
|
496 |
inputs.add(table); |
|
497 |
} |
|
498 |
|
|
499 |
|
|
500 |
/** |
|
501 |
* Initializes columns data table editor. |
|
502 |
*/ |
|
503 |
public void initColumnsTableEditor() { |
|
504 |
// Editor part |
|
505 |
editors.add(new ColsRowsInfosEditor()); |
|
506 |
|
|
507 |
// Editor input |
|
508 |
Tablable table = new AbstractTablable() { |
|
509 |
|
|
510 |
List<String> colnames = new ArrayList<String>(); |
|
511 |
List<String> coltypes = new ArrayList<String>(); |
|
512 |
boolean firstInit = true; |
|
513 |
|
|
514 |
@Override |
|
515 |
public String[] getColumnTitles() { |
|
516 |
return ca.getColInfosTitles(); |
|
517 |
} |
|
518 |
|
|
519 |
@Override |
|
520 |
public String[] getColumnTypes() { |
|
521 |
coltypes = new ArrayList<String>(); |
|
522 |
coltypes.add(Messages.FrequencyListEditorInput_6); |
|
523 |
coltypes.add(SEPARATOR); |
|
524 |
coltypes.add(COL_TYPE); |
|
525 |
coltypes.add(COL_TYPE); |
|
526 |
coltypes.add(COL_TYPE); |
|
527 |
coltypes.add(COL_TYPE); |
|
528 |
coltypes.add(COL_TYPE); |
|
529 |
for (int c = 0; c < 3; c++) { |
|
530 |
coltypes.add(SEPARATOR); |
|
531 |
coltypes.add(COL_TYPE); |
|
532 |
coltypes.add(COL_TYPE); |
|
533 |
} |
|
534 |
coltypes.add(SEPARATOR); |
|
535 |
coltypes.add(COL_TYPE); |
|
536 |
coltypes.add(COL_TYPE); |
|
537 |
coltypes.add(COL_TYPE); |
|
538 |
coltypes.add(SEPARATOR); |
|
539 |
return coltypes.toArray(new String[] {}); |
|
540 |
// new String[]{Messages.FrequencyListEditorInput_6, |
|
541 |
// COL_TYPE, |
|
542 |
// COL_TYPE, |
|
543 |
// COL_TYPE}; |
|
544 |
} |
|
545 |
|
|
546 |
@Override |
|
547 |
public IStructuredContentProvider getContentProvider() { |
|
548 |
|
|
549 |
return new IStructuredContentProvider() { |
|
550 |
@Override |
|
551 |
public Object[] getElements(Object inputElement) { |
|
552 |
CA ca = (CA) inputElement; |
|
553 |
return ca.getColInfos(); |
|
554 |
} |
|
555 |
|
|
556 |
@Override |
|
557 |
public void dispose() { |
|
558 |
// TODO Auto-generated method stub |
|
559 |
} |
|
560 |
|
|
561 |
@Override |
|
562 |
public void inputChanged(Viewer viewer, Object oldInput, |
|
563 |
Object newInput) { |
|
564 |
// TODO Auto-generated method stub |
|
565 |
} |
|
566 |
}; |
|
567 |
} |
|
568 |
|
|
569 |
@Override |
|
570 |
public Object getInput() { |
|
571 |
return ca; |
|
572 |
} |
|
573 |
|
|
574 |
@Override |
|
575 |
public LabelProvider getLabelProvider() { |
|
576 |
return new ColRowInfosLabelProvider(this.getColumnTitles()); |
|
577 |
} |
|
578 |
}; |
|
579 |
inputs.add(table); |
|
580 |
} |
|
581 |
|
|
582 |
|
|
583 |
/** |
|
584 |
* The Class CASingularValueLabelProvider. |
|
585 |
*/ |
|
586 |
private class CASingularValueLabelProvider extends LabelProvider implements ITableLabelProvider { |
|
587 |
|
|
588 |
|
|
589 |
/** |
|
590 |
* Percent values number format. |
|
591 |
*/ |
|
592 |
protected DecimalFormat percentValuesNumberFormat = new DecimalFormat(new String("0.00")); //$NON-NLS-1$ |
|
593 |
|
|
594 |
|
|
595 |
/* (non-Javadoc) |
|
596 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
|
597 |
*/ |
|
598 |
@Override |
|
599 |
public Image getColumnImage(Object element, int columnIndex) { |
|
600 |
// TODO Auto-generated method stub |
|
601 |
return null; |
|
602 |
} |
|
603 |
|
|
604 |
/* (non-Javadoc) |
|
605 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
|
606 |
*/ |
|
607 |
@Override |
|
608 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
609 |
public String getColumnText(Object element, int columnIndex) { |
|
610 |
DecimalFormat f; |
|
611 |
Object o = ((List<Object>) element).get(columnIndex); |
|
612 |
switch (columnIndex) { |
|
613 |
case 0: // factor |
|
614 |
return o.toString(); |
|
615 |
case 1: // eigenvalue |
|
616 |
if ((Double) o < 1) { |
|
617 |
if ((Double) o < 0.0001) |
|
618 |
f = new DecimalFormat("0.0000E00"); //$NON-NLS-1$ |
|
619 |
else |
|
620 |
f = new DecimalFormat("0.0000"); //$NON-NLS-1$ |
|
621 |
} else { |
|
622 |
f = new DecimalFormat("##########0.0000"); //$NON-NLS-1$ |
|
623 |
} |
|
624 |
// FIXME: printf syntax tests |
|
625 |
//return String.format("%.4f", o); |
|
626 |
return f.format(o); |
|
627 |
case 2: // percent |
|
628 |
case 3: // cumul |
|
629 |
return percentValuesNumberFormat.format(o); |
|
630 |
default: |
|
631 |
return ""; //$NON-NLS-1$ |
|
632 |
} |
|
633 |
} |
|
634 |
} |
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
/** |
|
640 |
* Gets the CA. |
|
281 | 641 |
* |
282 |
* @return the cA
|
|
642 |
* @return the CA
|
|
283 | 643 |
*/ |
284 | 644 |
public CA getCA() { |
285 | 645 |
return this.ca; |
... | ... | |
377 | 737 |
public EditorPart getMainEditorPart() { |
378 | 738 |
return this.mainEditor; |
379 | 739 |
} |
740 |
|
|
741 |
/** |
|
742 |
* |
|
743 |
* @param partName |
|
744 |
*/ |
|
745 |
public void changePartName(String partName) { |
|
746 |
this.setPartName(partName); |
|
747 |
} |
|
748 |
|
|
749 |
// /** |
|
750 |
// * Gets the content provider. |
|
751 |
// * |
|
752 |
// * @return the content provider |
|
753 |
// */ |
|
754 |
// public IStructuredContentProvider getContentProvider() { |
|
755 |
// return new FrequencyListContentProvider(); |
|
756 |
// } |
|
757 |
// /** |
|
758 |
// * Gets the label provider. |
|
759 |
// * |
|
760 |
// * @return the label provider |
|
761 |
// */ |
|
762 |
// public LabelProvider getLabelProvider() { |
|
763 |
// return new FrequencyListLabelProvider(); |
|
764 |
// } |
|
765 |
// |
|
766 |
// /** |
|
767 |
// * Gets the column titles. |
|
768 |
// * |
|
769 |
// * @return the column titles |
|
770 |
// */ |
|
771 |
// public String[] getColumnTitles() { |
|
772 |
// return new String[] { Messages.FrequencyListEditorInput_9, |
|
773 |
// Messages.FrequencyListEditorInput_4 }; |
|
774 |
// } |
|
380 | 775 |
} |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 282) | ||
---|---|---|
118 | 118 |
plansCombo.setItems(items); |
119 | 119 |
|
120 | 120 |
// Preselect the plan from the CA data |
121 |
if(this.getResultData().getFirstDimension() == 2) {
|
|
121 |
if(TXMPreferences.getInt(CAPreferences.PREFERENCES_NODE, this.getResultData(), CAPreferences.FIRST_DIMENSION) == 2) {
|
|
122 | 122 |
plansCombo.select(2); |
123 | 123 |
} |
124 |
else if(this.getResultData().getSecondDimension() == 3) {
|
|
124 |
else if(TXMPreferences.getInt(CAPreferences.PREFERENCES_NODE, this.getResultData(), CAPreferences.SECOND_DIMENSION) == 3) {
|
|
125 | 125 |
plansCombo.select(1); |
126 | 126 |
} |
127 | 127 |
else { |
... | ... | |
195 | 195 |
resetView = true; |
196 | 196 |
} |
197 | 197 |
computeChart(true, resetView, false); |
198 |
// synchronize the part names |
|
199 |
((CAEditor)getParentMultiPagesEditor()).changePartName(getResultData().getName()); |
|
198 | 200 |
forceFocus(); |
199 | 201 |
} |
200 | 202 |
|
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java (revision 282) | ||
---|---|---|
33 | 33 |
import org.eclipse.core.runtime.IStatus; |
34 | 34 |
import org.eclipse.core.runtime.Status; |
35 | 35 |
import org.eclipse.jface.dialogs.MessageDialog; |
36 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
37 | 36 |
import org.eclipse.jface.window.Window; |
38 | 37 |
import org.eclipse.osgi.util.NLS; |
39 |
import org.eclipse.ui.IEditorPart; |
|
40 | 38 |
import org.eclipse.ui.IWorkbenchPage; |
41 | 39 |
import org.eclipse.ui.IWorkbenchWindow; |
42 | 40 |
import org.eclipse.ui.handlers.HandlerUtil; |
43 | 41 |
import org.txm.ca.core.functions.CA; |
44 | 42 |
import org.txm.ca.core.functions.ICAComputable; |
45 |
import org.txm.ca.core.preferences.CAPreferences; |
|
46 |
import org.txm.ca.rcp.editors.CAEditorInput; |
|
47 | 43 |
import org.txm.ca.rcp.messages.CAUIMessages; |
48 |
import org.txm.core.preferences.TXMPreferences; |
|
49 | 44 |
import org.txm.lexicaltable.core.statsengine.data.LexicalTable; |
50 | 45 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog; |
46 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
51 | 47 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
52 | 48 |
import org.txm.rcpapplication.JobsTimer; |
53 | 49 |
import org.txm.rcpapplication.Messages; |
54 | 50 |
import org.txm.rcpapplication.StatusLine; |
55 | 51 |
import org.txm.rcpapplication.utils.JobHandler; |
56 | 52 |
import org.txm.rcpapplication.views.corpora.CorporaView; |
57 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
58 | 53 |
import org.txm.searchengine.cqp.corpus.Partition; |
59 | 54 |
import org.txm.searchengine.cqp.corpus.Property; |
60 | 55 |
import org.txm.utils.logger.MessageBox; |
... | ... | |
70 | 65 |
public class ComputeCA extends BaseAbstractHandler { |
71 | 66 |
|
72 | 67 |
/** The CA. */ |
73 |
private CA ca;
|
|
68 |
public CA ca = null;
|
|
74 | 69 |
|
75 | 70 |
/** The property. */ |
76 | 71 |
private Property property; |
... | ... | |
102 | 97 |
@Override |
103 | 98 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
104 | 99 |
|
100 |
ca = null; |
|
101 |
|
|
105 | 102 |
if (!this.checkStatsEngine()) { |
106 | 103 |
return null; |
107 | 104 |
} |
108 | 105 |
|
109 | 106 |
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); |
110 |
final IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
|
107 |
final Object selection = this.getSelection(); |
|
108 |
|
|
111 | 109 |
int code = 0; |
112 |
// From partition
|
|
113 |
if (selection.getFirstElement() instanceof Partition) {
|
|
114 |
partition = (Partition) selection.getFirstElement();
|
|
110 |
// Create CA from partition
|
|
111 |
if (selection instanceof Partition) { |
|
112 |
partition = (Partition) selection; |
|
115 | 113 |
//warning to few parts |
116 | 114 |
if (partition.getNPart() < 4) { |
117 | 115 |
MessageDialog d = new MessageDialog( |
... | ... | |
136 | 134 |
vmax = d.getMaxLines(); |
137 | 135 |
} |
138 | 136 |
} |
139 |
// From Lexical Table
|
|
140 |
else if (selection.getFirstElement() instanceof LexicalTable) {
|
|
141 |
lexicaltable = (LexicalTable) selection.getFirstElement();
|
|
137 |
// Create CA from Lexical Table
|
|
138 |
else if (selection instanceof LexicalTable) { |
|
139 |
lexicaltable = (LexicalTable) selection; |
|
142 | 140 |
property = lexicaltable.getProperty(); |
143 | 141 |
partition = lexicaltable.getPartition(); |
144 | 142 |
if (lexicaltable.getNColumns() < 4) { |
... | ... | |
151 | 149 |
} |
152 | 150 |
code = Window.OK; |
Formats disponibles : Unified diff