120 |
120 |
// private TXMEditorToolBar supplementaryButtonToolbar;
|
121 |
121 |
private ISelectionProvider selProvider;
|
122 |
122 |
|
|
123 |
/**
|
|
124 |
* null if the corpus has only one Text
|
|
125 |
*/
|
123 |
126 |
private org.eclipse.swt.widgets.Text text_text;
|
124 |
127 |
|
125 |
128 |
// private Label text_label;
|
... | ... | |
395 |
398 |
|
396 |
399 |
@Override
|
397 |
400 |
public void keyReleased(KeyEvent e) {
|
398 |
|
if (e.keyCode == 102 && (e.stateMask & SWT.CTRL) != 0) {
|
|
401 |
System.out.println(e);
|
|
402 |
if (e.character == 'f' && (e.stateMask & SWT.CTRL) != 0) {
|
399 |
403 |
getSearchEditionToolbar().openSearch(getTextSelection());
|
|
404 |
} else if (e.character == 'g' && (e.stateMask & SWT.CTRL|SWT.SHIFT) == (SWT.CTRL|SWT.SHIFT)) {
|
|
405 |
getSearchEditionToolbar().backward();
|
|
406 |
} else if (e.character == 'g' && (e.stateMask & SWT.CTRL) == (SWT.CTRL)) {
|
|
407 |
getSearchEditionToolbar().forward();
|
|
408 |
} else if (e.keyCode == SWT.ESC) {
|
|
409 |
getSearchEditionToolbar().closeSearch();
|
400 |
410 |
}
|
401 |
411 |
}
|
402 |
412 |
|
... | ... | |
463 |
473 |
|
464 |
474 |
// Navigation buttons
|
465 |
475 |
GLComposite pageNavigationComposite = new GLComposite(lowerControlsArea, SWT.NONE, EditionUIMessages.pageButtons);
|
466 |
|
pageNavigationComposite.getLayout().numColumns = 6;
|
|
476 |
pageNavigationComposite.getLayout().numColumns = 7;
|
467 |
477 |
pageNavigationComposite.getLayout().horizontalSpacing = 1;
|
|
478 |
Label l = new Label(pageNavigationComposite, SWT.NONE);
|
|
479 |
l.setText("Page ");
|
468 |
480 |
Button first = new Button(pageNavigationComposite, SWT.FLAT | SWT.PUSH);
|
469 |
481 |
Button previous = new Button(pageNavigationComposite, SWT.FLAT | SWT.PUSH);
|
470 |
482 |
page_text = new org.eclipse.swt.widgets.Text(pageNavigationComposite, SWT.BORDER);
|
... | ... | |
473 |
485 |
Button last = new Button(pageNavigationComposite, SWT.FLAT | SWT.PUSH);
|
474 |
486 |
pageNavigationComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false));
|
475 |
487 |
|
476 |
|
GLComposite textNavigationComposite = new GLComposite(lowerControlsArea, SWT.NONE, EditionUIMessages.textButtons);
|
477 |
|
textNavigationComposite.getLayout().numColumns = 7;
|
478 |
|
textNavigationComposite.getLayout().horizontalSpacing = 1;
|
479 |
|
Button firstText = new Button(textNavigationComposite, SWT.FLAT);
|
480 |
|
Button previousText = new Button(textNavigationComposite, SWT.FLAT);
|
481 |
|
text_text = new org.eclipse.swt.widgets.Text(textNavigationComposite, SWT.BORDER);
|
482 |
|
KeyStroke keys = KeyStroke.getInstance(SWT.CONTROL, SWT.SPACE);
|
483 |
|
try {
|
484 |
|
String[] text_ids = corpus.getCorpusTextIdsList();
|
485 |
|
GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, true, false);
|
486 |
|
gdata.minimumWidth = 1;
|
487 |
|
for (String text_id : text_ids) {
|
488 |
|
double s = text_id.length() * 7;
|
489 |
|
if (s > gdata.minimumWidth) {
|
490 |
|
gdata.minimumWidth = (int) s;
|
|
488 |
|
|
489 |
if (project.getTexts().size() > 1) {
|
|
490 |
GLComposite textNavigationComposite = new GLComposite(lowerControlsArea, SWT.NONE, EditionUIMessages.textButtons);
|
|
491 |
textNavigationComposite.getLayout().numColumns = 8;
|
|
492 |
textNavigationComposite.getLayout().horizontalSpacing = 1;
|
|
493 |
Label l2 = new Label(textNavigationComposite, SWT.NONE);
|
|
494 |
l2.setText("Text ");
|
|
495 |
Button firstText = new Button(textNavigationComposite, SWT.FLAT);
|
|
496 |
Button previousText = new Button(textNavigationComposite, SWT.FLAT);
|
|
497 |
text_text = new org.eclipse.swt.widgets.Text(textNavigationComposite, SWT.BORDER);
|
|
498 |
KeyStroke keys = KeyStroke.getInstance(SWT.CONTROL, SWT.SPACE);
|
|
499 |
try {
|
|
500 |
String[] text_ids = corpus.getCorpusTextIdsList();
|
|
501 |
GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, true, false);
|
|
502 |
gdata.minimumWidth = 1;
|
|
503 |
for (String text_id : text_ids) {
|
|
504 |
double s = text_id.length() * 7;
|
|
505 |
if (s > gdata.minimumWidth) {
|
|
506 |
gdata.minimumWidth = (int) s;
|
|
507 |
}
|
491 |
508 |
}
|
|
509 |
gdata.widthHint = 200;
|
|
510 |
text_text.setLayoutData(gdata);
|
|
511 |
identifiantComboAutoCompleteField = new TXMAutoCompleteField(text_text, new TextContentAdapter(), text_ids, keys);
|
|
512 |
// identifiantComboAutoCompleteField.setSelectionListener(new SelectionListener() {
|
|
513 |
// @Override
|
|
514 |
// public void widgetSelected(SelectionEvent e) {
|
|
515 |
// goToText(text_text.getText());
|
|
516 |
// }
|
|
517 |
//
|
|
518 |
// @Override
|
|
519 |
// public void widgetDefaultSelected(SelectionEvent e) { }
|
|
520 |
// });
|
492 |
521 |
}
|
493 |
|
gdata.widthHint = 200;
|
494 |
|
text_text.setLayoutData(gdata);
|
495 |
|
identifiantComboAutoCompleteField = new TXMAutoCompleteField(text_text, new TextContentAdapter(), text_ids, keys);
|
496 |
|
// identifiantComboAutoCompleteField.setSelectionListener(new SelectionListener() {
|
497 |
|
// @Override
|
498 |
|
// public void widgetSelected(SelectionEvent e) {
|
499 |
|
// goToText(text_text.getText());
|
500 |
|
// }
|
501 |
|
//
|
502 |
|
// @Override
|
503 |
|
// public void widgetDefaultSelected(SelectionEvent e) { }
|
504 |
|
// });
|
|
522 |
catch (Exception e2) {
|
|
523 |
e2.printStackTrace();
|
|
524 |
}
|
|
525 |
Cursor cursor = new Cursor(text_text.getDisplay(), SWT.CURSOR_SIZENS);
|
|
526 |
text_text.setCursor(cursor);
|
|
527 |
// text_label = new Label(textNavigationComposite, SWT.NONE);
|
|
528 |
Button nextText = new Button(textNavigationComposite, SWT.FLAT | SWT.PUSH);
|
|
529 |
Button lastText = new Button(textNavigationComposite, SWT.FLAT | SWT.PUSH);
|
|
530 |
textNavigationComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
|
531 |
// Layouts data
|
|
532 |
firstText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWINDSTART));
|
|
533 |
firstText.setToolTipText(EditionUIMessages.firstTextOfTheCorpus);
|
|
534 |
previousText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWIND));
|
|
535 |
previousText.setToolTipText(EditionUIMessages.previousText);
|
|
536 |
nextText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARD));
|
|
537 |
nextText.setToolTipText(EditionUIMessages.nextText);
|
|
538 |
lastText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARDEND));
|
|
539 |
lastText.setToolTipText(EditionUIMessages.lastTextOfTheCorpus);
|
|
540 |
|
|
541 |
nextText.addSelectionListener(new SelectionListener() {
|
|
542 |
|
|
543 |
@Override
|
|
544 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
545 |
nextText();
|
|
546 |
}
|
|
547 |
|
|
548 |
@Override
|
|
549 |
public void widgetSelected(SelectionEvent e) {
|
|
550 |
nextText();
|
|
551 |
}
|
|
552 |
});
|
|
553 |
// set listeners
|
|
554 |
previousText.addSelectionListener(new SelectionListener() {
|
|
555 |
|
|
556 |
@Override
|
|
557 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
558 |
previousText(false);
|
|
559 |
}
|
|
560 |
|
|
561 |
@Override
|
|
562 |
public void widgetSelected(SelectionEvent e) {
|
|
563 |
previousText(false);
|
|
564 |
}
|
|
565 |
});
|
|
566 |
lastText.addSelectionListener(new SelectionListener() {
|
|
567 |
|
|
568 |
@Override
|
|
569 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
570 |
lastText();
|
|
571 |
}
|
|
572 |
|
|
573 |
@Override
|
|
574 |
public void widgetSelected(SelectionEvent e) {
|
|
575 |
lastText();
|
|
576 |
}
|
|
577 |
});
|
|
578 |
// set listeners
|
|
579 |
firstText.addSelectionListener(new SelectionListener() {
|
|
580 |
|
|
581 |
@Override
|
|
582 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
583 |
firstText();
|
|
584 |
}
|
|
585 |
|
|
586 |
@Override
|
|
587 |
public void widgetSelected(SelectionEvent e) {
|
|
588 |
firstText();
|
|
589 |
}
|
|
590 |
});
|
|
591 |
|
|
592 |
text_text.addKeyListener(new KeyListener() {
|
|
593 |
|
|
594 |
@Override
|
|
595 |
public void keyReleased(KeyEvent e) {
|
|
596 |
if (identifiantComboAutoCompleteField.isOpen()) return;
|
|
597 |
|
|
598 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
|
599 |
if (identifiantComboAutoCompleteField.isOpen()) {
|
|
600 |
return; // ignore keys when content assist is opened
|
|
601 |
}
|
|
602 |
|
|
603 |
goToText(text_text.getText());
|
|
604 |
}
|
|
605 |
else if (e.keyCode == SWT.ARROW_DOWN) {
|
|
606 |
nextText();
|
|
607 |
}
|
|
608 |
else if (e.keyCode == SWT.ARROW_UP) {
|
|
609 |
previousText(false);
|
|
610 |
}
|
|
611 |
}
|
|
612 |
|
|
613 |
@Override
|
|
614 |
public void keyPressed(KeyEvent e) {}
|
|
615 |
});
|
|
616 |
text_text.addMouseWheelListener(new MouseWheelListener() {
|
|
617 |
|
|
618 |
@Override
|
|
619 |
public void mouseScrolled(MouseEvent e) {
|
|
620 |
if (identifiantComboAutoCompleteField.isOpen()) {
|
|
621 |
return;
|
|
622 |
}
|
|
623 |
|
|
624 |
if (e.count > 0) {
|
|
625 |
previousText(false);
|
|
626 |
}
|
|
627 |
else {
|
|
628 |
nextText();
|
|
629 |
}
|
|
630 |
// toolbar.getEditor().updateWordStyles();
|
|
631 |
}
|
|
632 |
});
|
505 |
633 |
}
|
506 |
|
catch (Exception e2) {
|
507 |
|
e2.printStackTrace();
|
508 |
|
}
|
509 |
|
Cursor cursor = new Cursor(text_text.getDisplay(), SWT.CURSOR_SIZENS);
|
510 |
|
text_text.setCursor(cursor);
|
511 |
|
// text_label = new Label(textNavigationComposite, SWT.NONE);
|
512 |
|
Button nextText = new Button(textNavigationComposite, SWT.FLAT | SWT.PUSH);
|
513 |
|
Button lastText = new Button(textNavigationComposite, SWT.FLAT | SWT.PUSH);
|
514 |
|
textNavigationComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
515 |
|
// Layouts data
|
516 |
|
|
517 |
634 |
if (editionsChooser != null) editionsChooser.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
|
518 |
635 |
|
519 |
636 |
// GridData buttonGridData = new GridData(GridData.END,GridData.CENTER, true, false);
|
... | ... | |
553 |
670 |
// set labels
|
554 |
671 |
page_label.setText(""); //$NON-NLS-1$
|
555 |
672 |
// text_label.setText(""); //$NON-NLS-1$
|
556 |
|
firstText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWINDSTART));
|
557 |
|
firstText.setToolTipText(EditionUIMessages.firstTextOfTheCorpus);
|
558 |
|
previousText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWIND));
|
559 |
|
previousText.setToolTipText(EditionUIMessages.previousText);
|
|
673 |
|
560 |
674 |
first.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
|
561 |
675 |
first.setToolTipText(EditionUIMessages.firstPageOfTheText);
|
562 |
676 |
previous.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
|
... | ... | |
565 |
679 |
next.setToolTipText(EditionUIMessages.nextPage);
|
566 |
680 |
last.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
|
567 |
681 |
last.setToolTipText(EditionUIMessages.lastPageOfTheText);
|
568 |
|
nextText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARD));
|
569 |
|
nextText.setToolTipText(EditionUIMessages.nextText);
|
570 |
|
lastText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARDEND));
|
571 |
|
lastText.setToolTipText(EditionUIMessages.lastTextOfTheCorpus);
|
572 |
682 |
|
573 |
683 |
page_text.addKeyListener(new KeyListener() {
|
574 |
684 |
|
... | ... | |
582 |
692 |
@Override
|
583 |
693 |
public void keyPressed(KeyEvent e) {}
|
584 |
694 |
});
|
585 |
|
text_text.addKeyListener(new KeyListener() {
|
586 |
|
|
587 |
|
@Override
|
588 |
|
public void keyReleased(KeyEvent e) {
|
589 |
|
if (identifiantComboAutoCompleteField.isOpen()) return;
|
590 |
|
|
591 |
|
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
592 |
|
if (identifiantComboAutoCompleteField.isOpen()) {
|
593 |
|
return; // ignore keys when content assist is opened
|
594 |
|
}
|
595 |
|
|
596 |
|
goToText(text_text.getText());
|
597 |
|
}
|
598 |
|
else if (e.keyCode == SWT.ARROW_DOWN) {
|
599 |
|
nextText();
|
600 |
|
}
|
601 |
|
else if (e.keyCode == SWT.ARROW_UP) {
|
602 |
|
previousText(false);
|
603 |
|
}
|
604 |
|
}
|
605 |
|
|
606 |
|
@Override
|
607 |
|
public void keyPressed(KeyEvent e) {}
|
608 |
|
});
|
609 |
|
text_text.addMouseWheelListener(new MouseWheelListener() {
|
610 |
|
|
611 |
|
@Override
|
612 |
|
public void mouseScrolled(MouseEvent e) {
|
613 |
|
if (identifiantComboAutoCompleteField.isOpen()) {
|
614 |
|
return;
|
615 |
|
}
|
616 |
|
|
617 |
|
if (e.count > 0) {
|
618 |
|
previousText(false);
|
619 |
|
}
|
620 |
|
else {
|
621 |
|
nextText();
|
622 |
|
}
|
623 |
|
// toolbar.getEditor().updateWordStyles();
|
624 |
|
}
|
625 |
|
});
|
|
695 |
|
626 |
696 |
// set listeners
|
627 |
697 |
first.addSelectionListener(new SelectionListener() {
|
628 |
698 |
|
... | ... | |
672 |
742 |
lastPage();
|
673 |
743 |
}
|
674 |
744 |
});
|
675 |
|
nextText.addSelectionListener(new SelectionListener() {
|
676 |
|
|
677 |
|
@Override
|
678 |
|
public void widgetDefaultSelected(SelectionEvent e) {
|
679 |
|
nextText();
|
680 |
|
}
|
681 |
|
|
682 |
|
@Override
|
683 |
|
public void widgetSelected(SelectionEvent e) {
|
684 |
|
nextText();
|
685 |
|
}
|
686 |
|
});
|
687 |
|
// set listeners
|
688 |
|
previousText.addSelectionListener(new SelectionListener() {
|
689 |
|
|
690 |
|
@Override
|
691 |
|
public void widgetDefaultSelected(SelectionEvent e) {
|
692 |
|
previousText(false);
|
693 |
|
}
|
694 |
|
|
695 |
|
@Override
|
696 |
|
public void widgetSelected(SelectionEvent e) {
|
697 |
|
previousText(false);
|
698 |
|
}
|
699 |
|
});
|
700 |
|
lastText.addSelectionListener(new SelectionListener() {
|
701 |
|
|
702 |
|
@Override
|
703 |
|
public void widgetDefaultSelected(SelectionEvent e) {
|
704 |
|
lastText();
|
705 |
|
}
|
706 |
|
|
707 |
|
@Override
|
708 |
|
public void widgetSelected(SelectionEvent e) {
|
709 |
|
lastText();
|
710 |
|
}
|
711 |
|
});
|
712 |
|
// set listeners
|
713 |
|
firstText.addSelectionListener(new SelectionListener() {
|
714 |
|
|
715 |
|
@Override
|
716 |
|
public void widgetDefaultSelected(SelectionEvent e) {
|
717 |
|
firstText();
|
718 |
|
}
|
719 |
|
|
720 |
|
@Override
|
721 |
|
public void widgetSelected(SelectionEvent e) {
|
722 |
|
firstText();
|
723 |
|
}
|
724 |
|
});
|
725 |
745 |
|
|
746 |
|
726 |
747 |
try {
|
727 |
748 |
// ensure all texts have build their page indexes
|
728 |
749 |
for (Text t : project.getTexts()) {
|
... | ... | |
768 |
789 |
page_text.setText(cpage.getName());
|
769 |
790 |
page_label.setText(" / " + e.getNumPages()); //$NON-NLS-1$
|
770 |
791 |
|
771 |
|
text_text.setText(p.getCurrentText().getName());
|
|
792 |
if (text_text != null) text_text.setText(p.getCurrentText().getName());
|
772 |
793 |
// try {
|
773 |
794 |
// text_label.setText(" / "+corpus.getCorpusTextIdsList().length);
|
774 |
795 |
// } catch (Exception e1) {
|
... | ... | |
1031 |
1052 |
|
1032 |
1053 |
@Override
|
1033 |
1054 |
public void updateEditorFromResult(boolean update) throws Exception {
|
1034 |
|
this.firstPage();
|
|
1055 |
//this.firstPage();
|
1035 |
1056 |
}
|
1036 |
1057 |
|
1037 |
|
|
1038 |
|
|
1039 |
|
|
1040 |
|
|
1041 |
1058 |
public LinkedHashMap<String, EditionPanel> getEditionPanels() {
|
1042 |
1059 |
return editionPanels;
|
1043 |
1060 |
}
|