Révision 3262
tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/toolbar/UnitToolbar.java (revision 3262) | ||
---|---|---|
669 | 669 |
/** |
670 | 670 |
* Highlight units of the current page |
671 | 671 |
*/ |
672 |
protected void highlightType() { |
|
672 |
protected synchronized void highlightType() {
|
|
673 | 673 |
if (unites == null) return; |
674 | 674 |
if (editor.getEditionPanels().size() == 0) return; |
675 | 675 |
|
... | ... | |
739 | 739 |
* |
740 | 740 |
* @param unite |
741 | 741 |
* @param focus if set the edition will focus ONE TIME on the unit |
742 |
* |
|
743 |
* @return true if the page is changed |
|
742 | 744 |
*/ |
743 |
private void highlightUnite(Unite unite, boolean focus, int clickedWordPosition) {
|
|
745 |
private synchronized boolean highlightUnite(Unite unite, boolean focus, int clickedWordPosition) {
|
|
744 | 746 |
int start = unite.getDeb(); |
745 | 747 |
int end = unite.getFin(); |
746 | 748 |
// System.out.println("HU: start="+start+" end="+end+" -> "+(end-start+1)); |
747 | 749 |
int len = end - start + 1; |
748 | 750 |
if (len < 0) { |
749 | 751 |
System.out.println("Error: can not highlight unit=" + unite + ": start > end."); //$NON-NLS-1$ //$NON-NLS-2$ |
750 |
return; |
|
752 |
return false;
|
|
751 | 753 |
} |
752 | 754 |
int positions[] = new int[len]; // build the positions array for CQP |
753 | 755 |
int n = 0; |
... | ... | |
802 | 804 |
// System.out.println("Word page= "+p+" current="+panel.getCurrentPage()); |
803 | 805 |
if (!cp.equals(newPage) || !panel.getCurrentText().equals(newText)) { // do we need to change page ? |
804 | 806 |
editor.goToPage(newText.getName(), newPage.getName()); |
807 |
return true; |
|
805 | 808 |
} |
806 |
else { // just reload the page to highlight words |
|
807 |
// System.out.println("NO CHANGE"); |
|
808 |
} |
|
809 | 809 |
} |
810 | 810 |
catch (Exception e1) { |
811 | 811 |
e1.printStackTrace(); |
812 | 812 |
} |
813 |
return false; |
|
813 | 814 |
} |
814 | 815 |
|
815 | 816 |
protected void onCreateButtonSelected(SelectionEvent e) { |
... | ... | |
911 | 912 |
*/ |
912 | 913 |
public void onIdentifiantComboSelected(Object e) { |
913 | 914 |
int i = navigationField.getSelectionIndex(); |
915 |
boolean pageChanged = false; |
|
914 | 916 |
if (i <= 0) { |
915 | 917 |
if (previousSelectedUnitIDS != null) { |
916 | 918 |
editor.removeHighlightWordsById(selected_unit_color, previousSelectedUnitIDS); |
... | ... | |
939 | 941 |
Unite unite = unites[i - 1]; |
940 | 942 |
// System.out.println("unite="+unite); |
941 | 943 |
// System.out.println("unite str="+uniteToWords(unite)); |
942 |
highlightUnite(unite, true, -1); |
|
944 |
pageChanged = highlightUnite(unite, true, -1);
|
|
943 | 945 |
|
944 | 946 |
updatePropertiesView(unite); |
945 | 947 |
deleteButton.setEnabled(true); |
... | ... | |
949 | 951 |
// drop_b.setEnabled(true); |
950 | 952 |
} |
951 | 953 |
|
952 |
if (e != null) editor.updateWordStyles(); |
|
954 |
if (e != null && !pageChanged) editor.updateWordStyles();
|
|
953 | 955 |
} |
954 | 956 |
|
955 | 957 |
protected void onTypecomboSelected(SelectionEvent e) { |
... | ... | |
1049 | 1051 |
} |
1050 | 1052 |
} |
1051 | 1053 |
|
1052 |
protected boolean tryHighlightingUnitsWord(String id, org.txm.searchengine.cqp.corpus.CQPCorpus c) throws CqiClientException { |
|
1054 |
protected synchronized boolean tryHighlightingUnitsWord(String id, org.txm.searchengine.cqp.corpus.CQPCorpus c) throws CqiClientException {
|
|
1053 | 1055 |
EditionPanel panel = editor.getEditionPanel(0); |
1054 | 1056 |
if (panel == null) return false; |
1055 | 1057 |
if (id != null) { |
Formats disponibles : Unified diff