Révision 791
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/ColumnSelectionListener.java (revision 791) | ||
---|---|---|
17 | 17 |
* |
18 | 18 |
* @see org.eclipse.swt.events.SelectionListener |
19 | 19 |
*/ |
20 |
@Deprecated |
|
20 | 21 |
public class ColumnSelectionListener implements SelectionListener { |
21 | 22 |
|
22 | 23 |
LexicalTableEditor editor; |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableLinesViewerComparator.java (revision 791) | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package org.txm.lexicaltable.rcp.editors; |
|
5 |
|
|
6 |
import java.text.Collator; |
|
7 |
|
|
8 |
import org.eclipse.jface.viewers.Viewer; |
|
9 |
import org.txm.rcp.editors.TableLinesViewerComparator; |
|
10 |
|
|
11 |
/** |
|
12 |
* Viewer comparator for the lines sorting. |
|
13 |
* |
|
14 |
* @author sjacquot |
|
15 |
* |
|
16 |
*/ |
|
17 |
// FIXME: viewer comparator tests |
|
18 |
public class ___LexicalTableLinesViewerComparator extends TableLinesViewerComparator { |
|
19 |
|
|
20 |
|
|
21 |
/** |
|
22 |
* |
|
23 |
* @param collator |
|
24 |
*/ |
|
25 |
public ___LexicalTableLinesViewerComparator(Collator collator) { |
|
26 |
super(collator); |
|
27 |
} |
|
28 |
|
|
29 |
|
|
30 |
@Override |
|
31 |
public int compare(Viewer viewer, Object e1, Object e2) { |
|
32 |
|
|
33 |
int result = 0; |
|
34 |
System.err.println("LexicalTableLinesViewerComparator.compare(): index = " + this.lastColumnIndex + ", e1 = " + e1 + ", e2 = " + e2); |
|
35 |
switch (this.lastColumnIndex) { |
|
36 |
// unit |
|
37 |
case 1: |
|
38 |
result = this.collator.compare(e1, e2); |
|
39 |
break; |
|
40 |
// total frequencies and columns frequencies |
|
41 |
case 2: |
|
42 |
default: |
|
43 |
result = ((Integer) e1).compareTo(((Integer) e2)); |
|
44 |
break; |
|
45 |
} |
|
46 |
|
|
47 |
// reverse if needed |
|
48 |
if (this.direction == DESCENDING) { |
|
49 |
result = -result; |
|
50 |
} |
|
51 |
return result; |
|
52 |
} |
|
53 |
|
|
54 |
} |
|
0 | 55 |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 791) | ||
---|---|---|
34 | 34 |
import java.util.Comparator; |
35 | 35 |
import java.util.List; |
36 | 36 |
|
37 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
|
37 | 38 |
import org.eclipse.jface.viewers.CellLabelProvider; |
38 | 39 |
import org.eclipse.jface.viewers.TableViewer; |
39 | 40 |
import org.eclipse.jface.viewers.TableViewerColumn; |
... | ... | |
50 | 51 |
import org.eclipse.swt.widgets.MessageBox; |
51 | 52 |
import org.eclipse.swt.widgets.Spinner; |
52 | 53 |
import org.eclipse.swt.widgets.TableColumn; |
54 |
import org.txm.Toolbox; |
|
53 | 55 |
import org.txm.core.messages.TXMCoreMessages; |
54 | 56 |
import org.txm.core.results.Parameter; |
55 | 57 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
... | ... | |
88 | 90 |
TableViewer viewer; |
89 | 91 |
|
90 | 92 |
/** The form column. */ |
91 |
TableViewerColumn formColumn;
|
|
93 |
TableViewerColumn unitColumn;
|
|
92 | 94 |
|
93 | 95 |
/** The freq column. */ |
94 | 96 |
TableViewerColumn freqColumn; |
... | ... | |
115 | 117 |
private Label infoLine; |
116 | 118 |
|
117 | 119 |
|
120 |
// FIXME: viewer comparator tests |
|
121 |
// /** |
|
122 |
// * Viewer comparator for sorting. |
|
123 |
// */ |
|
124 |
// protected LexicalTableLinesViewerComparator viewerComparator; |
|
125 |
|
|
118 | 126 |
|
119 | 127 |
|
120 | 128 |
/** |
... | ... | |
125 | 133 |
|
126 | 134 |
|
127 | 135 |
/** The minfreqspinner. */ |
128 |
// @Parameter(key=LexicalTablePreferences.F_MIN)
|
|
136 |
@Parameter(key=LexicalTablePreferences.F_MIN) |
|
129 | 137 |
protected Spinner fMin; |
130 | 138 |
|
131 | 139 |
/** The top spinner. */ |
132 |
// @Parameter(key=LexicalTablePreferences.V_MAX)
|
|
140 |
@Parameter(key=LexicalTablePreferences.V_MAX) |
|
133 | 141 |
protected Spinner vMax; |
134 | 142 |
|
135 | 143 |
|
... | ... | |
181 | 189 |
} |
182 | 190 |
|
183 | 191 |
try { |
184 |
updateResultFromEditor(); |
|
185 |
refresh(false); |
|
192 |
// updateResultFromEditor(); |
|
193 |
// refresh(false); |
|
194 |
// force the recomputing |
|
195 |
getResult().setDirty(); |
|
196 |
compute(true); |
|
186 | 197 |
} catch (Exception e1) { |
187 | 198 |
// TODO Auto-generated catch block |
188 | 199 |
org.txm.rcp.utils.Logger.printStackTrace(e1); |
... | ... | |
321 | 332 |
} |
322 | 333 |
|
323 | 334 |
if (d.doMerge()) { |
324 |
MergeLines.mergeLines(LexicalTableEditor.this, d |
|
325 |
.getMergeName(), rowindices); |
|
335 |
MergeLines.mergeLines(LexicalTableEditor.this, d.getMergeName(), rowindices); |
|
326 | 336 |
} else { |
327 | 337 |
lexicalTable.getData().removeRows(rowindices); |
328 | 338 |
refreshTable(true); |
... | ... | |
336 | 346 |
} |
337 | 347 |
}); |
338 | 348 |
|
349 |
|
|
350 |
|
|
351 |
// Result area |
|
339 | 352 |
Composite resultArea = this.getResultArea(); |
340 | 353 |
|
341 | 354 |
GridData gd = new GridData(GridData.FILL_BOTH); |
... | ... | |
349 | 362 |
viewer.getTable().setLinesVisible(true); |
350 | 363 |
viewer.getTable().setHeaderVisible(true); |
351 | 364 |
|
365 |
|
|
366 |
//viewer.setContentProvider(ArrayContentProvider.getInstance()); |
|
367 |
|
|
368 |
// FIXME: viewer comparator tests |
|
369 |
// creates the viewer comparator |
|
370 |
// this.viewerComparator = new LexicalTableLinesViewerComparator(Toolbox.getCollator(this.getResult())); |
|
371 |
// viewer.setComparator(this.viewerComparator); |
|
372 |
|
|
373 |
// FIXME: we must use this line rather than the LineContentProvider class |
|
374 |
//viewer.setContentProvider(ArrayContentProvider.getInstance()); |
|
375 |
viewer.setContentProvider(new LineContentProvider()); |
|
376 |
|
|
377 |
|
|
352 | 378 |
viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); |
353 |
CellLabelProvider clp = new CellLabelProvider() { |
|
354 |
@Override |
|
355 |
public void update(ViewerCell cell) { } |
|
356 |
}; |
|
379 |
|
|
380 |
// first dummy column |
|
357 | 381 |
TableViewerColumn nColumn = new TableViewerColumn(viewer, SWT.RIGHT); |
358 | 382 |
nColumn.getColumn().setText(" "); //$NON-NLS-1$ |
359 |
nColumn.getColumn().pack(); |
|
360 |
nColumn.setLabelProvider(clp); |
|
361 | 383 |
|
362 |
formColumn = new TableViewerColumn(viewer, SWT.LEFT); |
|
363 |
formColumn.getColumn().setWidth(200); |
|
364 |
formColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, formColumn, -2)); |
|
365 |
formColumn.setLabelProvider(clp); |
|
384 |
// property column |
|
385 |
unitColumn = new TableViewerColumn(viewer, SWT.LEFT); |
|
386 |
unitColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, unitColumn, -2)); |
|
387 |
// FIXME: viewer comparator tests |
|
388 |
//viewerComparator.addSelectionAdapter(viewer, unitColumn.getColumn(), 1); |
|
366 | 389 |
|
390 |
// frequency column |
|
367 | 391 |
freqColumn = new TableViewerColumn(viewer, SWT.LEFT); |
368 |
freqColumn.getColumn().setText(TXMCoreMessages.common_frequency); |
|
369 |
freqColumn.getColumn().setWidth(200); |
|
392 |
freqColumn.getColumn().setText(TXMCoreMessages.common_frequency); |
|
370 | 393 |
freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, freqColumn, -1)); |
371 |
freqColumn.setLabelProvider(clp); |
|
372 |
|
|
373 |
// creating the part columns |
|
374 |
for (int i = 0; i < this.getResult().getPartition().getParts().size(); i++) { |
|
375 |
TableViewerColumn partColumn = new TableViewerColumn(viewer, SWT.RIGHT); |
|
376 |
partColumn.getColumn().setWidth(200); |
|
377 |
partColumn.getColumn().addSelectionListener(new ColumnSelectionListener(this, partColumn, i)); |
|
378 |
partColumn.setLabelProvider(clp); |
|
379 |
} |
|
380 |
|
|
394 |
// FIXME: viewer comparator tests |
|
395 |
//viewerComparator.addSelectionAdapter(viewer, freqColumn.getColumn(), 2); |
|
381 | 396 |
|
382 |
viewer.setContentProvider(new LineContentProvider()); |
|
397 |
// Register the context menu |
|
398 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); // $NON-NLS-1$ |
|
383 | 399 |
|
384 |
viewer.getTable().setSortColumn(formColumn.getColumn()); |
|
400 |
// adjust UI to the original sorting |
|
401 |
viewer.getTable().setSortColumn(unitColumn.getColumn()); |
|
385 | 402 |
viewer.getTable().setSortDirection(SWT.UP); |
386 | 403 |
|
387 |
// Register the context menu |
|
388 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); // $NON-NLS-1$ |
|
389 |
|
|
390 | 404 |
infoLine = new Label(getBottomToolbar().getParent(), SWT.NONE); |
391 | 405 |
} |
392 |
catch (CqiClientException e) {
|
|
406 |
catch (Exception e) { |
|
393 | 407 |
// TODO Auto-generated catch block |
394 | 408 |
e.printStackTrace(); |
395 | 409 |
} |
... | ... | |
434 | 448 |
} |
435 | 449 |
|
436 | 450 |
/** |
437 |
* Refresh table. |
|
451 |
* Refreshes table.
|
|
438 | 452 |
*/ |
453 |
// FIXME: not optimized, need to mix the update/not update code and do not remove column each computing, only when needed |
|
454 |
// FIXME: + usine à gaz... virer la variable "collist" |
|
439 | 455 |
public void refreshTable(boolean update) { |
440 | 456 |
|
441 |
if(this.lexicalTable.hasBeenComputedOnce()) { |
|
457 |
|
|
458 |
this.viewer.getControl().setRedraw(false); |
|
459 |
|
|
460 |
// removing old columns |
|
461 |
for (int i = viewer.getTable().getColumnCount() - 1; i >= 3; i--) { |
|
462 |
viewer.getTable().getColumns()[i].dispose(); |
|
463 |
} |
|
464 |
|
|
465 |
try { |
|
442 | 466 |
|
443 |
formColumn.getColumn().setText(this.lexicalTable.getProperty().getName()); |
|
444 |
|
|
445 | 467 |
collist = new ArrayList<Object>(); |
446 |
Vector colnames = lexicalTable.getColNames(); |
|
447 | 468 |
|
448 |
try { |
|
449 |
int[] colmargins = lexicalTable.getColMarginsVector().asIntArray(); |
|
469 |
if(this.lexicalTable.getProperty() != null) { |
|
470 |
unitColumn.getColumn().setText(this.lexicalTable.getProperty().getName()); |
|
471 |
} |
|
472 |
|
|
473 |
|
|
474 |
// creating the columns |
|
475 |
String[] colNames; |
|
476 |
int[] colMargins = null; |
|
477 |
// from lexical table if they exist |
|
478 |
if(lexicalTable.getData() != null) { |
|
479 |
colNames = lexicalTable.getColNames().asStringsArray(); |
|
480 |
colMargins = lexicalTable.getColMarginsVector().asIntArray(); |
|
481 |
} |
|
482 |
// otherwise from partition parts names |
|
483 |
else { |
|
484 |
colNames = this.getResult().getPartition().getPartNames().toArray(new String[0]); |
|
485 |
} |
|
486 |
|
|
487 |
for (int i = 0; i < colNames.length; i++) { |
|
488 |
TableViewerColumn column = new TableViewerColumn(viewer, SWT.RIGHT); |
|
489 |
column.getColumn().addSelectionListener(new ColumnSelectionListener(this, column, i)); |
|
490 |
// FIXME: viewer comparator tests |
|
491 |
//viewerComparator.addSelectionAdapter(viewer, column.getColumn(), i + 2); |
|
450 | 492 |
|
451 |
int i = 3; |
|
452 |
for (String colname : colnames.asStringsArray()) { |
|
453 |
TableColumn partColumn = viewer.getTable().getColumn(i); |
|
454 |
partColumn.setText(colname + " t=" + colmargins[i - 3]); //$NON-NLS-1$ |
|
455 |
partColumn.setToolTipText(colname); |
|
456 |
collist.add(colname); |
|
457 |
i++; |
|
493 |
String colName = colNames[i]; |
|
494 |
column.getColumn().setToolTipText(colName); |
|
495 |
collist.add(colName); |
|
496 |
|
|
497 |
if(colMargins != null) { |
|
498 |
colName += " t=" + colMargins[i]; //$NON-NLS-1$ |
|
458 | 499 |
} |
459 | 500 |
|
460 |
viewer.setInput(lexicalTable); |
|
461 |
|
|
462 |
|
|
463 |
} catch (StatException e1) { |
|
464 |
org.txm.rcp.utils.Logger.printStackTrace(e1); |
|
465 |
return; |
|
501 |
column.getColumn().setText(colName); |
|
466 | 502 |
} |
503 |
|
|
504 |
} |
|
505 |
catch (StatException e) { |
|
506 |
// TODO Auto-generated catch block |
|
507 |
e.printStackTrace(); |
|
508 |
} |
|
467 | 509 |
|
468 | 510 |
|
511 |
if(this.lexicalTable.hasBeenComputedOnce()) { |
|
512 |
|
|
513 |
// collist = new ArrayList<Object>(); |
|
514 |
// Vector colnames = lexicalTable.getColNames(); |
|
515 |
// |
|
516 |
// try { |
|
517 |
// int[] colmargins = lexicalTable.getColMarginsVector().asIntArray(); |
|
518 |
// |
|
519 |
// int i = 3; |
|
520 |
// for (String colname : colnames.asStringsArray()) { |
|
521 |
// TableColumn partColumn = viewer.getTable().getColumn(i); |
|
522 |
// partColumn.setText(colname + " t=" + colmargins[i - 3]); //$NON-NLS-1$ |
|
523 |
// partColumn.setToolTipText(colname); |
|
524 |
// collist.add(colname); |
|
525 |
// i++; |
|
526 |
// } |
|
527 |
// |
|
528 |
// viewer.setInput(lexicalTable); |
|
529 |
// |
|
530 |
// |
|
531 |
// } catch (StatException e1) { |
|
532 |
// org.txm.rcp.utils.Logger.printStackTrace(e1); |
|
533 |
// return; |
|
534 |
// } |
|
535 |
|
|
536 |
|
|
469 | 537 |
LineLabelProvider labelprovider = new LineLabelProvider(this.lexicalTable); |
470 | 538 |
this.viewer.setLabelProvider(labelprovider); |
471 | 539 |
this.cols = labelprovider.getCols(); |
472 | 540 |
this.rows = labelprovider.getRows(); |
473 | 541 |
//this.freqs = labelprovider.getFreqs(); |
474 | 542 |
|
543 |
viewer.setInput(lexicalTable); |
|
544 |
} |
|
475 | 545 |
|
476 |
} |
|
546 |
this.viewer.getControl().setRedraw(true); |
|
547 |
|
|
477 | 548 |
|
478 | 549 |
// Refresh and pack the columns |
479 | 550 |
TXMEditor.packColumns(this.viewer); |
... | ... | |
594 | 665 |
* @param col the col |
595 | 666 |
* @param index the index |
596 | 667 |
*/ |
668 |
// FIXME: try to use a ViwerSorter instead of this |
|
597 | 669 |
public void sort(TableViewerColumn col, int index) { |
598 | 670 |
|
599 | 671 |
if (index == previousSortedCol) { |
... | ... | |
637 | 709 |
vMax.setSelection(lexicalTable.getData().getNRows()); |
638 | 710 |
fMin.setMinimum(lexicalTable.getData().getFMin()); |
639 | 711 |
fMin.setMaximum(lexicalTable.getData().getFMax()); |
712 |
fMin.setSelection(lexicalTable.getData().getFMin()); |
|
640 | 713 |
|
641 |
this.refreshTable(update); |
|
642 | 714 |
this.refreshInfos(); |
643 | 715 |
} |
716 |
|
|
717 |
this.refreshTable(update); |
|
718 |
|
|
644 | 719 |
|
645 |
|
|
646 | 720 |
QueriesView.refresh(); |
647 | 721 |
RVariablesView.refresh(); |
648 | 722 |
|
... | ... | |
651 | 725 |
|
652 | 726 |
@Override |
653 | 727 |
public void updateResultFromEditor() { |
654 |
try { |
|
655 |
lexicalTable.getData().filter(vMax.getSelection(), fMin.getSelection()); |
|
656 |
} |
|
657 |
catch (Exception e) { |
|
658 |
// TODO Auto-generated catch block |
|
659 |
e.printStackTrace(); |
|
660 |
} |
|
661 | 728 |
} |
662 | 729 |
} |
tmp/org.txm.index.rcp/plugin.xml (revision 791) | ||
---|---|---|
239 | 239 |
<extension |
240 | 240 |
point="org.eclipse.ui.preferencePages"> |
241 | 241 |
<page |
242 |
category="org.txm.rcp.preferences.UserPreferencePage" |
|
242 | 243 |
class="org.txm.index.rcp.preferences.IndexPreferencesPage" |
243 | 244 |
id="org.txm.index.rcp.preferences.IndexPreferencesPage" |
244 | 245 |
name="Index"> |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionEventCallBack.java (revision 791) | ||
---|---|---|
445 | 445 |
|
446 | 446 |
try { |
447 | 447 |
|
448 |
ArrayList<Color> seriesColors = chartEditor.getChartsEngine().getChartCreator(chartEditor.getResult()).getSeriesShapesColors(chartEditor.getChart());
|
|
448 |
ArrayList<Color> seriesColors = chartEditor.getResult().getChartCreator().getSeriesShapesColors(chartEditor.getChart());
|
|
449 | 449 |
RGBA selectedWordColor = new RGBA(255, 10, 10); |
450 | 450 |
|
451 | 451 |
//FIXME: old color |
... | ... | |
480 | 480 |
List<String> selectedWordIds = selectedWordMatch.getValuesForProperty(corpus.getProperty("id")); //$NON-NLS-1$; |
481 | 481 |
|
482 | 482 |
// Get all words to highlight from the progression chart data set |
483 |
ArrayList<ArrayList<Integer>> allPointPositionsBySeries = ((ProgressionChartCreator)chartEditor.getEditorInput().getChartsEngine().getChartCreator(chartEditor.getResult())).getAllPointPositionsBySeries(chartEditor.getChart());
|
|
483 |
ArrayList<ArrayList<Integer>> allPointPositionsBySeries = ((ProgressionChartCreator)chartEditor.getResult().getChartCreator()).getAllPointPositionsBySeries(chartEditor.getChart());
|
|
484 | 484 |
|
485 | 485 |
ArrayList<ArrayList<String>> allWordIds = new ArrayList<ArrayList<String>>(allPointPositionsBySeries.size()); |
486 | 486 |
for(int i = 0; i < allPointPositionsBySeries.size(); i++) { |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 791) | ||
---|---|---|
157 | 157 |
@Override |
158 | 158 |
public boolean compute(IProgressMonitor monitor) throws Exception { |
159 | 159 |
|
160 |
Log.finest("************** ChartResult.compute(): computing result of type " + this.getClass() + "...");
|
|
160 |
Log.finest("ChartResult.compute(): computing result of type " + this.getClass() + "..."); |
|
161 | 161 |
|
162 | 162 |
// compute the result if needed |
163 | 163 |
if(super.compute(monitor, true, false)) { |
... | ... | |
191 | 191 |
} |
192 | 192 |
|
193 | 193 |
|
194 |
ChartCreator chartCreator = this.chartsEngine.getChartCreator(this);
|
|
194 |
ChartCreator chartCreator = this.getChartCreator();
|
|
195 | 195 |
|
196 | 196 |
// try to find a chart creator in other charts engines |
197 | 197 |
if(chartCreator == null) { |
... | ... | |
238 | 238 |
|
239 | 239 |
this.chartDirty = false; |
240 | 240 |
|
241 |
|
|
242 |
// if (TBXPreferences.getBoolean(TBXPreferences.AUTO_SAVE_RESULTS, TBXPreferences.PREFERENCES_NODE)) { |
|
243 |
// System.err.println("ChartResult.renderChart(): flushing local preferences node in file for persistence tests."); |
|
244 |
// TXMPreferences.flush(this); |
|
245 |
// } |
|
246 |
|
|
247 |
|
|
248 |
|
|
249 | 241 |
// FIXME: debug |
250 |
System.err.println("ChartResult.renderChart(): chart rendering done.");
|
|
242 |
Log.finest("ChartResult.renderChart(): chart rendering done.");
|
|
251 | 243 |
|
252 | 244 |
return true; |
253 | 245 |
|
254 | 246 |
} |
255 | 247 |
else { |
256 | 248 |
// FIXME: debug |
257 |
System.err.println("ChartResult.renderChart(): can not find any suitable chart creator for result: " + this.getClass() + ".");
|
|
249 |
Log.severe("ChartResult.renderChart(): can not find any suitable chart creator for result: " + this.getClass() + ".");
|
|
258 | 250 |
return false; |
259 | 251 |
} |
260 | 252 |
} |
... | ... | |
262 | 254 |
|
263 | 255 |
@Override |
264 | 256 |
public String dumpParameters() { |
265 |
return super.dumpParameters() + "\n" + this.dumpParameters(Parameter.RENDERING); |
|
257 |
return super.dumpParameters() + "\n" + this.dumpParameters(Parameter.RENDERING); //$NON-NLS-1$
|
|
266 | 258 |
} |
267 | 259 |
|
268 | 260 |
/** |
... | ... | |
369 | 361 |
|
370 | 362 |
/** |
371 | 363 |
* Gets a chart creator for this chart result according to its current type and current charts engine. |
372 |
* @return |
|
364 |
* @return a suitable chart creator if exists, otherwise null
|
|
373 | 365 |
*/ |
374 | 366 |
public ChartCreator getChartCreator() { |
375 | 367 |
return this.chartsEngine.getChartCreator(this); |
... | ... | |
564 | 556 |
} |
565 | 557 |
|
566 | 558 |
|
567 |
|
|
559 |
|
|
568 | 560 |
// FIXME |
569 | 561 |
// public Object createChart(IProgressMonitor monitor, String chartType) { |
570 | 562 |
// Object chart = null; |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java (revision 791) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
|
5 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
5 | 6 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
6 | 7 |
import org.txm.core.engines.EngineType; |
7 | 8 |
import org.txm.core.engines.EnginesManager; |
... | ... | |
19 | 20 |
|
20 | 21 |
@Override |
21 | 22 |
public boolean fetchEngines() { |
23 |
return this.fetchEngines(ChartsEngine.EXTENSION_POINT_ID); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public boolean startEngines(IProgressMonitor monitor) { |
|
22 | 28 |
|
23 |
if(!this.fetchEngines(ChartsEngine.EXTENSION_POINT_ID)) { |
|
24 |
return false; |
|
25 |
} |
|
26 |
|
|
27 | 29 |
// FIXME: temporary solution to not break the charts engines but later need to stop to use |
28 | 30 |
// ChartsEngine.chartsEngines, ChartsEngine.currentChartsEngineIndex, getCurrent() etc. |
29 | 31 |
// and directly manage that in the Manager |
30 | 32 |
ChartsEngine.chartsEngines = new ArrayList<ChartsEngine>(); |
31 |
ChartsEngine.currentChartsEngineIndex = 0; |
|
32 |
|
|
33 |
// ChartsEngine.currentChartsEngineIndex = 0;
|
|
34 |
// |
|
33 | 35 |
for (ChartsEngine engine : engines.values()) { |
34 | 36 |
ChartsEngine.chartsEngines.add(engine); |
35 | 37 |
} |
36 | 38 |
|
37 | 39 |
//ChartsEngine.setCurrrentChartsEngine(this.getEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE))); |
38 | 40 |
|
39 |
ChartsEngine.setCurrrentChartsEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE)); |
|
40 |
|
|
41 | 41 |
this.setCurrentEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE)); |
42 |
|
|
43 |
|
|
42 | 44 |
|
43 | 45 |
//TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE); |
44 | 46 |
|
45 |
return true; |
|
47 |
|
|
48 |
return super.startEngines(monitor); |
|
46 | 49 |
} |
47 |
|
|
50 |
|
|
48 | 51 |
@Override |
49 | 52 |
public EngineType getEnginesType() { |
50 | 53 |
return EngineType.CHARTS; |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 791) | ||
---|---|---|
10 | 10 |
import org.eclipse.core.runtime.IConfigurationElement; |
11 | 11 |
import org.eclipse.core.runtime.Platform; |
12 | 12 |
import org.eclipse.core.runtime.RegistryFactory; |
13 |
import org.txm.Toolbox; |
|
13 | 14 |
import org.txm.chartsengine.core.messages.ChartsEngineCoreMessages; |
14 | 15 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
15 | 16 |
import org.txm.chartsengine.core.results.ChartResult; |
16 | 17 |
import org.txm.core.engines.Engine; |
18 |
import org.txm.core.engines.EngineType; |
|
17 | 19 |
import org.txm.core.preferences.TBXPreferences; |
18 | 20 |
import org.txm.core.preferences.TXMPreferences; |
19 | 21 |
import org.txm.utils.logger.Log; |
... | ... | |
60 | 62 |
protected static ArrayList<ChartsEngine> chartsEngines; |
61 | 63 |
|
62 | 64 |
/** |
63 |
* Current charts engine index in the charts engine list. |
|
64 |
*/ |
|
65 |
protected static int currentChartsEngineIndex; |
|
66 |
|
|
67 |
/** |
|
68 | 65 |
* Current theme. |
69 | 66 |
*/ |
70 | 67 |
protected Theme theme; |
... | ... | |
212 | 209 |
|
213 | 210 |
} |
214 | 211 |
|
215 |
/** |
|
216 |
* Creates and stores charts engines from installed extension contributions. |
|
217 |
* @param outputFormat |
|
218 |
*/ |
|
219 |
@Deprecated |
|
220 |
public static void createChartsEngines() { |
|
212 |
// /** |
|
213 |
// * Creates and stores charts engines from installed extension contributions. |
|
214 |
// * @param outputFormat |
|
215 |
// */ |
|
216 |
// @Deprecated |
|
217 |
// public static void createChartsEngines() { |
|
218 |
// |
|
219 |
// Log.finest("Looking for charts engines contributions with extension point id " + ChartsEngine.EXTENSION_POINT_ID + "."); |
|
220 |
// |
|
221 |
// ChartsEngine.chartsEngines = new ArrayList<ChartsEngine>(); |
|
222 |
// ChartsEngine.currentChartsEngineIndex = 0; |
|
223 |
// |
|
224 |
// IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(ChartsEngine.EXTENSION_POINT_ID); |
|
225 |
// |
|
226 |
// Log.finest(contributions.length + " charts engines found."); |
|
227 |
// |
|
228 |
// for(int i = 0; i < contributions.length; i++) { |
|
229 |
// try { |
|
230 |
// ChartsEngine chartsEngine = (ChartsEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
231 |
// chartsEngine.registerChartCreatorExtensions(); |
|
232 |
// ChartsEngine.chartsEngines.add(chartsEngine); |
|
233 |
// } |
|
234 |
// catch(CoreException e) { |
|
235 |
// e.printStackTrace(); |
|
236 |
// } |
|
237 |
// } |
|
238 |
// } |
|
221 | 239 |
|
222 |
Log.finest("Looking for charts engines contributions with extension point id " + ChartsEngine.EXTENSION_POINT_ID + "."); |
|
223 |
|
|
224 |
ChartsEngine.chartsEngines = new ArrayList<ChartsEngine>(); |
|
225 |
ChartsEngine.currentChartsEngineIndex = 0; |
|
226 |
|
|
227 |
IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(ChartsEngine.EXTENSION_POINT_ID); |
|
228 |
|
|
229 |
Log.finest(contributions.length + " charts engines found."); |
|
230 |
|
|
231 |
for(int i = 0; i < contributions.length; i++) { |
|
232 |
try { |
|
233 |
ChartsEngine chartsEngine = (ChartsEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
234 |
chartsEngine.registerChartCreatorExtensions(); |
|
235 |
ChartsEngine.chartsEngines.add(chartsEngine); |
|
236 |
} |
|
237 |
catch(CoreException e) { |
|
238 |
e.printStackTrace(); |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
242 |
|
|
243 | 240 |
/** |
244 | 241 |
* Gets the current charts engine. |
245 | 242 |
* @return the current charts engine |
246 | 243 |
*/ |
247 | 244 |
@Deprecated |
248 | 245 |
public static ChartsEngine getCurrent() { |
249 |
return ChartsEngine.chartsEngines.get(ChartsEngine.currentChartsEngineIndex);
|
|
246 |
return (ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getCurrentEngine();
|
|
250 | 247 |
} |
251 | 248 |
|
252 |
/** |
|
253 |
* Sets the current charts engine according to its internal name. |
|
254 |
* @param name the name of the charts engine to set as current |
|
255 |
*/ |
|
256 |
@Deprecated |
|
257 |
public static void setCurrrentChartsEngine(String name) { |
|
258 |
for(int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
259 |
if(chartsEngines.get(i).getName().equals(name)) { |
|
260 |
ChartsEngine.currentChartsEngineIndex = i; |
|
261 |
Log.info("Set current charts engine to: " + ChartsEngine.getCurrent()); |
|
262 |
break; |
|
263 |
} |
|
264 |
} |
|
265 |
} |
|
266 | 249 |
|
267 |
/** |
|
268 |
* Gets an installed charts engine according to its class type. |
|
269 |
* @param type |
|
270 |
* @return the installed charts engine according to its class type if it exists otherwise null |
|
271 |
*/ |
|
272 |
@Deprecated |
|
273 |
public static ChartsEngine getChartsEngine(Class type) { |
|
274 |
ChartsEngine chartsEngine = null; |
|
275 |
for(int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
276 |
if(ChartsEngine.chartsEngines.get(i).getClass().equals(type)) { |
|
277 |
chartsEngine = ChartsEngine.chartsEngines.get(i); |
|
278 |
break; |
|
279 |
} |
|
280 |
} |
|
281 |
return chartsEngine; |
|
282 |
} |
|
250 |
// /**
|
|
251 |
// * Gets an installed charts engine according to its class type.
|
|
252 |
// * @param type
|
|
253 |
// * @return the installed charts engine according to its class type if it exists otherwise null
|
|
254 |
// */
|
|
255 |
// @Deprecated
|
|
256 |
// public static ChartsEngine getChartsEngine(Class type) {
|
|
257 |
// ChartsEngine chartsEngine = null;
|
|
258 |
// for(int i = 0; i < ChartsEngine.chartsEngines.size(); i++) {
|
|
259 |
// if(ChartsEngine.chartsEngines.get(i).getClass().equals(type)) {
|
|
260 |
// chartsEngine = ChartsEngine.chartsEngines.get(i);
|
|
261 |
// break;
|
|
262 |
// }
|
|
263 |
// }
|
|
264 |
// return chartsEngine;
|
|
265 |
// }
|
|
283 | 266 |
|
284 | 267 |
/** |
285 | 268 |
* Gets an installed charts engine that supports the specified output format. |
... | ... | |
299 | 282 |
} |
300 | 283 |
|
301 | 284 |
|
302 |
/** |
|
303 |
* Gets an installed charts engine according to its name. |
|
304 |
* @param type |
|
305 |
* @return the installed charts engine according to its name if it exists otherwise null |
|
306 |
*/ |
|
307 |
@Deprecated |
|
308 |
public static ChartsEngine getChartsEngineByName(String name) { |
|
309 |
ChartsEngine chartsEngine = null; |
|
310 |
for(int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
311 |
if(chartsEngines.get(i).getName().equals(name)) { |
|
312 |
chartsEngine = ChartsEngine.chartsEngines.get(i); |
|
313 |
break; |
|
314 |
} |
|
315 |
} |
|
316 |
return chartsEngine; |
|
317 |
} |
|
285 |
// /** |
|
286 |
// * Gets an installed charts engine according to its name. |
|
287 |
// * @param type |
|
288 |
// * @return the installed charts engine according to its name if it exists otherwise null |
|
289 |
// */ |
|
290 |
// @Deprecated |
|
291 |
// public static ChartsEngine getChartsEngineByName(String name) { |
|
292 |
// ChartsEngine chartsEngine = null; |
|
293 |
// for(int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
294 |
// if(chartsEngines.get(i).getName().equals(name)) { |
|
295 |
// chartsEngine = ChartsEngine.chartsEngines.get(i); |
|
296 |
// break; |
|
297 |
// } |
|
298 |
// } |
|
299 |
// return chartsEngine; |
|
300 |
// } |
|
301 |
// |
|
302 |
// /** |
|
303 |
// * Gets the first charts engine that can render the specified result. |
|
304 |
// * @param result |
|
305 |
// * @return |
|
306 |
// */ |
|
307 |
// @Deprecated |
|
308 |
// public static ChartsEngine getChartsEngine(ChartResult result) { |
|
309 |
// ChartsEngine chartsEngine = null; |
|
310 |
// for (int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
311 |
// if(ChartsEngine.chartsEngines.get(i).canCreateChart(result)) { |
|
312 |
// chartsEngine = ChartsEngine.chartsEngines.get(i); |
|
313 |
// break; |
|
314 |
// } |
|
315 |
// } |
|
316 |
// return chartsEngine; |
|
317 |
// } |
|
318 | 318 |
|
319 |
/** |
|
320 |
* Gets the first charts engine that can render the specified result. |
|
321 |
* @param result |
|
322 |
* @return |
|
323 |
*/ |
|
324 |
@Deprecated |
|
325 |
public static ChartsEngine getChartsEngine(ChartResult result) { |
|
326 |
ChartsEngine chartsEngine = null; |
|
327 |
for (int i = 0; i < ChartsEngine.chartsEngines.size(); i++) { |
|
328 |
if(ChartsEngine.chartsEngines.get(i).canCreateChart(result)) { |
|
329 |
chartsEngine = ChartsEngine.chartsEngines.get(i); |
|
330 |
break; |
|
331 |
} |
|
332 |
} |
|
333 |
return chartsEngine; |
|
334 |
} |
|
335 | 319 |
|
336 |
|
|
337 | 320 |
/** |
338 | 321 |
* Returns the installed charts engine contributions. |
339 | 322 |
* @return |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 791) | ||
---|---|---|
150 | 150 |
|
151 | 151 |
try { |
152 | 152 |
AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient(); |
153 |
int nMatch = cqiClient.subCorpusSize(getQualifiedCqpId()); |
|
153 |
int nMatch = cqiClient.subCorpusSize(this.getQualifiedCqpId());
|
|
154 | 154 |
//System.out.println("n matchs: "+nMatch); |
155 | 155 |
if (nMatch == 0) { |
156 | 156 |
this.size = 0; |
... | ... | |
171 | 171 |
throw new CqiClientException(e); |
172 | 172 |
} |
173 | 173 |
long end = System.currentTimeMillis(); |
174 |
Log.finest(NLS.bind(TXMCoreMessages.END_SUBCORPUS_SIZE, new Object[]{this.name, this.size, (end - start)})); //$NON-NLS-1$
|
|
174 |
Log.finest(NLS.bind(TXMCoreMessages.END_SUBCORPUS_SIZE, new Object[]{this.name, this.size, (end - start)})); |
|
175 | 175 |
} |
176 | 176 |
return this.size; |
177 | 177 |
} |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 791) | ||
---|---|---|
311 | 311 |
|
312 | 312 |
this.frame.setVisible(true); |
313 | 313 |
|
314 |
// FIXME: useless? |
|
314 | 315 |
//this.chartEditor.registerEventCallBackExtensions(); |
315 | 316 |
|
316 | 317 |
} |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/preferences/JFCChartsEnginePreferencePage.java (revision 791) | ||
---|---|---|
34 | 34 |
|
35 | 35 |
import org.eclipse.jface.preference.ComboFieldEditor; |
36 | 36 |
import org.eclipse.ui.IWorkbench; |
37 |
import org.txm.Toolbox; |
|
37 | 38 |
import org.txm.chartsengine.core.ChartsEngine; |
38 | 39 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
39 | 40 |
import org.txm.chartsengine.jfreechart.core.preferences.JFCChartsEnginePreferences; |
40 | 41 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
41 | 42 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
43 |
import org.txm.core.engines.EngineType; |
|
42 | 44 |
import org.txm.rcp.preferences.TXMPreferencePage; |
43 | 45 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
44 | 46 |
|
... | ... | |
88 | 90 |
super.performOk(); |
89 | 91 |
|
90 | 92 |
// Change the JFC Charts engine output format |
91 |
ChartsEngine.getChartsEngine(JFCChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT));
|
|
93 |
((ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getEngine(JFCChartsEngine.class)).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT));
|
|
92 | 94 |
|
93 | 95 |
// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one |
94 | 96 |
if(ChartsEngine.getCurrent() instanceof JFCChartsEngine) { |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 791) | ||
---|---|---|
691 | 691 |
|
692 | 692 |
@Override |
693 | 693 |
public String getSimpleName() { |
694 |
return this.getParent().getSimpleName() + " (" + this.firstDimension + "," + this.secondDimension + ")"; |
|
694 |
try { |
|
695 |
return this.getParent().getSimpleName() + " (" + this.firstDimension + "," + this.secondDimension + ")"; |
|
696 |
} |
|
697 |
catch (Exception e) { |
|
698 |
return this.getEmptyName(); |
|
699 |
} |
|
695 | 700 |
} |
696 | 701 |
|
697 | 702 |
@Override |
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 791) | ||
---|---|---|
370 | 370 |
} |
371 | 371 |
|
372 | 372 |
// FIXME SJ: new version, to validate |
373 |
//this.statsData.filter(this.pVMaxFilter, this.pfMinFilter);
|
|
373 |
this.statsData.filter(this.vMaxFilter, this.fMinFilter);
|
|
374 | 374 |
// FIXME SJ: old version |
375 |
this.statsData.cut(this.vMaxFilter); |
|
375 |
//this.statsData.cut(this.vMaxFilter);
|
|
376 | 376 |
|
377 | 377 |
return true; |
378 | 378 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TableLinesViewerComparator.java (revision 791) | ||
---|---|---|
13 | 13 |
import org.eclipse.swt.widgets.TableColumn; |
14 | 14 |
|
15 | 15 |
/** |
16 |
* Viewer comparator for the lines sorting.
|
|
16 |
* Base abstract viewer comparator for table lines sorting.
|
|
17 | 17 |
* |
18 | 18 |
* @author sjacquot |
19 | 19 |
* |
tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/RasterImageChartsComponentProvider.java (revision 791) | ||
---|---|---|
44 | 44 |
|
45 | 45 |
@Override |
46 | 46 |
public ChartEditorInput createChartEditorInput(ChartResult result) { |
47 |
ChartCreator chartCreator = this.getChartsEngine().getChartCreator(result);
|
|
47 |
ChartCreator chartCreator = result.getChartCreator();
|
|
48 | 48 |
File file = chartCreator.createChartFile(result); |
49 | 49 |
// FIXME : to temporary restore the PS and PDF formats : need to be recoded if we decide to keep the PDF and PS view else to remove if we decide to keep only the feature as export |
50 | 50 |
if(this.chartsEngine.getOutputFormat() == ChartsEngine.OUTPUT_FORMAT_PS || this.chartsEngine.getOutputFormat() == ChartsEngine.OUTPUT_FORMAT_PDF) { |
tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java (revision 791) | ||
---|---|---|
87 | 87 |
preferences.putBoolean(TBXPreferences.ADD_TECH_LOGS, false); //$NON-NLS-1$ |
88 | 88 |
preferences.putBoolean(TBXPreferences.LOG_STACKTRACE, true); //$NON-NLS-1$ |
89 | 89 |
preferences.putBoolean(TBXPreferences.LOG_IN_FILE, false); //$NON-NLS-1$ |
90 |
preferences.put(TBXPreferences.LOG_LEVEL, "OFF"); //$NON-NLS-1$
|
|
90 |
preferences.put(TBXPreferences.LOG_LEVEL, "SEVERE"); //$NON-NLS-1$
|
|
91 | 91 |
|
92 | 92 |
preferences.put(TBXPreferences.UI_LOCALE, "fr"); //$NON-NLS-1$ |
93 | 93 |
|
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 791) | ||
---|---|---|
1533 | 1533 |
if (!this.isDirty() && !this.isDirtyFromHistory()) { |
1534 | 1534 |
|
1535 | 1535 |
// FIXME: Debug |
1536 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
|
|
1536 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
|
|
1537 | 1537 |
|
1538 | 1538 |
skipComputing = true; |
1539 | 1539 |
} |
1540 | 1540 |
else if (!this.isDirty()) { |
1541 | 1541 |
|
1542 | 1542 |
// FIXME: Debug |
1543 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result is not dirty, computing skipped.");
|
|
1543 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result is not dirty, computing skipped.");
|
|
1544 | 1544 |
|
1545 | 1545 |
skipComputing = true; |
1546 | 1546 |
} |
... | ... | |
1549 | 1549 |
if(!skipComputing) { |
1550 | 1550 |
|
1551 | 1551 |
// FIXME: Debug |
1552 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
|
|
1552 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
|
|
1553 | 1553 |
|
1554 | 1554 |
|
1555 | 1555 |
// // TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO |
... | ... | |
1558 | 1558 |
// SJ: other way, test the object itself |
1559 | 1559 |
if (parent != null && !parent.hasBeenComputedOnce()) { |
1560 | 1560 |
if (!this.parent.compute(monitor, false, updateLastParameters)) { |
1561 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
|
|
1561 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
|
|
1562 | 1562 |
|
1563 | 1563 |
//return false; |
1564 | 1564 |
} |
... | ... | |
1567 | 1567 |
// Computing requirements test |
1568 | 1568 |
if (!this.canCompute()) { |
1569 | 1569 |
// FIXME: Debug |
1570 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted.");
|
|
1570 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted.");
|
|
1571 | 1571 |
|
1572 | 1572 |
return false; |
1573 | 1573 |
} |
... | ... | |
1576 | 1576 |
if (!this._compute()) { |
1577 | 1577 |
|
1578 | 1578 |
// FIXME: Debug |
1579 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed.");
|
|
1579 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed.");
|
|
1580 | 1580 |
|
1581 | 1581 |
return false; |
1582 | 1582 |
} |
... | ... | |
1585 | 1585 |
if(deepComputing) { |
1586 | 1586 |
|
1587 | 1587 |
// FIXME: Debug |
1588 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " children.");
|
|
1588 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " children.");
|
|
1589 | 1589 |
|
1590 | 1590 |
|
1591 | 1591 |
for (int i = 0; i < this.children.size(); i++) { |
... | ... | |
1602 | 1602 |
} |
1603 | 1603 |
|
1604 | 1604 |
if (!this.autoSaveParametersFromAnnotations()) { |
1605 |
System.out.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to save parameters from annotations for " + this.getName() + ".");
|
|
1605 |
Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to save parameters from annotations for " + this.getName() + ".");
|
|
1606 | 1606 |
} |
1607 | 1607 |
if (!this.saveParameters()) { |
1608 |
System.out.println("TXMResult.compute():" + this.getClass().getSimpleName() + ": failed to save parameters for " + this.getName() + ".");
|
|
1608 |
Log.severe("TXMResult.compute():" + this.getClass().getSimpleName() + ": failed to save parameters for " + this.getName() + ".");
|
|
1609 | 1609 |
} |
1610 | 1610 |
|
1611 | 1611 |
// FIXME: file persistence flush tests |
1612 | 1612 |
if (TBXPreferences.getBoolean(TBXPreferences.AUTO_SAVE_RESULTS, TBXPreferences.PREFERENCES_NODE)) { |
1613 |
System.err.println("TXMResult.compute(): flushing local preferences node in file for persistence tests.");
|
|
1613 |
Log.finest("TXMResult.compute(): flushing local preferences node in file for persistence tests.");
|
|
1614 | 1614 |
TXMPreferences.flush(this); |
1615 | 1615 |
} |
1616 | 1616 |
|
... | ... | |
1618 | 1618 |
this.dirty = false; // the computing was successful, the result is no more dirty |
1619 | 1619 |
this.hasBeenComputedOnce = true; |
1620 | 1620 |
// FIXME: Debug |
1621 |
System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done.");
|
|
1621 |
Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done.");
|
|
1622 | 1622 |
} |
1623 | 1623 |
|
1624 | 1624 |
return true; |
tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java (revision 791) | ||
---|---|---|
190 | 190 |
this.setCurrentEngine(this.getEngine(name)); |
191 | 191 |
} |
192 | 192 |
|
193 |
/** |
|
194 |
* Gets an installed engine according to its class type. |
|
195 |
* @param classType |
|
196 |
* @return the installed engine according to its class type if it exists otherwise null |
|
197 |
*/ |
|
198 |
public T getEngine(Class classType) { |
|
199 |
T engine = null; |
|
200 |
for (T engine2 : this.engines.values()) { |
|
201 |
if(engine2.getClass().equals(classType)) { |
|
202 |
engine = engine2; |
|
203 |
break; |
|
204 |
} |
|
205 |
} |
|
206 |
return engine; |
|
207 |
} |
|
193 | 208 |
|
194 | 209 |
} |
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 791) | ||
---|---|---|
35 | 35 |
import java.io.IOException; |
36 | 36 |
import java.io.InputStreamReader; |
37 | 37 |
import java.lang.reflect.Constructor; |
38 |
import java.text.Collator; |
|
38 | 39 |
import java.util.ArrayList; |
39 | 40 |
import java.util.Arrays; |
40 | 41 |
import java.util.LinkedHashMap; |
42 |
import java.util.Locale; |
|
41 | 43 |
import java.util.logging.Level; |
42 | 44 |
|
43 | 45 |
import org.apache.commons.lang.StringUtils; |
... | ... | |
55 | 57 |
import org.txm.core.messages.TXMCoreMessages; |
56 | 58 |
import org.txm.core.preferences.TBXPreferences; |
57 | 59 |
import org.txm.core.preferences.TXMPreferences; |
60 |
import org.txm.core.results.TXMResult; |
|
61 |
import org.txm.objects.TxmObject; |
|
58 | 62 |
import org.txm.objects.Workspace; |
59 | 63 |
import org.txm.utils.BundleUtils; |
60 | 64 |
import org.txm.utils.OSDetector; |
... | ... | |
649 | 653 |
} |
650 | 654 |
} |
651 | 655 |
|
656 |
/** |
|
657 |
* Gets a Collator for the specified result. |
|
658 |
* The collator is created from the parent of the result if exists and if its a TXMObject (from "lang" attribute) otherwise it is created from the default locale. |
|
659 |
* @param result |
|
660 |
* @return |
|
661 |
*/ |
|
662 |
public static Collator getCollator(TXMResult result) { |
|
663 |
Locale locale = Locale.getDefault(); |
|
664 |
if (result.getParent() instanceof TxmObject) { |
|
665 |
String lang = (String) ((TxmObject) result.getParent()).getAttribute("lang"); //$NON-NLS-1$ |
|
666 |
if (lang != null) { |
|
667 |
locale = new Locale(lang); |
|
668 |
} |
|
669 |
} |
|
670 |
Collator collator = Collator.getInstance(locale); |
|
671 |
collator.setStrength(Collator.TERTIARY); |
|
672 |
return collator; |
|
673 |
} |
|
674 |
|
|
675 |
|
|
676 |
|
|
652 | 677 |
public static String getMetadataEncoding() { |
653 | 678 |
return TBXPreferences.getString(TBXPreferences.METADATA_ENCODING, TBXPreferences.PREFERENCES_NODE); |
654 | 679 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/preferences/ChartsEnginePreferencePage.java (revision 791) | ||
---|---|---|
13 | 13 |
import org.eclipse.swt.widgets.Text; |
14 | 14 |
import org.eclipse.ui.IWorkbench; |
15 | 15 |
import org.eclipse.ui.PlatformUI; |
16 |
import org.txm.Toolbox; |
|
16 | 17 |
import org.txm.chartsengine.core.ChartsEngine; |
18 |
import org.txm.chartsengine.core.ChartsEnginesManager; |
|
17 | 19 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
18 | 20 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
19 | 21 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
22 |
import org.txm.core.engines.EngineType; |
|
20 | 23 |
import org.txm.core.preferences.TBXPreferences; |
21 | 24 |
import org.txm.core.preferences.TXMPreferences; |
22 | 25 |
import org.txm.rcp.preferences.TXMPreferencePage; |
... | ... | |
131 | 134 |
|
132 | 135 |
Log.info(SWTComponentsProviderMessages.ChartsEnginePreferencePage_LOG_RECREATING_CHARTS_ENGINE); |
133 | 136 |
|
134 |
ChartsEngine.setCurrrentChartsEngine(this.getPreferenceStore().getString(ChartsEnginePreferences.CURRENT_NAME));
|
|
137 |
Toolbox.getEngineManager(EngineType.CHARTS).setCurrentEngine(this.getPreferenceStore().getString(ChartsEnginePreferences.CURRENT_NAME));
|
|
135 | 138 |
|
136 | 139 |
// Sets the new current charts SWT component provider according to the new current charts engine |
137 |
SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
|
|
140 |
SWTChartsComponentsProvider.setCurrrentComponentsProvider((ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getCurrentEngine());
|
|
138 | 141 |
|
139 | 142 |
// Set the first charts engine supported export file format as default charts export file format |
140 | 143 |
TXMPreferences.put(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0)); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 791) | ||
---|---|---|
232 | 232 |
swtChartsComponentsProvider.setChartsEngine(chartsEngine); |
233 | 233 |
|
234 | 234 |
SWTChartsComponentsProvider.chartsComponentsProviders.add(swtChartsComponentsProvider); |
235 |
Log.warning("Starting SWT charts components provider: " + swtChartsComponentsProvider); |
|
235 |
Log.warning("Starting SWT charts components provider: " + swtChartsComponentsProvider + ".");
|
|
236 | 236 |
|
237 | 237 |
|
238 | 238 |
} |
... | ... | |
263 | 263 |
SWTChartsComponentsProvider.chartsComponentsProviders.get(i).setChartsEngine(chartsEngine); |
264 | 264 |
|
265 | 265 |
SWTChartsComponentsProvider.currentChartsComponentsProviderIndex = i; |
266 |
Log.warning("Set current SWT charts components provider to: " + SWTChartsComponentsProvider.getCurrent());
|
|
266 |
Log.finest("Setting current SWT charts components provider to: " + SWTChartsComponentsProvider.getCurrent() + ".");
|
|
267 | 267 |
break; |
268 | 268 |
} |
269 | 269 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 791) | ||
---|---|---|
537 | 537 |
* @return |
538 | 538 |
*/ |
539 | 539 |
public ChartsEngine getChartsEngine() { |
540 |
return this.getEditorInput().getChartsEngine();
|
|
540 |
return this.getResult().getChartsEngine();
|
|
541 | 541 |
} |
542 | 542 |
|
543 | 543 |
/** |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java (revision 791) | ||
---|---|---|
142 | 142 |
} |
143 | 143 |
|
144 | 144 |
/** |
145 |
* Gets the charts engine linked to this editor input. |
|
146 |
* @return |
|
147 |
*/ |
|
148 |
public ChartsEngine getChartsEngine() { |
|
149 |
return this.swtChartsComponentsProvider.getChartsEngine(); |
|
150 |
} |
|
151 |
|
|
152 |
|
|
153 |
/** |
|
154 | 145 |
* Gets the chart container (for example : can be a file, an AWT/Swing component as ChartPanel for JFC, etc.). |
155 | 146 |
* @return the chartContainer |
156 | 147 |
*/ |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 791) | ||
---|---|---|
11 | 11 |
import org.eclipse.swt.widgets.Combo; |
12 | 12 |
import org.eclipse.swt.widgets.Composite; |
13 | 13 |
import org.eclipse.swt.widgets.ToolItem; |
14 |
import org.txm.Toolbox; |
|
14 | 15 |
import org.txm.chartsengine.core.ChartCreator; |
15 | 16 |
import org.txm.chartsengine.core.ChartsEngine; |
16 | 17 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
17 | 18 |
import org.txm.chartsengine.core.results.ChartResult; |
18 | 19 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
19 | 20 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
21 |
import org.txm.core.engines.EngineType; |
|
20 | 22 |
import org.txm.rcp.IImageKeys; |
21 | 23 |
import org.txm.rcp.swt.GLComposite; |
22 | 24 |
|
... | ... | |
168 | 170 |
|
169 | 171 |
|
170 | 172 |
String chartTypes[] = new String[allChartCreators.size()]; |
171 |
int currentChartTypeIndex = 0;
|
|
173 |
int currentChartCreatorIndex = 0;
|
|
172 | 174 |
|
173 | 175 |
for(int i = 0; i < allChartCreators.size(); i++) { |
174 | 176 |
|
... | ... | |
176 | 178 |
if(chartTypes[i] == null) { |
177 | 179 |
chartTypes[i] = ChartsEnginePreferences.DEFAULT_CHART_TYPE; |
178 | 180 |
} |
179 |
|
|
181 |
|
|
182 |
// preselected combo index |
|
180 | 183 |
if(this.getEditorPart().getChartType() != null && this.getEditorPart().getChartType().equals(chartTypes[i]) |
181 |
&& this.getEditorPart().getChartsEngine().getName().equals(chartsEngineNames.get(i))) { |
|
182 |
currentChartTypeIndex = i;
|
|
184 |
&& this.getEditorPart().getResult().getChartsEngine().getName().equals(chartsEngineNames.get(i))) {
|
|
185 |
currentChartCreatorIndex = i;
|
|
183 | 186 |
} |
187 |
|
|
184 | 188 |
chartTypes[i] = chartsEngineNames.get(i) + " / " + chartTypes[i]; //$NON-NLS-1$ |
189 |
|
|
185 | 190 |
} |
186 | 191 |
chartTypeCombo.setItems(chartTypes); |
187 | 192 |
|
... | ... | |
190 | 195 |
chartTypeCombo.pack(); |
191 | 196 |
chartTypeComboItem.setWidth(chartTypeCombo.getBounds().width); |
192 | 197 |
|
193 |
chartTypeCombo.select(currentChartTypeIndex);
|
|
198 |
chartTypeCombo.select(currentChartCreatorIndex);
|
|
194 | 199 |
|
195 | 200 |
|
196 | 201 |
if(allChartCreators.size() < 2) { |
... | ... | |
227 | 232 |
data[0] = StringUtils.trim(data[0]); |
228 | 233 |
data[1] = StringUtils.trim(data[1]); |
229 | 234 |
getEditorPart().getResult().setChartType(data[1]); |
230 |
getEditorPart().getResult().setChartsEngine(ChartsEngine.getChartsEngineByName(data[0]));
|
|
235 |
getEditorPart().getResult().setChartsEngine((ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getEngine(data[0]));
|
|
231 | 236 |
update = false; |
232 | 237 |
} |
233 | 238 |
|
tmp/org.txm.referencer.rcp/src/org/txm/referencer/rcp/adapters/ReferencerAdapterFactory.java (revision 791) | ||
---|---|---|
20 | 20 |
|
21 | 21 |
public static final ImageDescriptor ICON = |
22 | 22 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ReferencerAdapterFactory.class).getSymbolicName(), |
23 |
"platform:/plugin/"+ FrameworkUtil.getBundle(ReferencerAdapterFactory.class).getSymbolicName() + "/icons/functions/Referencer.png"); //$NON-NLS-1$
|
|
23 |
"platform:/plugin/"+ FrameworkUtil.getBundle(ReferencerAdapterFactory.class).getSymbolicName() + "/icons/functions/referencer.png"); //$NON-NLS-1$
|
|
24 | 24 |
|
25 | 25 |
@Override |
26 | 26 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 791) | ||
---|---|---|
43 | 43 |
import org.eclipse.swt.widgets.Spinner; |
44 | 44 |
import org.eclipse.swt.widgets.Table; |
45 | 45 |
import org.eclipse.swt.widgets.TableColumn; |
46 |
import org.txm.Toolbox; |
|
46 | 47 |
import org.txm.core.messages.TXMCoreMessages; |
47 | 48 |
import org.txm.core.results.Parameter; |
48 | 49 |
import org.txm.objects.TxmObject; |
... | ... | |
136 | 137 |
viewer.setLabelProvider(new SpecificitiesTableLabelProvider()); |
137 | 138 |
viewer.setContentProvider(ArrayContentProvider.getInstance()); |
138 | 139 |
|
139 |
// Creates the collator for sorting the lines |
|
140 |
Object resultParent = this.getResult().getParent(); |
|
141 |
Locale locale = Locale.getDefault(); |
|
142 |
if (resultParent instanceof TxmObject) { |
|
143 |
String lang = (String) ((TxmObject) resultParent).getAttribute("lang"); //$NON-NLS-1$ |
|
144 |
if (lang != null) { |
|
145 |
locale = new Locale(lang); |
|
146 |
} |
|
147 |
} |
|
148 |
final Collator collator = Collator.getInstance(locale); |
|
149 |
collator.setStrength(Collator.TERTIARY); |
|
150 |
|
|
151 | 140 |
// creates the viewer comparator |
152 |
this.viewerComparator = new SpecificitiesLinesViewerComparator(collator);
|
|
141 |
this.viewerComparator = new SpecificitiesLinesViewerComparator(Toolbox.getCollator(this.getResult()));
|
|
153 | 142 |
viewer.setComparator(this.viewerComparator); |
154 | 143 |
|
155 | 144 |
specificitesTable = viewer.getTable(); |
156 | 145 |
specificitesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2)); |
157 | 146 |
|
158 | 147 |
// create 1st column: Unit |
159 |
TableColumn typeNameColumn = new TableColumn(specificitesTable, SWT.NONE); |
|
160 |
typeNameColumn.setText(TXMCoreMessages.common_units); |
|
161 |
typeNameColumn.setToolTipText(TXMCoreMessages.common_units); |
|
162 |
typeNameColumn.setAlignment(SWT.RIGHT); |
|
163 |
typeNameColumn.pack(); |
|
164 |
typeNameColumn.setWidth((int) (typeNameColumn.getWidth() * 1.5)); |
|
165 |
viewerComparator.addSelectionAdapter(viewer, typeNameColumn, 0); |
|
148 |
TableColumn unitColumn = new TableColumn(specificitesTable, SWT.NONE); |
|
149 |
unitColumn.setText(TXMCoreMessages.common_units); |
|
150 |
unitColumn.setToolTipText(TXMCoreMessages.common_units); |
|
151 |
unitColumn.setAlignment(SWT.RIGHT); |
|
152 |
unitColumn.setWidth((int) (unitColumn.getWidth() * 1.5)); |
|
153 |
viewerComparator.addSelectionAdapter(viewer, unitColumn, 0); |
|
166 | 154 |
|
167 | 155 |
|
168 | 156 |
// create 2nd column: Frequency |
... | ... | |
193 | 181 |
TXMEditor.initContextMenu(this.specificitesTable, this.getSite(), this.viewer); |
194 | 182 |
|
195 | 183 |
// adjust UI to the original sorting |
196 |
specificitesTable.setSortColumn(typeNameColumn);
|
|
184 |
specificitesTable.setSortColumn(unitColumn);
|
|
197 | 185 |
specificitesTable.setSortDirection(SWT.UP); |
198 | 186 |
|
199 | 187 |
} catch (Exception e) { |
tmp/org.txm.chartsengine.r.rcp/src/org/txm/rcp/chartsengine/r/preferences/RChartsEnginePreferencePage.java (revision 791) | ||
---|---|---|
34 | 34 |
|
35 | 35 |
import org.eclipse.jface.preference.ComboFieldEditor; |
36 | 36 |
import org.eclipse.ui.IWorkbench; |
37 |
import org.txm.Toolbox; |
|
37 | 38 |
import org.txm.chartsengine.core.ChartsEngine; |
38 | 39 |
import org.txm.chartsengine.r.core.RChartsEngine; |
39 | 40 |
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences; |
40 | 41 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
41 | 42 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
43 |
import org.txm.core.engines.EngineType; |
|
42 | 44 |
import org.txm.rcp.preferences.TXMPreferencePage; |
43 | 45 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
44 | 46 |
|
... | ... | |
90 | 92 |
|
91 | 93 |
|
92 | 94 |
// Change the R Charts engine output format |
93 |
ChartsEngine.getChartsEngine(RChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
|
|
95 |
((ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getEngine(RChartsEngine.class)).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
|
|
94 | 96 |
|
95 | 97 |
|
96 | 98 |
// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one |
Formats disponibles : Unified diff