Révision 1004
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 1004) | ||
---|---|---|
54 | 54 |
/** The query widgets. */ |
55 | 55 |
protected List<QueryField> queryWidgets = new ArrayList<QueryField>(); |
56 | 56 |
|
57 |
/** The corpus. */ |
|
58 |
private Corpus corpus; |
|
59 |
|
|
60 | 57 |
/** The chart type. */ |
61 | 58 |
private boolean cumulative = true; |
62 | 59 |
|
... | ... | |
78 | 75 |
/** The colors. */ |
79 | 76 |
String[] colors = DefaultTheme.colors; |
80 | 77 |
|
81 |
/** The parent. */ |
|
82 |
private Composite parent; |
|
83 | 78 |
|
84 | 79 |
private ScrolledComposite sc1; |
85 | 80 |
|
86 | 81 |
private Button densityButton; |
87 | 82 |
|
83 |
private AssistedQueryWidget queryWidget; |
|
88 | 84 |
|
85 |
private Label miniInfoLabel; |
|
89 | 86 |
|
90 | 87 |
|
91 | 88 |
|
89 |
|
|
90 |
|
|
92 | 91 |
/** |
93 | 92 |
* Queries. |
94 | 93 |
*/ |
... | ... | |
125 | 124 |
@Parameter(key=ProgressionPreferences.REPEAT_SAME_VALUES) |
126 | 125 |
protected Button repeatSameValues; |
127 | 126 |
|
128 |
private AssistedQueryWidget queryWidget; |
|
129 | 127 |
|
130 |
private Label miniInfoLabel; |
|
131 | 128 |
|
132 | 129 |
|
133 | 130 |
|
134 |
|
|
135 |
|
|
136 | 131 |
@Override |
137 | 132 |
public void __createPartControl() { |
138 | 133 |
|
... | ... | |
199 | 194 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
200 | 195 |
if (queryWidget.getRawString().length() > 0 && onPlusButtonPressed(null, queryWidget.getRawString())) { |
201 | 196 |
super.keyPressed(e); // recompute only if the query has been added |
202 |
queryWidget.setText("");
|
|
197 |
queryWidget.clearQuery();
|
|
203 | 198 |
} |
204 | 199 |
} |
205 | 200 |
} |
... | ... | |
214 | 209 |
public void widgetSelected(SelectionEvent e) { |
215 | 210 |
if (queryWidget.getRawString().length() > 0 && onPlusButtonPressed(null, queryWidget.getRawString())) { |
216 | 211 |
compute(true); |
217 |
queryWidget.setText("");
|
|
212 |
queryWidget.clearQuery();
|
|
218 | 213 |
} |
219 | 214 |
} |
220 | 215 |
|
... | ... | |
271 | 266 |
public void widgetDefaultSelected(SelectionEvent e) { } |
272 | 267 |
}); |
273 | 268 |
|
274 |
//Bande size |
|
269 |
// Bande size
|
|
275 | 270 |
typeLabel = new Label(paramPanel, SWT.NONE); |
276 | 271 |
typeLabel.setText(ProgressionUIMessages.ProgressionDialog_11); |
277 | 272 |
typeLabel.setAlignment(SWT.CENTER); |
... | ... | |
338 | 333 |
// focusLabel.setText(ProgressionUIMessages.ProgressionDialog_8); |
339 | 334 |
// focusLabel.setAlignment(SWT.CENTER); |
340 | 335 |
|
341 |
// add query button
|
|
342 |
Button plusButton = new Button(queriesFocusComposite, SWT.NONE);
|
|
343 |
plusButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
|
344 |
plusButton.setText("Add queries from file...");
|
|
336 |
// add queries from file button
|
|
337 |
Button addQueriesFromFileButton = new Button(queriesFocusComposite, SWT.NONE);
|
|
338 |
addQueriesFromFileButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
|
339 |
addQueriesFromFileButton.setText("Add queries from file...");
|
|
345 | 340 |
|
346 |
plusButton.addListener(SWT.Selection, new Listener() {
|
|
341 |
addQueriesFromFileButton.addListener(SWT.Selection, new Listener() {
|
|
347 | 342 |
@Override |
348 | 343 |
public void handleEvent(Event event) { |
349 | 344 |
FileDialog dialog = new FileDialog(event.display.getActiveShell(), SWT.OPEN); |
350 |
dialog.setText("Select a UTF-8 property file"); |
|
345 |
dialog.setText("Select an UTF-8 property file");
|
|
351 | 346 |
String path = dialog.open(); |
352 | 347 |
if (path != null) { |
353 | 348 |
Properties props = new Properties(); |
... | ... | |
376 | 371 |
} |
377 | 372 |
} |
378 | 373 |
|
379 |
public boolean onPlusButtonPressed(Event event, String defaultValue) { |
|
380 |
if (colors.length > queryWidgets.size()) { |
|
381 |
Log.info("add query field"); |
|
374 |
/** |
|
375 |
* |
|
376 |
* @param event |
|
377 |
* @param query |
|
378 |
* @return |
|
379 |
*/ |
|
380 |
public boolean onPlusButtonPressed(Event event, String query) { |
|
381 |
if (colors.length > queryWidgets.size() && !queryExists(query)) { |
|
382 |
Log.finest("Adding query field."); |
|
382 | 383 |
|
383 |
QueryField qf = addFocusQueryField(defaultValue);
|
|
384 |
QueryField qf = addFocusQueryField(query);
|
|
384 | 385 |
sc1.layout(true); |
385 | 386 |
queriesFocusComposite.layout(true); |
386 | 387 |
sc1.setMinSize(queriesFocusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
... | ... | |
391 | 392 |
return false; |
392 | 393 |
} |
393 | 394 |
|
395 |
/** |
|
396 |
* |
|
397 |
*/ |
|
394 | 398 |
public void updateMiniInfoLabelText() { |
395 | 399 |
if (queryWidgets.size() == 0) { |
396 | 400 |
miniInfoLabel.setText("No query - "); |
397 |
} else if (queryWidgets.size() == 1) { |
|
398 |
miniInfoLabel.setText(queryWidgets.size()+" query - "); |
|
399 |
} else { |
|
400 |
miniInfoLabel.setText(queryWidgets.size()+" queries - "); |
|
401 | 401 |
} |
402 |
else if (queryWidgets.size() == 1) { |
|
403 |
miniInfoLabel.setText(queryWidgets.size() + " query - "); |
|
404 |
} |
|
405 |
else { |
|
406 |
miniInfoLabel.setText(queryWidgets.size() + " queries - "); |
|
407 |
} |
|
402 | 408 |
} |
403 | 409 |
|
404 | 410 |
/** |
... | ... | |
406 | 412 |
* @author mdecorde |
407 | 413 |
* |
408 | 414 |
*/ |
415 |
// FIXME: should inherit from AssistedQueryWidget rather than wrapping an instance |
|
416 |
@Deprecated |
|
409 | 417 |
public class QueryField extends Composite { |
410 | 418 |
|
411 |
protected AssistedQueryWidget focusTextBox; |
|
419 |
/** |
|
420 |
* Assisted query widget. |
|
421 |
*/ |
|
422 |
protected AssistedQueryWidget assistedQueryWidget; |
|
412 | 423 |
|
424 |
/** |
|
425 |
* Linked editor. |
|
426 |
*/ |
|
413 | 427 |
protected TXMEditor<? extends TXMResult> editor; |
414 | 428 |
|
415 | 429 |
/** |
... | ... | |
429 | 443 |
updateMiniInfoLabelText(); |
430 | 444 |
|
431 | 445 |
|
432 |
focusTextBox = new AssistedQueryWidget(this, SWT.BORDER, getResult().getCorpus());
|
|
433 |
focusTextBox.setFocus();
|
|
434 |
focusTextBox.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
|
|
446 |
assistedQueryWidget = new AssistedQueryWidget(this, SWT.BORDER, getResult().getCorpus());
|
|
447 |
assistedQueryWidget.setFocus();
|
|
448 |
assistedQueryWidget.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
|
|
435 | 449 |
|
436 |
// listener |
|
437 |
focusTextBox.addKeyListener(new ComputeKeyListener(ProgressionEditor.this)); |
|
450 |
// key listener |
|
451 |
assistedQueryWidget.addKeyListener(new ComputeKeyListener(ProgressionEditor.this) { |
|
452 |
public void keyPressed(KeyEvent e) { |
|
453 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
|
454 |
if (!assistedQueryWidget.getRawString().isEmpty() && !queryExists(assistedQueryWidget.getRawString(), 1)) { |
|
455 |
super.keyPressed(e); |
|
456 |
} |
|
457 |
} |
|
458 |
} |
|
459 |
}); |
|
460 |
|
|
438 | 461 |
|
439 | 462 |
// delete query button |
440 | 463 |
Button minusButton = new Button(this, SWT.NONE); |
... | ... | |
444 | 467 |
@Override |
445 | 468 |
public void handleEvent(Event event) { |
446 | 469 |
if (queryWidgets.size() > 1) { |
447 |
// System.out.println("remove field"); |
|
448 | 470 |
QueryField lastwidget = QueryField.this; |
449 | 471 |
lastwidget.setSize(200, 30); |
450 | 472 |
queryWidgets.remove(QueryField.this); |
... | ... | |
456 | 478 |
} |
457 | 479 |
} |
458 | 480 |
}); |
481 |
// listener |
|
482 |
minusButton.addSelectionListener(new ComputeSelectionListener(ProgressionEditor.this)); |
|
483 |
|
|
459 | 484 |
} |
460 | 485 |
|
486 |
/** |
|
487 |
* |
|
488 |
* @param query |
|
489 |
*/ |
|
461 | 490 |
public void setQuery(String query) { |
462 |
focusTextBox.setText(query);
|
|
491 |
assistedQueryWidget.setText(query);
|
|
463 | 492 |
} |
464 | 493 |
|
465 | 494 |
public Query getQuery() { |
466 |
return focusTextBox.getQuery();
|
|
495 |
return assistedQueryWidget.getQuery();
|
|
467 | 496 |
} |
468 | 497 |
|
469 | 498 |
public void memorize() { |
470 |
focusTextBox.memorize();
|
|
499 |
assistedQueryWidget.memorize();
|
|
471 | 500 |
} |
472 | 501 |
|
473 | 502 |
public String getRawString() { |
474 |
return focusTextBox.getRawString();
|
|
503 |
return assistedQueryWidget.getRawString();
|
|
475 | 504 |
} |
476 | 505 |
} |
477 | 506 |
|
478 | 507 |
/** |
508 |
* Checks if the specified query already exists or not. |
|
509 |
* @param query |
|
510 |
* @return true if the specified query already exists, otherwise false |
|
511 |
*/ |
|
512 |
protected boolean queryExists(String query) { |
|
513 |
return this.queryExists(query, 0); |
|
514 |
} |
|
515 |
|
|
516 |
protected boolean queryExists(String query, int maxCount) { |
|
517 |
int count = 0; |
|
518 |
for (int i = 0; i < queryWidgets.size(); i++) { |
|
519 |
if (queryWidgets.get(i).getRawString().equals(query)) { |
|
520 |
count++; |
|
521 |
} |
|
522 |
} |
|
523 |
|
|
524 |
if(count > maxCount) { |
|
525 |
Log.info("The query already exists: " + query); |
|
526 |
return true; |
|
527 |
} |
|
528 |
return false; |
|
529 |
} |
|
530 |
|
|
531 |
|
|
532 |
/** |
|
479 | 533 |
* Adds a query field. |
480 | 534 |
* |
481 | 535 |
* @return the assisted query widget |
482 | 536 |
*/ |
483 |
private QueryField addFocusQueryField(String initialQuery) {
|
|
537 |
private QueryField addFocusQueryField(String query) {
|
|
484 | 538 |
|
485 | 539 |
// do not add same query twice |
486 |
if (initialQuery != null && initialQuery.length() > 0) { // test only if the initial query is set |
|
487 |
for (int i = 0; i < queryWidgets.size(); i++) { |
|
488 |
String existing = queryWidgets.get(i).getRawString(); |
|
489 |
if (existing.equals(initialQuery)) { |
|
490 |
System.out.println("The query already exists: " + initialQuery); |
|
491 |
return null; |
|
492 |
} |
|
493 |
} |
|
540 |
if(!query.isEmpty() && this.queryExists(query)) { |
|
541 |
return null; |
|
494 | 542 |
} |
495 | 543 |
|
496 | 544 |
QueryField queryField = new QueryField(this.queriesFocusComposite, SWT.NONE); |
497 |
if (initialQuery != null) { // avoid null pointer exception |
|
498 |
queryField.setQuery(initialQuery); |
|
545 |
// avoid null pointer exception |
|
546 |
if (query != null) { |
|
547 |
queryField.setQuery(query); |
|
499 | 548 |
} |
500 | 549 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false); |
501 | 550 |
queryField.setLayoutData(gridData); |
... | ... | |
517 | 566 |
@Override |
518 | 567 |
public void updateEditorFromChart(boolean update) { |
519 | 568 |
|
520 |
// create the queries fields |
|
521 |
// if (queryList == null) { |
|
522 |
// //addFocusQueryField(); |
|
523 |
// } |
|
524 |
if (queryWidgets.size() == 0 && queryList != null) { // initialize query fields |
|
569 |
// initialize query fields |
|
570 |
if (queryWidgets.size() == 0 && queryList != null) { |
|
525 | 571 |
for (Query q : queryList) { |
526 | 572 |
addFocusQueryField(q.getQueryString()); |
527 | 573 |
} |
... | ... | |
530 | 576 |
cumulative = this.getResult().isDefaultChartType(); |
531 | 577 |
cumulativeButton.setSelection(cumulative); |
532 | 578 |
densityButton.setSelection(!cumulative); |
533 |
|
|
534 |
|
|
535 | 579 |
} |
536 | 580 |
|
537 | 581 |
|
538 | 582 |
@Override |
539 | 583 |
public void updateResultFromEditor() { |
540 | 584 |
|
585 |
// create query list from widget |
|
541 | 586 |
queryList = new ArrayList<Query>(); |
542 | 587 |
for (QueryField wid : queryWidgets) { |
543 |
if (!wid.getQuery().isEmpty()) { //$NON-NLS-1$
|
|
588 |
if (!wid.getQuery().isEmpty()) { |
|
544 | 589 |
queryList.add(wid.getQuery()); |
545 | 590 |
wid.memorize(); |
546 | 591 |
} |
... | ... | |
555 | 600 |
bandeMultiplier = Float.parseFloat(smultibande); |
556 | 601 |
} catch(Exception e) { |
557 | 602 |
bandeMultiplier = 1.0f; |
558 |
System.out.println(ProgressionUIMessages.ProgressionDialog_17 + e);
|
|
603 |
Log.severe(ProgressionUIMessages.ProgressionDialog_17 + e);
|
|
559 | 604 |
StatusLine.error(ProgressionUIMessages.ProgressionDialog_17 + e); |
560 | 605 |
} |
561 | 606 |
} |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/messages/messages.properties (revision 1004) | ||
---|---|---|
14 | 14 |
CooccurrencesEditor_10 = Cofrequency |
15 | 15 |
CooccurrencesEditor_17 = Score |
16 | 16 |
CooccurrencesEditor_18 = The score threshold must be a real number ! {0} |
17 |
CooccurrencesEditor_25 = Error while reading corpus size
|
|
17 |
CooccurrencesEditor_25 = ** Error while reading corpus size.
|
|
18 | 18 |
CooccurrencesEditor_3 = Cooccurrents properties: |
19 | 19 |
CooccurrencesEditor_4 = Thresholds: Fmin ≥ |
20 | 20 |
CooccurrencesEditor_5 = \ Cmin ≥ |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/messages/messages_fr.properties (revision 1004) | ||
---|---|---|
14 | 14 |
CooccurrencesEditor_10 = Cofréquence |
15 | 15 |
CooccurrencesEditor_17 = Indice |
16 | 16 |
CooccurrencesEditor_18 = Le seuil d''indice doit être un nombre réel différent de {0} |
17 |
CooccurrencesEditor_25 = ** Une erreur est survenue lors du calcul de la taille du corpus |
|
17 |
CooccurrencesEditor_25 = ** Une erreur est survenue lors du calcul de la taille du corpus.
|
|
18 | 18 |
CooccurrencesEditor_3 = Propriétés des cooccurrents : |
19 | 19 |
CooccurrencesEditor_4 = Seuils : Fmin ≥ |
20 | 20 |
CooccurrencesEditor_5 = Cmin ≥ |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 1004) | ||
---|---|---|
306 | 306 |
propertiesSelector.setLayout(new GridLayout(4, false)); |
307 | 307 |
propertiesSelector.setCorpus(this.getCorpus()); |
308 | 308 |
propertiesSelector.setTitle(CooccurrenceUIMessages.CooccurrencesEditor_3); |
309 |
//propertiesSelector.addValueChangeListener(new ComputeListener(this)); |
|
310 | 309 |
propertiesSelector.addSelectionListener(computeSelectionListener); |
311 | 310 |
|
312 | 311 |
/* |
... | ... | |
471 | 470 |
n2Column.setText(""); //$NON-NLS-1$ |
472 | 471 |
n2Column.pack(); |
473 | 472 |
|
474 |
viewer.refresh(); |
|
475 |
currentComparator = new ScoreComparator(); |
|
476 |
setColComparator(new ScoreComparator(), scoreColumn); |
|
477 |
sort(); |
|
478 | 473 |
|
479 | 474 |
|
480 | 475 |
// Add double click, "Send to" command |
481 | 476 |
TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$ |
482 | 477 |
|
483 |
// TODO replace this with a command+menucontribution |
|
484 |
// viewer.getTable().addMouseListener(new MouseAdapter() { |
|
485 |
// @Override |
|
486 |
// public void mouseDoubleClick(MouseEvent e) { |
|
487 |
// Point mouseposition = new Point(e.x |
|
488 |
// + viewer.getTable().getHorizontalBar() |
|
489 |
// .getSelection(), e.y); |
|
490 |
// int col = getPointedColumn(mouseposition); |
|
491 |
// //System.out.println("col "+col); |
|
492 |
// switch(col) |
|
493 |
// { |
|
494 |
// default: |
|
495 |
// IStructuredSelection selection = (IStructuredSelection) |
|
496 |
// viewer.getSelection(); |
|
497 |
// CooccurrencesToConcordances.link(CooccurrencesEditor.this, |
|
498 |
// selection); |
|
499 |
// } |
|
500 |
// } |
|
501 |
// }); |
|
502 |
|
|
503 | 478 |
// Register the context menu |
504 | 479 |
TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); |
505 | 480 |
|
506 |
|
|
507 |
|
|
508 | 481 |
initializeFields(); |
509 | 482 |
|
510 |
for (TableColumn col : viewer.getTable().getColumns()) { |
|
511 |
col.pack(); |
|
483 |
// descending initial sorting on score column |
|
484 |
viewer.getTable().setSortColumn(scoreColumn); |
|
485 |
viewer.getTable().setSortDirection(SWT.UP); |
|
486 |
currentComparator = new ScoreComparator(); |
|
487 |
setColComparator(new ScoreComparator(), scoreColumn); |
|
488 |
sort(); |
|
489 |
|
|
490 |
} |
|
491 |
|
|
492 |
/** |
|
493 |
* Sets the col comparator. |
|
494 |
* |
|
495 |
* @param comp the comp |
|
496 |
* @param col the col |
|
497 |
*/ |
|
498 |
private void setColComparator(CLineComparator comp, TableColumn col) { |
|
499 |
currentComparator = comp; |
|
500 |
if (viewer.getTable().getSortColumn() != col) { |
|
501 |
viewer.getTable().setSortColumn(col); |
|
502 |
viewer.getTable().setSortDirection(SWT.UP); |
|
512 | 503 |
} |
504 |
else if (viewer.getTable().getSortDirection() == SWT.UP) { |
|
505 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
506 |
currentComparator = new ReverseComparator(currentComparator); |
|
507 |
} |
|
508 |
else { |
|
509 |
viewer.getTable().setSortDirection(SWT.UP); |
|
510 |
} |
|
511 |
if (cooc != null) { |
|
512 |
currentComparator.initialize(cooc.getCorpus()); |
|
513 |
} |
|
513 | 514 |
} |
514 | 515 |
|
516 |
|
|
515 | 517 |
/** |
516 | 518 |
* Gets the pointed column. |
517 | 519 |
* |
... | ... | |
519 | 521 |
* the mouseposition |
520 | 522 |
* @return the pointed column |
521 | 523 |
*/ |
524 |
@Deprecated |
|
525 |
// FIXME: not used anymore |
|
522 | 526 |
public int getPointedColumn(Point mouseposition) { |
523 | 527 |
int x = mouseposition.x; // + lineTableViewer.getTable().get; |
524 | 528 |
int sumWidthColumn = this.nColumn.getWidth(); |
... | ... | |
578 | 582 |
Double d = Double.parseDouble(this.TScore.getText()); |
579 | 583 |
minScore = d; |
580 | 584 |
} catch (Exception e) { |
581 |
System.out.println(NLS.bind(CooccurrenceUIMessages.CooccurrencesEditor_18, this.TScore.getText()));
|
|
585 |
Log.severe(NLS.bind(CooccurrenceUIMessages.CooccurrencesEditor_18, this.TScore.getText()));
|
|
582 | 586 |
} |
583 | 587 |
|
584 | 588 |
parameters.put(CooccurrencePreferences.MIN_SCORE, minScore); |
... | ... | |
615 | 619 |
empantPanel.setMaxRight(this.getIntParameterValue(CooccurrencePreferences.MAX_RIGHT) - 1); |
616 | 620 |
} |
617 | 621 |
|
618 |
/** |
|
619 |
* Sets the col comparator. |
|
620 |
* |
|
621 |
* @param comp |
|
622 |
* the comp |
|
623 |
* @param col |
|
624 |
* the col |
|
625 |
*/ |
|
626 |
private void setColComparator(CLineComparator comp, TableColumn col) { |
|
627 |
currentComparator = comp; |
|
628 |
if (viewer.getTable().getSortColumn() != col) { |
|
629 |
viewer.getTable().setSortColumn(col); |
|
630 |
viewer.getTable().setSortDirection(SWT.UP); |
|
631 |
} else if (viewer.getTable().getSortDirection() == SWT.UP) { |
|
632 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
633 |
currentComparator = new ReverseComparator(currentComparator); |
|
634 |
} else { |
|
635 |
viewer.getTable().setSortDirection(SWT.UP); |
|
636 |
} |
|
637 |
if (cooc != null) |
|
638 |
currentComparator.initialize(cooc.getCorpus()); |
|
639 |
} |
|
622 |
|
|
640 | 623 |
|
641 |
|
|
642 | 624 |
/** |
643 | 625 |
* Gets the corpus. |
644 | 626 |
* |
... | ... | |
672 | 654 |
try { |
673 | 655 |
cooc.sort(currentComparator); |
674 | 656 |
} catch (CqiClientException e) { |
675 |
System.err.println("Error: " + e.getLocalizedMessage());
|
|
657 |
Log.severe("Error: " + e.getLocalizedMessage());
|
|
676 | 658 |
} |
677 | 659 |
} |
678 | 660 |
}); |
679 | 661 |
} catch (Exception e) { |
680 |
System.err.println("Error: " + e.getLocalizedMessage());
|
|
662 |
Log.severe("Error: " + e.getLocalizedMessage());
|
|
681 | 663 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
682 | 664 |
} |
683 |
viewer.refresh(); |
|
665 |
// viewer.refresh(); |
|
666 |
TXMEditor.packColumns(this.viewer); |
|
684 | 667 |
} |
685 | 668 |
} |
686 | 669 |
|
... | ... | |
690 | 673 |
|
691 | 674 |
String txt = "tp " + cooc.getNumberOfKeyword() + ", vc " + cooc.getNumberOfDifferentCooccurrents() + ", tc " + cooc.getNumberOfCooccurrents(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
692 | 675 |
try { |
693 |
txt += ", T " + cooc.getCorpus().getSize();} //$NON-NLS-1$ |
|
676 |
txt += ", T " + cooc.getCorpus().getSize(); //$NON-NLS-1$ |
|
677 |
} |
|
694 | 678 |
catch (Exception e) { |
695 |
System.out.println(CooccurrenceUIMessages.CooccurrencesEditor_25);
|
|
679 |
Log.severe(CooccurrenceUIMessages.CooccurrencesEditor_25);
|
|
696 | 680 |
} |
697 | 681 |
String tooltip = "- " + txt.replaceAll(", ", "\n- "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
698 | 682 |
|
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesLinesViewerComparator.java (revision 1004) | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.text.Collator; |
7 | 7 |
|
8 |
import org.eclipse.jface.viewers.TableViewer; |
|
8 | 9 |
import org.eclipse.jface.viewers.Viewer; |
10 |
import org.eclipse.swt.events.SelectionAdapter; |
|
11 |
import org.eclipse.swt.events.SelectionEvent; |
|
12 |
import org.eclipse.swt.widgets.TableColumn; |
|
13 |
import org.txm.rcp.editors.TXMEditor; |
|
9 | 14 |
import org.txm.rcp.editors.TableLinesViewerComparator; |
10 | 15 |
|
11 | 16 |
/** |
... | ... | |
63 | 68 |
return result; |
64 | 69 |
} |
65 | 70 |
|
71 |
@Override |
|
72 |
public void addSelectionAdapter(final TableViewer viewer, final TableColumn column, final int index) { |
|
73 |
column.addSelectionListener(new SelectionAdapter() { |
|
74 |
@Override |
|
75 |
public void widgetSelected(SelectionEvent e) { |
|
76 |
|
|
77 |
boolean partScoreFirstSort = (index != 0 && (index % 2) == 0 && lastColumnIndex != index); |
|
78 |
|
|
79 |
setColumn(index); |
|
80 |
|
|
81 |
// force descending order on part score column first sorting |
|
82 |
if(partScoreFirstSort) { |
|
83 |
setDirection(DESCENDING); |
|
84 |
} |
|
85 |
viewer.getTable().setSortDirection(getDirection()); |
|
86 |
viewer.getTable().setSortColumn(column); |
|
87 |
|
|
88 |
TXMEditor.packColumns(viewer); |
|
89 |
|
|
90 |
} |
|
91 |
}); |
|
92 |
} |
|
93 |
|
|
94 |
|
|
66 | 95 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TableLinesViewerComparator.java (revision 1004) | ||
---|---|---|
96 | 96 |
} |
97 | 97 |
}); |
98 | 98 |
} |
99 |
|
|
100 |
|
|
101 |
/** |
|
102 |
* @param direction the direction to set |
|
103 |
*/ |
|
104 |
public void setDirection(int direction) { |
|
105 |
this.direction = direction; |
|
106 |
} |
|
99 | 107 |
|
100 | 108 |
|
101 | 109 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1004) | ||
---|---|---|
6 | 6 |
import java.lang.reflect.Field; |
7 | 7 |
import java.util.ArrayList; |
8 | 8 |
import java.util.Arrays; |
9 |
import java.util.Collections; |
|
10 | 9 |
import java.util.HashMap; |
11 | 10 |
import java.util.HashSet; |
12 | 11 |
import java.util.List; |
... | ... | |
55 | 54 |
import org.eclipse.ui.IWorkbenchWindow; |
56 | 55 |
import org.eclipse.ui.PartInitException; |
57 | 56 |
import org.eclipse.ui.PlatformUI; |
58 |
import org.eclipse.ui.contexts.IContextActivation; |
|
59 |
import org.eclipse.ui.contexts.IContextService; |
|
60 | 57 |
import org.eclipse.ui.menus.IMenuService; |
61 | 58 |
import org.eclipse.ui.part.EditorPart; |
62 | 59 |
import org.txm.core.results.Parameter; |
... | ... | |
98 | 95 |
*/ |
99 | 96 |
public final static String TOP_TOOLBAR_ID = "TXMEditorTopToolBar"; //$NON-NLS-1$ |
100 | 97 |
public final static String BOTTOM_TOOLBAR_ID = "TXMEditorBottomToolBar"; //$NON-NLS-1$ |
98 |
//FIXME: SJ: bad idea to use the ID as title, need to change the system |
|
101 | 99 |
public final static String COMPUTING_PARAMETERS_GROUP_ID = TXMUIMessages.TXMEditor_3; |
102 | 100 |
|
103 | 101 |
/** |
... | ... | |
641 | 639 |
|
642 | 640 |
notifyExtensions("notifyStartOfCompute"); //$NON-NLS-1$ |
643 | 641 |
if (!TXMEditor.this.getResult().compute(monitor)) { |
644 |
Log.info("TXMEditor.compute(): computing failed."); //$NON-NLS-1$
|
|
642 |
Log.severe("TXMEditor.compute(): computing failed.");
|
|
645 | 643 |
} |
646 | 644 |
notifyExtensions("notifyEndOfCompute"); //$NON-NLS-1$ |
647 | 645 |
|
... | ... | |
654 | 652 |
try { |
655 | 653 |
refresh(update); |
656 | 654 |
} catch (Exception e) { |
657 |
System.out.println("Error while refreshing editor: "+e); //$NON-NLS-1$
|
|
655 |
Log.severe("Error while refreshing the editor: " + e); //$NON-NLS-1$
|
|
658 | 656 |
Log.printStackTrace(e); |
659 | 657 |
} |
660 | 658 |
} |
... | ... | |
991 | 989 |
value = ((NewNavigationWidget)object).getCurrentPosition(); |
992 | 990 |
} |
993 | 991 |
else if(object instanceof AssistedQueryWidget) { |
994 |
value = ((AssistedQueryWidget)object).getQuery(); // save the raw query without fixes
|
|
992 |
value = ((AssistedQueryWidget)object).getQuery(); |
|
995 | 993 |
} |
996 | 994 |
else if(object instanceof QueryWidget) { |
997 | 995 |
value = ((QueryWidget)object).getQuery(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedQueryWidget.java (revision 1004) | ||
---|---|---|
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
/** |
141 |
* Clears the query test. |
|
142 |
*/ |
|
143 |
public void clearQuery() { |
|
144 |
this.querywidget.setText(""); //$NON-NLS-1$ |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
141 | 148 |
* Sets the text. |
142 | 149 |
* |
143 | 150 |
* @param query the new text |
Formats disponibles : Unified diff