532 |
532 |
@Override
|
533 |
533 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
534 |
534 |
});
|
535 |
|
Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
|
536 |
|
saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
|
537 |
|
saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
|
538 |
|
|
539 |
|
saveAnnotationButton.addSelectionListener(new SelectionListener() {
|
540 |
|
@Override
|
541 |
|
public void widgetSelected(SelectionEvent e) {
|
542 |
|
|
543 |
|
try {
|
544 |
|
AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
|
545 |
|
if (am != null && am.hasChanges()) {
|
546 |
|
// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
|
547 |
|
JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
|
548 |
|
|
549 |
|
if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
|
550 |
|
// update editor corpus
|
551 |
|
System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
|
552 |
|
}
|
553 |
|
|
554 |
|
CorporaView.refresh();
|
555 |
|
}
|
556 |
|
} catch(Exception ex) {
|
557 |
|
ex.printStackTrace();
|
558 |
|
}
|
559 |
|
}
|
560 |
|
|
561 |
|
@Override
|
562 |
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
563 |
|
});
|
|
535 |
// Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
|
|
536 |
// saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
|
|
537 |
// saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
|
|
538 |
//
|
|
539 |
// saveAnnotationButton.addSelectionListener(new SelectionListener() {
|
|
540 |
// @Override
|
|
541 |
// public void widgetSelected(SelectionEvent e) {
|
|
542 |
//
|
|
543 |
// try {
|
|
544 |
// AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
|
|
545 |
// if (am != null && am.hasChanges()) {
|
|
546 |
// // && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
|
|
547 |
// JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
|
|
548 |
//
|
|
549 |
// if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
|
|
550 |
// // update editor corpus
|
|
551 |
// System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
|
|
552 |
// }
|
|
553 |
//
|
|
554 |
// CorporaView.refresh();
|
|
555 |
// }
|
|
556 |
// } catch(Exception ex) {
|
|
557 |
// ex.printStackTrace();
|
|
558 |
// }
|
|
559 |
// }
|
|
560 |
//
|
|
561 |
// @Override
|
|
562 |
// public void widgetDefaultSelected(SelectionEvent e) { }
|
|
563 |
// });
|
564 |
564 |
|
565 |
565 |
Button closeButton = new Button(annotationArea, SWT.PUSH);
|
566 |
566 |
closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
|
... | ... | |
654 |
654 |
|
655 |
655 |
public void updateAnnotationWidgetStates() {
|
656 |
656 |
if (annotationArea == null) return; // :)
|
|
657 |
annotationArea.getDisplay().syncExec(new Runnable() {
|
657 |
658 |
|
658 |
|
if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
|
|
659 |
@Override
|
|
660 |
public void run() {
|
|
661 |
if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
|
659 |
662 |
|
660 |
|
if (getSelectedAnnotationType() != null) {
|
661 |
|
annotationValuesText.setEnabled(true);
|
|
663 |
if (getSelectedAnnotationType() != null) {
|
|
664 |
annotationValuesText.setEnabled(true);
|
662 |
665 |
|
663 |
|
affectAnnotationButton.setEnabled(true);
|
664 |
|
affectCombo.setEnabled(true);
|
665 |
|
} else {
|
666 |
|
annotationValuesText.setEnabled(false);
|
|
666 |
affectAnnotationButton.setEnabled(true);
|
|
667 |
affectCombo.setEnabled(true);
|
|
668 |
} else {
|
|
669 |
annotationValuesText.setEnabled(false);
|
667 |
670 |
|
668 |
|
affectAnnotationButton.setEnabled(false);
|
669 |
|
affectCombo.setEnabled(false);
|
670 |
|
}
|
671 |
|
} else {
|
672 |
|
annotationValuesText.setEnabled(false);
|
|
671 |
affectAnnotationButton.setEnabled(false);
|
|
672 |
affectCombo.setEnabled(false);
|
|
673 |
}
|
|
674 |
} else {
|
|
675 |
annotationValuesText.setEnabled(false);
|
673 |
676 |
|
674 |
|
if (getSelectedAnnotationType() != null) {
|
675 |
|
affectAnnotationButton.setEnabled(true);
|
676 |
|
affectCombo.setEnabled(true);
|
677 |
|
} else {
|
678 |
|
affectAnnotationButton.setEnabled(false);
|
679 |
|
affectCombo.setEnabled(false);
|
680 |
|
}
|
681 |
|
}
|
|
677 |
if (getSelectedAnnotationType() != null) {
|
|
678 |
affectAnnotationButton.setEnabled(true);
|
|
679 |
affectCombo.setEnabled(true);
|
|
680 |
} else {
|
|
681 |
affectAnnotationButton.setEnabled(false);
|
|
682 |
affectCombo.setEnabled(false);
|
|
683 |
}
|
|
684 |
}
|
682 |
685 |
|
683 |
|
if (infosAnnotTypeSelectedLink != null) {
|
684 |
|
infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
|
|
686 |
if (infosAnnotTypeSelectedLink != null) {
|
|
687 |
infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
|
|
688 |
}
|
|
689 |
if (addTypedValueLink != null) {
|
|
690 |
addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
|
|
691 |
}
|
|
692 |
|
|
693 |
if (concordance == null) {
|
|
694 |
affectAnnotationButton.setEnabled(false);
|
|
695 |
affectCombo.setEnabled(false);
|
|
696 |
}
|
685 |
697 |
}
|
686 |
|
if (addTypedValueLink != null) {
|
687 |
|
addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
|
688 |
|
}
|
689 |
|
|
690 |
|
if (concordance == null) {
|
691 |
|
affectAnnotationButton.setEnabled(false);
|
692 |
|
affectCombo.setEnabled(false);
|
693 |
|
}
|
|
698 |
});
|
694 |
699 |
}
|
695 |
700 |
|
696 |
701 |
protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
|
... | ... | |
856 |
861 |
|
857 |
862 |
public boolean notifyStartOfCompute() throws Exception {
|
858 |
863 |
if (annotationArea != null) {
|
859 |
|
AnnotationType type = getSelectedAnnotationType();
|
860 |
|
if (type != null) {
|
861 |
|
annotations.setViewAnnotation(type);
|
862 |
|
annotations.setAnnotationOverlap(true);
|
863 |
|
}
|
|
864 |
annotationArea.getDisplay().syncExec(new Runnable() {
|
|
865 |
@Override
|
|
866 |
public void run() {
|
|
867 |
AnnotationType type = getSelectedAnnotationType();
|
|
868 |
if (type != null) {
|
|
869 |
annotations.setViewAnnotation(type);
|
|
870 |
annotations.setAnnotationOverlap(true);
|
|
871 |
}
|
|
872 |
}
|
|
873 |
});
|
864 |
874 |
}
|
865 |
875 |
return true;
|
866 |
876 |
}
|
... | ... | |
870 |
880 |
|
871 |
881 |
// update annotation column width
|
872 |
882 |
if (annotationArea != null) {
|
873 |
|
annotationColumn.pack();
|
874 |
|
|
875 |
|
annotationColumn.setResizable(true);
|
|
883 |
annotationArea.getDisplay().syncExec(new Runnable() {
|
|
884 |
@Override
|
|
885 |
public void run() {
|
|
886 |
annotationColumn.pack();
|
|
887 |
annotationColumn.setResizable(true);
|
|
888 |
}
|
|
889 |
});
|
876 |
890 |
} else {
|
877 |
891 |
annotationColumn.setWidth(0);
|
878 |
892 |
}
|