51 |
51 |
import org.txm.searchengine.cqp.AbstractCqiClient;
|
52 |
52 |
import org.txm.searchengine.cqp.CQPSearchEngine;
|
53 |
53 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
|
|
54 |
import org.txm.searchengine.cqp.corpus.MainCorpus;
|
54 |
55 |
import org.txm.searchengine.cqp.corpus.Property;
|
55 |
56 |
import org.txm.searchengine.cqp.corpus.QueryResult;
|
56 |
57 |
import org.txm.searchengine.cqp.corpus.query.Match;
|
... | ... | |
64 |
65 |
import visuAnalec.elements.Unite;
|
65 |
66 |
|
66 |
67 |
public class UnitToolbar extends URSAnnotationToolbar {
|
67 |
|
|
|
68 |
|
68 |
69 |
// boolean AnalecUnitLimitCorrectionScheme = TxmPreferences.getBoolean(AnalecPreferencePage.ANALEC_LIMIT_CORRECTION_SCHEME); // use Analec scheme to fix unit limits or TXM's
|
69 |
|
|
|
70 |
|
70 |
71 |
public RGBA highlighted_unit_color = new RGBA(183, 191, 237, 0.7f);
|
71 |
|
|
|
72 |
|
72 |
73 |
public RGBA selected_unit_color = new RGBA(255, 255, 0, 0.5f);
|
73 |
|
|
|
74 |
|
74 |
75 |
private Button createButton;
|
75 |
|
|
|
76 |
|
76 |
77 |
private Button deleteButton;
|
77 |
|
|
|
78 |
|
78 |
79 |
private Button editButton;
|
79 |
|
|
|
80 |
|
80 |
81 |
private KeyListener editorKeyListener;
|
81 |
|
|
|
82 |
|
82 |
83 |
private MouseListener editorMouseListener;
|
83 |
|
|
|
84 |
|
84 |
85 |
private int fixingAnnotationLimits = 0;
|
85 |
|
|
|
86 |
|
86 |
87 |
private NavigationField navigationField;
|
87 |
|
|
|
88 |
|
88 |
89 |
private Label l;
|
89 |
|
|
|
90 |
|
90 |
91 |
private MenuListener menuListener;
|
91 |
|
|
|
92 |
|
92 |
93 |
private List<String> previousSelectedTypeUnitIDS;
|
93 |
|
|
|
94 |
|
94 |
95 |
private List<String> previousSelectedUnitIDS;
|
95 |
|
|
|
96 |
|
96 |
97 |
protected boolean startFixingUnitLimit;
|
97 |
|
|
|
98 |
|
98 |
99 |
private Combo typeCombo;
|
99 |
|
|
|
100 |
|
100 |
101 |
private Unite[] unites;
|
101 |
|
|
|
102 |
|
102 |
103 |
private String[] typesUnitesAVoir;
|
103 |
|
|
|
104 |
|
104 |
105 |
private int maxCorpusPosition;
|
105 |
|
|
|
106 |
|
106 |
107 |
private DragDetectListener dragDetectListener;
|
107 |
|
|
|
108 |
|
108 |
109 |
private Button drop_b;
|
109 |
|
|
|
110 |
|
110 |
111 |
private Button editLeftButton;
|
111 |
|
|
|
112 |
|
112 |
113 |
private Button editRightButton;
|
113 |
|
|
|
114 |
|
114 |
115 |
public UnitToolbar() {}
|
115 |
|
|
|
116 |
|
116 |
117 |
@Override
|
117 |
118 |
protected boolean _install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension extension, Composite parent, int position) throws Exception {
|
118 |
|
|
|
119 |
|
119 |
120 |
annotationArea.getLayout().numColumns = 11;
|
120 |
121 |
annotationArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
121 |
|
|
|
122 |
|
122 |
123 |
String color_palette = URSPreferences.getInstance().getString(URSPreferences.COLOR_PALETTE);
|
123 |
124 |
if ("yellow".equals(color_palette)) { //$NON-NLS-1$
|
124 |
125 |
this.highlighted_unit_color = URSAnnotationToolbar.lightyellow;
|
... | ... | |
129 |
130 |
this.selected_unit_color = URSAnnotationToolbar.green;
|
130 |
131 |
}
|
131 |
132 |
else { // custom palette
|
132 |
|
// String highlighted_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.HIGHLIGHTED_UNIT_COLOR, "255,255,176");
|
133 |
|
// String selected_unit_color_pref = TxmPreferences.get(AnalecPreferencePage.SELECTED_UNIT_COLOR, "255,255,96");
|
134 |
|
// this.highlighted_unit_color = new RGBA(highlighted_unit_color_pref, 0.7f);
|
135 |
|
// this.selected_unit_color = new RGBA(selected_unit_color_pref, 1f);
|
|
133 |
URSPreferences urs = URSPreferences.getInstance();
|
|
134 |
String highlighted_unit_color_pref = urs.getString(URSPreferences.HIGHLIGHTED_UNIT_COLOR);
|
|
135 |
String selected_unit_color_pref = urs.getString(URSPreferences.SELECTED_UNIT_COLOR);
|
|
136 |
this.highlighted_unit_color = new RGBA(highlighted_unit_color_pref);
|
|
137 |
this.selected_unit_color = new RGBA(selected_unit_color_pref);
|
136 |
138 |
}
|
137 |
|
|
|
139 |
|
138 |
140 |
// this.button = extension.getSaveButton();
|
139 |
141 |
this.maincorpus = this.editor.getCorpus().getMainCorpus();
|
140 |
142 |
try {
|
... | ... | |
145 |
147 |
Log.printStackTrace(e);
|
146 |
148 |
}
|
147 |
149 |
analecCorpus.addEventListener(this);
|
148 |
|
|
149 |
|
|
|
150 |
|
|
151 |
|
150 |
152 |
l = new Label(annotationArea, SWT.NONE);
|
151 |
153 |
l.setText(Messages.UnitToolbar_6);
|
152 |
154 |
l.setToolTipText(Messages.UnitToolbar_6);
|
153 |
155 |
l.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
154 |
|
|
|
156 |
|
155 |
157 |
typeCombo = new Combo(annotationArea, SWT.NONE | SWT.READ_ONLY);
|
156 |
158 |
typeCombo.setToolTipText(Messages.UnitToolbar_7);
|
157 |
159 |
GridData gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
|
... | ... | |
160 |
162 |
typeCombo.setSize(150, SWT.DEFAULT);
|
161 |
163 |
typeCombo.setLayoutData(gdata);
|
162 |
164 |
typeCombo.addSelectionListener(new SelectionListener() {
|
163 |
|
|
|
165 |
|
164 |
166 |
@Override
|
165 |
167 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
166 |
|
|
|
168 |
|
167 |
169 |
@Override
|
168 |
170 |
public void widgetSelected(SelectionEvent e) {
|
169 |
171 |
onTypecomboSelected(e);
|
170 |
172 |
}
|
171 |
173 |
});
|
172 |
|
|
|
174 |
|
173 |
175 |
navigationField = new NavigationField(this, SWT.NONE);
|
174 |
176 |
gdata = new GridData(GridData.FILL, GridData.CENTER, true, false);
|
175 |
177 |
navigationField.setLayoutData(gdata);
|
176 |
178 |
navigationField.addListener(SWT.Selection, new Listener() {
|
177 |
|
|
|
179 |
|
178 |
180 |
@Override
|
179 |
181 |
public void handleEvent(Event event) {
|
180 |
182 |
onIdentifiantComboSelected(event);
|
181 |
183 |
}
|
182 |
184 |
});
|
183 |
|
|
|
185 |
|
184 |
186 |
// l = new Label(this, SWT.NONE);
|
185 |
|
|
|
187 |
|
186 |
188 |
createButton = new Button(annotationArea, SWT.PUSH);
|
187 |
189 |
createButton.setText(Messages.UnitToolbar_8);
|
188 |
190 |
gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
|
189 |
191 |
createButton.setLayoutData(gdata);
|
190 |
192 |
createButton.addSelectionListener(new SelectionListener() {
|
191 |
|
|
|
193 |
|
192 |
194 |
@Override
|
193 |
195 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
194 |
|
|
|
196 |
|
195 |
197 |
@Override
|
196 |
198 |
public void widgetSelected(SelectionEvent e) {
|
197 |
199 |
onCreateButtonSelected(e);
|
198 |
200 |
}
|
199 |
201 |
});
|
200 |
|
|
|
202 |
|
201 |
203 |
deleteButton = new Button(annotationArea, SWT.PUSH);
|
202 |
204 |
gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
|
203 |
205 |
deleteButton.setLayoutData(gdata);
|
204 |
206 |
deleteButton.setImage(IImageKeys.getImage("platform:/plugin/org.txm.rcp/icons/cross.png")); //$NON-NLS-1$
|
205 |
207 |
deleteButton.setToolTipText(Messages.UnitToolbar_10);
|
206 |
208 |
deleteButton.addSelectionListener(new SelectionListener() {
|
207 |
|
|
|
209 |
|
208 |
210 |
@Override
|
209 |
211 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
210 |
|
|
|
212 |
|
211 |
213 |
@Override
|
212 |
214 |
public void widgetSelected(SelectionEvent e) {
|
213 |
215 |
onDeleteComboSelected(e);
|
214 |
216 |
}
|
215 |
217 |
});
|
216 |
|
|
|
218 |
|
217 |
219 |
l = new Label(annotationArea, SWT.NONE);
|
218 |
|
|
|
220 |
|
219 |
221 |
editLeftButton = new Button(annotationArea, SWT.TOGGLE);
|
220 |
222 |
gdata = new GridData(GridData.CENTER, GridData.CENTER, false, false);
|
221 |
223 |
editLeftButton.setLayoutData(gdata);
|
222 |
224 |
editLeftButton.setText("[ ↔"); //$NON-NLS-1$
|
223 |
225 |
editLeftButton.setToolTipText(Messages.UnitToolbar_12);
|
224 |
226 |
editLeftButton.addSelectionListener(new SelectionListener() {
|
225 |
|
|
|
227 |
|
226 |
228 |
@Override
|
227 |
229 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
228 |
|
|
|
230 |
|
229 |
231 |
@Override
|
230 |
232 |
public void widgetSelected(SelectionEvent e) {
|
231 |
233 |
onEditButtonSelected(e, 1);
|
232 |
234 |
}
|
233 |
235 |
});
|
234 |
|
|
|
236 |
|
235 |
237 |
editButton = new Button(annotationArea, SWT.TOGGLE);
|
236 |
238 |
editButton.setText("[↔]"); //$NON-NLS-1$
|
237 |
239 |
editButton.setToolTipText(Messages.UnitToolbar_14);
|
238 |
240 |
editButton.addSelectionListener(new SelectionListener() {
|
239 |
|
|
|
241 |
|
240 |
242 |
@Override
|
241 |
243 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
242 |
|
|
|
244 |
|
243 |
245 |
@Override
|
244 |
246 |
public void widgetSelected(SelectionEvent e) {
|
245 |
247 |
onEditButtonSelected(e);
|
246 |
248 |
}
|
247 |
249 |
});
|
248 |
|
|
|
250 |
|
249 |
251 |
editRightButton = new Button(annotationArea, SWT.TOGGLE);
|
250 |
252 |
editRightButton.setText("↔ ]"); //$NON-NLS-1$
|
251 |
253 |
editRightButton.setToolTipText(Messages.UnitToolbar_16);
|
252 |
254 |
editRightButton.addSelectionListener(new SelectionListener() {
|
253 |
|
|
|
255 |
|
254 |
256 |
@Override
|
255 |
257 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
256 |
|
|
|
258 |
|
257 |
259 |
@Override
|
258 |
260 |
public void widgetSelected(SelectionEvent e) {
|
259 |
261 |
onEditButtonSelected(e, 2);
|
260 |
262 |
}
|
261 |
263 |
});
|
262 |
|
|
|
264 |
|
263 |
265 |
annotationArea.layout();
|
264 |
266 |
annotationArea.getParent().layout(true);
|
265 |
267 |
editor.layout(true);
|
266 |
|
|
|
268 |
|
267 |
269 |
reloadUnits(); // reloads types
|
268 |
270 |
reloadIdentifiants();
|
269 |
|
|
|
271 |
|
270 |
272 |
createButton.setEnabled(false);
|
271 |
273 |
deleteButton.setEnabled(false);
|
272 |
274 |
editButton.setEnabled(false);
|
273 |
275 |
editLeftButton.setEnabled(false);
|
274 |
276 |
editRightButton.setEnabled(false);
|
275 |
|
|
|
277 |
|
276 |
278 |
// drop_b.setEnabled(false);
|
277 |
279 |
if (typesUnitesAVoir.length > 0) {
|
278 |
280 |
typeCombo.select(1);
|
279 |
281 |
onTypecomboSelected(null);
|
280 |
|
|
|
282 |
|
281 |
283 |
testIfAwordSpanIsSelected();
|
282 |
284 |
}
|
283 |
|
|
|
285 |
|
284 |
286 |
ElementPropertiesView.openView();
|
285 |
287 |
editor.updateWordStyles();
|
286 |
288 |
annotationArea.layout();
|
287 |
289 |
return true;
|
288 |
290 |
}
|
289 |
|
|
|
291 |
|
290 |
292 |
@Override
|
291 |
293 |
public void clearHighlight() {
|
292 |
294 |
if (previousSelectedUnitIDS != null) {
|
... | ... | |
300 |
302 |
editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
|
301 |
303 |
previousSelectedTypeUnitIDS = null; // release memory
|
302 |
304 |
}
|
303 |
|
|
|
305 |
|
304 |
306 |
if (!createButton.isDisposed()) createButton.setEnabled(false);
|
305 |
307 |
if (!deleteButton.isDisposed()) deleteButton.setEnabled(false);
|
306 |
308 |
if (!editButton.isDisposed()) editButton.setEnabled(false);
|
307 |
309 |
// drop_b.setEnabled(false);
|
308 |
310 |
}
|
309 |
|
|
|
311 |
|
310 |
312 |
@Override
|
311 |
313 |
public MouseListener getEditorClickListener() {
|
312 |
314 |
if (editorMouseListener != null) return editorMouseListener;
|
313 |
315 |
editorMouseListener = new MouseListener() {
|
314 |
|
|
|
316 |
|
315 |
317 |
boolean dblClick = false;
|
316 |
|
|
|
318 |
|
317 |
319 |
boolean debug = Log.isLoggingFineLevel();
|
318 |
|
|
|
320 |
|
319 |
321 |
private int t, x, y;
|
320 |
|
|
|
322 |
|
321 |
323 |
@Override
|
322 |
324 |
public void mouseDoubleClick(MouseEvent e) {
|
323 |
325 |
if (debug) Log.finer("DOUBLE CLICK"); //$NON-NLS-1$
|
324 |
326 |
dblClick = true;
|
325 |
|
|
|
327 |
|
326 |
328 |
EditionPanel panel = editor.getEditionPanel(0);
|
327 |
329 |
if (panel == null) return;
|
328 |
330 |
String[] ids = panel.getWordSelection(); // may be null
|
... | ... | |
336 |
338 |
// ex.printStackTrace();
|
337 |
339 |
// }
|
338 |
340 |
// }
|
339 |
|
|
|
341 |
|
340 |
342 |
if (ids != null && typeCombo.getSelectionIndex() > 0 && typeCombo.getEnabled()) {
|
341 |
343 |
createButton.setEnabled(true); // there is a text selection in the browser
|
342 |
344 |
}
|
343 |
345 |
}
|
344 |
|
|
|
346 |
|
345 |
347 |
@Override
|
346 |
348 |
public void mouseDown(MouseEvent e) {
|
347 |
349 |
if (debug) Log.finer("MOUSE DOWN"); //$NON-NLS-1$
|
... | ... | |
350 |
352 |
x = e.x;
|
351 |
353 |
y = e.y;
|
352 |
354 |
}
|
353 |
|
|
|
355 |
|
354 |
356 |
@Override
|
355 |
357 |
public void mouseUp(MouseEvent e) {
|
356 |
358 |
if (dblClick) { // doucle click raised by mouseDoubleClick
|
... | ... | |
360 |
362 |
if (debug) Log.finer("MOUSE UP"); //$NON-NLS-1$
|
361 |
363 |
EditionPanel panel = editor.getEditionPanel(0);
|
362 |
364 |
if (panel == null) return;
|
363 |
|
|
|
365 |
|
364 |
366 |
if (typeCombo.getSelectionIndex() <= 0) {
|
365 |
367 |
createButton.setEnabled(false);
|
366 |
368 |
deleteButton.setEnabled(false);
|
... | ... | |
370 |
372 |
// drop_b.setEnabled(false);
|
371 |
373 |
return; // nothing to do with annotations
|
372 |
374 |
}
|
373 |
|
|
|
375 |
|
374 |
376 |
// filter click that are not a left simple click (no drag)
|
375 |
377 |
// System.out.println("click count="+e.count+" button="+e.button+" time="+e.time+" diff="+(e.time-t)+" dist="+(Math.abs(e.x - x) + Math.abs(e.y - y)));
|
376 |
378 |
if (e.count > 1) {
|
... | ... | |
378 |
380 |
// System.out.println("not a simple click");
|
379 |
381 |
return;
|
380 |
382 |
}
|
381 |
|
|
|
383 |
|
382 |
384 |
int dist = Math.abs(e.x - x) + Math.abs(e.y - y);
|
383 |
385 |
int deltat = (e.time - t);
|
384 |
386 |
// System.out.println("deltat ="+deltat);
|
385 |
387 |
if (dist != 0 && (deltat > 120 || dist > 4)) {
|
386 |
388 |
// System.out.println(" DRAG dist="+dist+" deltat="+deltat);
|
387 |
|
|
|
389 |
|
388 |
390 |
String[] ids = panel.getWordSelection(); // may be null
|
389 |
|
|
|
391 |
|
390 |
392 |
if (fixingAnnotationLimits == 3) { // fixing limit with a mouse drag an drop
|
391 |
393 |
if (debug) Log.finer(" EDITING ANNOTATION POSITION mode=" + fixingAnnotationLimits); //$NON-NLS-1$
|
392 |
394 |
onFixingAnnotationLimits(ids);
|
393 |
395 |
return;
|
394 |
396 |
}
|
395 |
397 |
else {
|
396 |
|
|
|
398 |
|
397 |
399 |
testIfAwordSpanIsSelected(ids);
|
398 |
|
|
|
400 |
|
399 |
401 |
// panel.expandSelectionTo(ids);
|
400 |
402 |
return;
|
401 |
403 |
}
|
402 |
404 |
}
|
403 |
|
|
|
405 |
|
404 |
406 |
if (e.button != 1) {
|
405 |
407 |
if (debug) Log.finer(" NO LEFT"); //$NON-NLS-1$
|
406 |
408 |
// System.out.println("not a left click");
|
... | ... | |
411 |
413 |
// System.out.println("not a short click");
|
412 |
414 |
return;
|
413 |
415 |
}
|
414 |
|
|
|
416 |
|
415 |
417 |
String[] ids = panel.getWordSelection(); // may be null
|
416 |
|
|
|
418 |
|
417 |
419 |
if (fixingAnnotationLimits > 0) {
|
418 |
420 |
if (debug) Log.finer(" EDITING ANNOTATION POSITION mode=" + fixingAnnotationLimits); //$NON-NLS-1$
|
419 |
421 |
onFixingAnnotationLimits(ids);
|
420 |
422 |
return;
|
421 |
423 |
}
|
422 |
|
|
|
424 |
|
423 |
425 |
if (ids == null) { // clear selection
|
424 |
426 |
if (debug) Log.finer(" NO WORD SELECTION"); //$NON-NLS-1$
|
425 |
427 |
navigationField.setSelectionIndex(0); // clear selection
|
426 |
|
|
|
428 |
|
427 |
429 |
return;
|
428 |
430 |
}
|
429 |
|
|
|
431 |
|
430 |
432 |
org.txm.searchengine.cqp.corpus.CQPCorpus c = UnitToolbar.this.editor.getCorpus();
|
431 |
|
|
|
433 |
|
432 |
434 |
try {
|
433 |
435 |
if (debug) Log.finer(" HIGHLIGHTING ANNOT IF ANY AT " + ids[0]); //$NON-NLS-1$
|
434 |
436 |
if (tryHighlightingUnitsWord(ids[0], c)) {
|
... | ... | |
446 |
448 |
};
|
447 |
449 |
return editorMouseListener;
|
448 |
450 |
}
|
449 |
|
|
|
451 |
|
450 |
452 |
protected void testIfAwordSpanIsSelected() {
|
451 |
453 |
EditionPanel panel = editor.getEditionPanel(0);
|
452 |
454 |
if (panel == null) return;
|
453 |
455 |
String[] ids = panel.getWordSelection(); // may be null
|
454 |
456 |
testIfAwordSpanIsSelected(ids);
|
455 |
457 |
}
|
456 |
|
|
|
458 |
|
457 |
459 |
protected void testIfAwordSpanIsSelected(String[] ids) {
|
458 |
460 |
if (ids != null && typeCombo.getItemCount() > 1 && typeCombo.getEnabled()) {
|
459 |
461 |
// System.out.println("ids:"+Arrays.toString(ids));
|
... | ... | |
464 |
466 |
editRightButton.setEnabled(true);
|
465 |
467 |
// drop_b.setEnabled(true);
|
466 |
468 |
}
|
467 |
|
|
|
469 |
|
468 |
470 |
createButton.setEnabled(ids != null);
|
469 |
471 |
}
|
470 |
472 |
}
|
471 |
|
|
472 |
|
|
473 |
|
|
|
473 |
|
|
474 |
|
|
475 |
|
474 |
476 |
protected void onFixingAnnotationLimits(String[] ids) {
|
475 |
|
|
|
477 |
|
476 |
478 |
if (ids == null || ids.length == 0) {
|
477 |
479 |
Log.info(Messages.UnitToolbar_27);
|
478 |
480 |
return;
|
479 |
481 |
}
|
480 |
|
|
|
482 |
|
481 |
483 |
boolean uniteFixed = false;
|
482 |
484 |
int i = navigationField.getSelectionIndex();
|
483 |
485 |
if (i > 0) {
|
484 |
486 |
Unite unite = unites[i - 1];
|
485 |
|
|
|
487 |
|
486 |
488 |
try {
|
487 |
489 |
uniteFixed = updateUniteLimits(unite, ids, fixingAnnotationLimits);
|
488 |
490 |
}
|
... | ... | |
490 |
492 |
Log.warning(NLS.bind(Messages.UnitToolbar_28, ids[0]));
|
491 |
493 |
Log.printStackTrace(e1);
|
492 |
494 |
}
|
493 |
|
|
|
495 |
|
494 |
496 |
editButton.setSelection(false);
|
495 |
497 |
editLeftButton.setSelection(false);
|
496 |
498 |
editRightButton.setSelection(false);
|
497 |
499 |
fixingAnnotationLimits = 0;
|
498 |
500 |
typeCombo.setEnabled(true);
|
499 |
|
|
|
501 |
|
500 |
502 |
navigationField.setEnabled(true);
|
501 |
503 |
createButton.setEnabled(true);
|
502 |
504 |
deleteButton.setEnabled(true);
|
503 |
|
|
|
505 |
|
504 |
506 |
if (uniteFixed) {
|
505 |
507 |
// button.setEnabled(analecCorpus.isModifie());
|
506 |
508 |
reloadIdentifiants();
|
... | ... | |
512 |
514 |
}
|
513 |
515 |
}
|
514 |
516 |
}
|
515 |
|
|
516 |
|
|
517 |
|
|
|
517 |
|
|
518 |
|
|
519 |
|
518 |
520 |
@Override
|
519 |
521 |
public KeyListener getEditorKeyListener() {
|
520 |
522 |
if (editorKeyListener != null) return editorKeyListener;
|
521 |
523 |
editorKeyListener = new KeyListener() {
|
522 |
|
|
|
524 |
|
523 |
525 |
@Override
|
524 |
526 |
public void keyPressed(KeyEvent e) {}
|
525 |
|
|
|
527 |
|
526 |
528 |
@Override
|
527 |
529 |
public void keyReleased(KeyEvent e) {
|
528 |
530 |
int mask = SWT.CTRL;
|
529 |
531 |
if (Util.isMac()) mask = SWT.COMMAND;
|
530 |
|
|
|
532 |
|
531 |
533 |
if (((e.stateMask & mask) == mask)) {
|
532 |
534 |
if (e.keyCode == SWT.SPACE) {
|
533 |
535 |
int i = navigationField.getSelectionIndex();
|
... | ... | |
567 |
569 |
};
|
568 |
570 |
return editorKeyListener;
|
569 |
571 |
}
|
570 |
|
|
|
572 |
|
571 |
573 |
@Override
|
572 |
574 |
public MenuListener getMenuListener() {
|
573 |
|
|
|
575 |
|
574 |
576 |
if (menuListener != null) return menuListener;
|
575 |
|
|
|
577 |
|
576 |
578 |
this.menuListener = new MenuListener() {
|
577 |
|
|
|
579 |
|
578 |
580 |
HashSet<MenuItem> entries = new HashSet<>();
|
579 |
|
|
|
581 |
|
580 |
582 |
@Override
|
581 |
583 |
public void menuHidden(MenuEvent e) {}
|
582 |
|
|
|
584 |
|
583 |
585 |
@Override
|
584 |
586 |
public void menuShown(MenuEvent e) {
|
585 |
|
|
|
587 |
|
586 |
588 |
EditionPanel panel = editor.getEditionPanel(0);
|
587 |
589 |
if (panel == null) return;
|
588 |
590 |
Menu menu = panel.getBrowser().getMenu();
|
589 |
|
|
|
591 |
|
590 |
592 |
for (MenuItem item : entries)
|
591 |
593 |
item.dispose();
|
592 |
|
|
|
594 |
|
593 |
595 |
String[] ids = panel.getWordSelection();
|
594 |
596 |
// System.out.println("Word under mouse: "+id);
|
595 |
597 |
if (ids != null && ids.length > 0) {
|
... | ... | |
604 |
606 |
noEntries.add(i);
|
605 |
607 |
i++;
|
606 |
608 |
}
|
607 |
|
|
|
609 |
|
608 |
610 |
if (unitEntries.size() > 0) {
|
609 |
611 |
MenuItem item = new MenuItem(menu, SWT.SEPARATOR);
|
610 |
612 |
entries.add(item);
|
611 |
613 |
}
|
612 |
|
|
|
614 |
|
613 |
615 |
for (i = 0; i < unitEntries.size(); i++) {
|
614 |
616 |
final Unite unit = unitEntries.get(i);
|
615 |
617 |
final Integer unitNo = Arrays.binarySearch(unites, unit) + 1;
|
616 |
|
|
|
618 |
|
617 |
619 |
MenuItem item = new MenuItem(menu, SWT.NONE);
|
618 |
|
AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
|
619 |
|
try {
|
620 |
|
if (unit.getDeb() == unit.getFin()) {
|
621 |
|
String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[] { unit.getDeb() });
|
622 |
|
item.setText(NLS.bind(Messages.UnitToolbar_29, unit.getType() + "-" + unitNo + ":" + firstWords[0])); //$NON-NLS-2$
|
623 |
|
}
|
624 |
|
else {
|
625 |
|
String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[] { unit.getDeb(), unit.getDeb() + 1 });
|
626 |
|
item.setText(NLS.bind(Messages.UnitToolbar_32, unit.getType() + "-" + unitNo + "=" + firstWords[0] + " " + firstWords[1])); //$NON-NLS-2$ //$NON-NLS-3$
|
627 |
|
}
|
|
620 |
if (unit.getDeb() == unit.getFin()) {
|
|
621 |
item.setText(NLS.bind(Messages.UnitToolbar_29, getUnitWordSurface(maincorpus, unit, unitNo))); //$NON-NLS-2$
|
628 |
622 |
}
|
629 |
|
catch (Exception e1) {
|
630 |
|
e1.printStackTrace();
|
|
623 |
else {
|
|
624 |
item.setText(NLS.bind(Messages.UnitToolbar_32, getUnitWordSurface(maincorpus, unit, unitNo))); //$NON-NLS-2$ //$NON-NLS-3$
|
631 |
625 |
}
|
632 |
626 |
item.addSelectionListener(new SelectionListener() {
|
633 |
|
|
|
627 |
|
634 |
628 |
@Override
|
635 |
629 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
636 |
|
|
|
630 |
|
637 |
631 |
@Override
|
638 |
632 |
public void widgetSelected(SelectionEvent e) {
|
639 |
633 |
selectUniteInIdentifants(unit);
|
... | ... | |
644 |
638 |
}
|
645 |
639 |
}
|
646 |
640 |
};
|
647 |
|
|
|
641 |
|
648 |
642 |
return menuListener;
|
649 |
643 |
}
|
650 |
|
|
|
644 |
|
|
645 |
public static String getUnitWordSurface(MainCorpus maincorpus, Element elem, Object unitNo) {
|
|
646 |
AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
|
|
647 |
Unite unit = elem.getUnite0();
|
|
648 |
String no = "";
|
|
649 |
if (unitNo != null) no = "-"+unitNo;
|
|
650 |
|
|
651 |
if (unit == null) return elem.getType()+ "-" + unitNo;
|
|
652 |
|
|
653 |
try {
|
|
654 |
if (unit.getDeb() == unit.getFin()) {
|
|
655 |
String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[] { unit.getDeb() });
|
|
656 |
return unit.getType() + no + "=" + firstWords[0]; //$NON-NLS-2$
|
|
657 |
}
|
|
658 |
else {
|
|
659 |
String[] firstWords = CQI.cpos2Str(maincorpus.getWordProperty().getQualifiedName(), new int[] { unit.getDeb(), unit.getFin()});
|
|
660 |
if (unit.getFin() - unit.getDeb() > 1) {
|
|
661 |
return unit.getType() + no + "=" + firstWords[0] + " ... " + firstWords[1]; //$NON-NLS-2$ //$NON-NLS-3$
|
|
662 |
} else {
|
|
663 |
return unit.getType() + no + "=" + firstWords[0] + " " + firstWords[1]; //$NON-NLS-2$ //$NON-NLS-3$
|
|
664 |
}
|
|
665 |
}
|
|
666 |
}
|
|
667 |
catch (Exception e1) {
|
|
668 |
e1.printStackTrace();
|
|
669 |
}
|
|
670 |
return unit.getType() + "-" + unitNo;
|
|
671 |
}
|
|
672 |
|
651 |
673 |
public String uniteToWords(Unite unit) {
|
652 |
|
|
|
674 |
|
653 |
675 |
AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
|
654 |
676 |
String[] firstWords = null;
|
655 |
677 |
try {
|
... | ... | |
665 |
687 |
}
|
666 |
688 |
return StringUtils.join(firstWords, " "); //$NON-NLS-1$
|
667 |
689 |
}
|
668 |
|
|
|
690 |
|
669 |
691 |
/**
|
670 |
692 |
* Highlight units of the current page
|
671 |
693 |
*/
|
672 |
694 |
protected synchronized void highlightType() {
|
673 |
|
|
|
695 |
|
674 |
696 |
if (unites == null) return;
|
675 |
697 |
if (editor.getEditionPanels().size() == 0) return;
|
676 |
|
|
|
698 |
|
677 |
699 |
try {
|
678 |
700 |
Page page = editor.getEditionPanel(0).getCurrentPage();
|
679 |
701 |
Edition e = page.getEdition();
|
680 |
702 |
Page next = e.getNextPage(page);
|
681 |
703 |
String currentPageWordID = page.getWordId();
|
682 |
704 |
if (currentPageWordID == null || currentPageWordID.length() == 0) return;
|
683 |
|
|
|
705 |
|
684 |
706 |
String qid = maincorpus.getProperty("id").getQualifiedName();
|
685 |
707 |
int first_ids[] = CQPSearchEngine.getCqiClient().str2Id(qid, new String[] { currentPageWordID });
|
686 |
|
|
|
708 |
|
687 |
709 |
if (first_ids.length == 0) return;
|
688 |
|
|
|
710 |
|
689 |
711 |
int first_id = first_ids[0];
|
690 |
712 |
if (first_id < 0) return;
|
691 |
|
|
|
713 |
|
692 |
714 |
int last_ids[] = null;
|
693 |
715 |
if (next != null && next != page) {
|
694 |
716 |
String nextPageWordID = next.getWordId();
|
... | ... | |
699 |
721 |
}
|
700 |
722 |
}
|
701 |
723 |
}
|
702 |
|
|
|
724 |
|
703 |
725 |
int first_pos = CQPSearchEngine.getCqiClient().id2Cpos(qid, first_id)[0];
|
704 |
726 |
int last_pos = Integer.MAX_VALUE;
|
705 |
727 |
if (last_ids != null && last_ids.length > 0 && last_ids[0] != -1) {
|
... | ... | |
710 |
732 |
last_pos = v[0];
|
711 |
733 |
}
|
712 |
734 |
}
|
713 |
|
|
|
735 |
|
714 |
736 |
int n2 = 0; // first loop to determine the allpositions array length
|
715 |
737 |
for (int i = 0; i < unites.length; i++) {
|
716 |
738 |
for (int p = unites[i].getDeb(); p <= unites[i].getFin(); p++) {
|
... | ... | |
719 |
741 |
}
|
720 |
742 |
}
|
721 |
743 |
}
|
722 |
|
|
|
744 |
|
723 |
745 |
int allpositions[] = new int[n2];
|
724 |
746 |
n2 = 0;
|
725 |
747 |
for (int i = 0; i < unites.length; i++) {
|
... | ... | |
729 |
751 |
}
|
730 |
752 |
}
|
731 |
753 |
}
|
732 |
|
|
|
754 |
|
733 |
755 |
if (previousSelectedTypeUnitIDS != null) {
|
734 |
756 |
editor.removeHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
|
735 |
757 |
editor.removeFontWeightWordsById(previousSelectedTypeUnitIDS);
|
... | ... | |
737 |
759 |
}
|
738 |
760 |
String ids2[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), allpositions); //$NON-NLS-1$
|
739 |
761 |
previousSelectedTypeUnitIDS = Arrays.asList(ids2);
|
740 |
|
|
|
762 |
|
741 |
763 |
editor.addHighlightWordsById(highlighted_unit_color, previousSelectedTypeUnitIDS);
|
742 |
764 |
}
|
743 |
765 |
catch (Exception e) {
|
744 |
766 |
e.printStackTrace();
|
745 |
767 |
}
|
746 |
768 |
}
|
747 |
|
|
|
769 |
|
748 |
770 |
/**
|
749 |
771 |
* Highlight a unit and don't focus it
|
750 |
772 |
*
|
... | ... | |
767 |
789 |
for (int p = start; p <= end; p++) {
|
768 |
790 |
positions[n++] = p;
|
769 |
791 |
}
|
770 |
|
|
|
792 |
|
771 |
793 |
try {
|
772 |
794 |
if (previousSelectedUnitIDS != null) { // remove previous highlighted words
|
773 |
795 |
editor.removeHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
|
774 |
796 |
editor.removeFontWeightWordsById(previousSelectedUnitIDS);
|
775 |
797 |
previousSelectedUnitIDS = null; // release memory
|
776 |
798 |
}
|
777 |
|
|
|
799 |
|
778 |
800 |
String ids[] = CQPSearchEngine.getCqiClient().cpos2Str(maincorpus.getProperty("id").getQualifiedName(), positions); //$NON-NLS-1$
|
779 |
801 |
// System.out.println("Highlight words with ids="+Arrays.toString(ids));
|
780 |
|
|
|
802 |
|
781 |
803 |
// positions = new int[]{positions[0]};
|
782 |
804 |
Property text_id = maincorpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
|
783 |
805 |
int[] text_strucs = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
|
784 |
806 |
String[] text_ids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), text_strucs);
|
785 |
|
|
|
807 |
|
786 |
808 |
String firstWordId = ids[0];
|
787 |
809 |
String firstWordTextId = text_ids[0];
|
788 |
810 |
if (clickedWordPosition >= 0 && clickedWordPosition < ids.length) {
|
789 |
811 |
firstWordId = ids[clickedWordPosition];
|
790 |
812 |
firstWordTextId = text_ids[clickedWordPosition];
|
791 |
813 |
}
|
792 |
|
|
793 |
|
|
|
814 |
|
|
815 |
|
794 |
816 |
EditionPanel panel = editor.getEditionPanel(0);
|
795 |
817 |
Edition e = panel.getEdition();
|
796 |
818 |
Project corpus = e.getText().getProject();
|
... | ... | |
803 |
825 |
Edition newEdition = newText.getEdition(e.getName()); // get the edition of the new text
|
804 |
826 |
Page newPage = newEdition.getPageForWordId(firstWordId); // find out the page containing the word
|
805 |
827 |
// System.out.println("page="+p+" current page="+panel.getCurrentPage());
|
806 |
|
|
|
828 |
|
807 |
829 |
previousSelectedUnitIDS = Arrays.asList(ids);
|
808 |
830 |
editor.addHighlightWordsById(selected_unit_color, previousSelectedUnitIDS);
|
809 |
831 |
editor.addFontWeightWordsById(EditionPanel.WEIGHT_BOLD, previousSelectedUnitIDS);
|
810 |
|
|
|
832 |
|
811 |
833 |
if (previousSelectedUnitIDS.size() > 0 && focus) {
|
812 |
834 |
editor.setFocusedWordID(previousSelectedUnitIDS.get(0));
|
813 |
835 |
}
|
... | ... | |
823 |
845 |
}
|
824 |
846 |
return false;
|
825 |
847 |
}
|
826 |
|
|
|
848 |
|
827 |
849 |
protected void onCreateButtonSelected(SelectionEvent e) {
|
828 |
850 |
// System.out.println("onCreateButtonSelected");
|
829 |
851 |
int[] startend = getSelectionStartEndWordPositions();
|
... | ... | |
831 |
853 |
Log.info(NLS.bind(Messages.UnitToolbar_44, startend[0], startend[1]));
|
832 |
854 |
Unite unite = UnitToolbar.this.vue.getCorpus().addUniteSaisie(typeCombo.getText(), startend[0], startend[1]);
|
833 |
855 |
Structure structure = UnitToolbar.this.analecCorpus.getStructure();
|
834 |
|
for (String prop : unite.getProps().keySet())
|
|
856 |
for (String prop : unite.getProps().keySet()) {
|
835 |
857 |
unite.getProps().put(prop, structure.getValeurParDefaut(unite.getClass(), unite.getType(), prop));
|
|
858 |
}
|
836 |
859 |
|
837 |
860 |
reloadIdentifiants();
|
838 |
861 |
selectUniteInIdentifants(unite);
|
839 |
862 |
// highlightUnite(unite, true, -1);
|
840 |
|
|
|
863 |
|
841 |
864 |
deleteButton.setEnabled(true);
|
842 |
865 |
editLeftButton.setEnabled(true);
|
843 |
866 |
editButton.setEnabled(true);
|
... | ... | |
847 |
870 |
setFocusInPropertiesView();
|
848 |
871 |
fireIsDirty();
|
849 |
872 |
}
|
850 |
|
|
|
873 |
|
851 |
874 |
if (e != null) editor.updateWordStyles();
|
852 |
875 |
}
|
853 |
|
|
|
876 |
|
854 |
877 |
protected void onDeleteComboSelected(Object e) {
|
855 |
878 |
int i = navigationField.getSelectionIndex();
|
856 |
879 |
if (i <= 0) return;
|
857 |
880 |
// System.out.println("Delete unite at i="+i);
|
858 |
881 |
Unite unite = unites[i - 1];
|
859 |
|
|
|
882 |
|
860 |
883 |
String id = navigationField.getText();
|
861 |
|
|
|
884 |
|
862 |
885 |
ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(),
|
863 |
886 |
"org.txm.annotation.urs.delete",
|
864 |
887 |
NLS.bind(Messages.UnitToolbar_47, id),
|
865 |
888 |
NLS.bind(Messages.UnitToolbar_48, id));
|
866 |
889 |
if (dialog.open() == ConfirmDialog.CANCEL) return;
|
867 |
|
|
|
890 |
|
868 |
891 |
// System.out.println("unite "+unite.toString());
|
869 |
892 |
UnitToolbar.this.vue.getCorpus().supUnite(unite);
|
870 |
893 |
reloadIdentifiants();
|
871 |
|
|
|
894 |
|
872 |
895 |
i = typeCombo.getSelectionIndex();
|
873 |
896 |
if (i > 0) {
|
874 |
897 |
highlightType();
|
875 |
898 |
}
|
876 |
899 |
fireIsDirty();
|
877 |
|
|
|
900 |
|
878 |
901 |
if (e != null) editor.updateWordStyles();
|
879 |
902 |
}
|
880 |
|
|
|
903 |
|
881 |
904 |
protected void onEditButtonSelected(SelectionEvent e) {
|
882 |
905 |
onEditButtonSelected(e, 3);
|
883 |
906 |
}
|
884 |
|
|
|
907 |
|
885 |
908 |
protected void onEditButtonSelected(SelectionEvent e, int mode) {
|
886 |
909 |
if (mode == 0) { // select unit, select words, click the edit button -> deprecated
|
887 |
910 |
int i = navigationField.getSelectionIndex();
|
... | ... | |
915 |
938 |
fireIsDirty();
|
916 |
939 |
if (e != null) editor.updateWordStyles();
|
917 |
940 |
}
|
918 |
|
|
|
941 |
|
919 |
942 |
/**
|
920 |
943 |
* called when the NavigationField changed its selection
|
921 |
944 |
*
|
... | ... | |
931 |
954 |
previousSelectedUnitIDS = null; // release memory
|
932 |
955 |
}
|
933 |
956 |
highlightType();
|
934 |
|
|
|
957 |
|
935 |
958 |
clearPropertiesView(); // unload the selected element if any
|
936 |
959 |
createButton.setEnabled(false);
|
937 |
960 |
deleteButton.setEnabled(false);
|
... | ... | |
953 |
976 |
// System.out.println("unite="+unite);
|
954 |
977 |
// System.out.println("unite str="+uniteToWords(unite));
|
955 |
978 |
pageChanged = highlightUnite(unite, true, -1);
|
956 |
|
|
|
979 |
|
957 |
980 |
updatePropertiesView(unite);
|
958 |
981 |
deleteButton.setEnabled(true);
|
959 |
982 |
editLeftButton.setEnabled(true);
|
... | ... | |
961 |
984 |
editRightButton.setEnabled(true);
|
962 |
985 |
// drop_b.setEnabled(true);
|
963 |
986 |
}
|
964 |
|
|
|
987 |
|
965 |
988 |
if (e != null && !pageChanged) editor.updateWordStyles();
|
966 |
989 |
}
|
967 |
|
|
|
990 |
|
968 |
991 |
protected void onTypecomboSelected(SelectionEvent e) {
|
969 |
992 |
reloadIdentifiants();
|
970 |
|
|
|
993 |
|
971 |
994 |
if (typeCombo.getSelectionIndex() > 0) {
|
972 |
995 |
// String type = unitesAVoir[typeCombo.getSelectionIndex()-1];
|
973 |
996 |
highlightType();
|
... | ... | |
977 |
1000 |
clearHighlight();
|
978 |
1001 |
navigationField.setEnabled(false);
|
979 |
1002 |
}
|
980 |
|
|
|
1003 |
|
981 |
1004 |
createButton.setEnabled(false);
|
982 |
1005 |
deleteButton.setEnabled(false);
|
983 |
1006 |
editButton.setEnabled(false);
|
984 |
1007 |
// drop_b.setEnabled(false);
|
985 |
1008 |
if (e != null) editor.updateWordStyles();
|
986 |
1009 |
}
|
987 |
|
|
|
1010 |
|
988 |
1011 |
/**
|
989 |
1012 |
* reload the identifiants combo
|
990 |
1013 |
*
|
... | ... | |
997 |
1020 |
navigationField.setIdentifiants(identifiants, type0, Unite.class);
|
998 |
1021 |
navigationField.setSelectionIndex(0);
|
999 |
1022 |
}
|
1000 |
|
|
|
1023 |
|
1001 |
1024 |
public void reloadUnits() {
|
1002 |
|
|
|
1025 |
|
1003 |
1026 |
typesUnitesAVoir = vue.getTypesUnitesAVoir();
|
1004 |
1027 |
String[] items = new String[typesUnitesAVoir.length + 1];
|
1005 |
1028 |
System.arraycopy(typesUnitesAVoir, 0, items, 1, typesUnitesAVoir.length);
|
... | ... | |
1009 |
1032 |
typeCombo.select(0);
|
1010 |
1033 |
}
|
1011 |
1034 |
typeCombo.layout();
|
1012 |
|
|
|
1035 |
|
1013 |
1036 |
onTypecomboSelected(null);
|
1014 |
1037 |
}
|
1015 |
|
|
|
1038 |
|
1016 |
1039 |
protected void selectUniteInIdentifants(Unite unite) {
|
1017 |
1040 |
for (int i = 0; i < unites.length; i++) {
|
1018 |
1041 |
// System.out.println("VS "+unites[i]);
|
... | ... | |
1022 |
1045 |
}
|
1023 |
1046 |
}
|
1024 |
1047 |
}
|
1025 |
|
|
|
1048 |
|
1026 |
1049 |
public void setEnable(boolean enable) {
|
1027 |
1050 |
l.setEnabled(enable);
|
1028 |
1051 |
typeCombo.setEnabled(enable);
|
... | ... | |
1034 |
1057 |
editRightButton.setEnabled(enable);
|
1035 |
1058 |
// drop_b.setEnabled(enable);
|
1036 |
1059 |
}
|
1037 |
|
|
|
1060 |
|
1038 |
1061 |
@Override
|
1039 |
1062 |
public void traiterEvent(Message e) {
|
1040 |
1063 |
if (annotationArea.isDisposed()) return;
|
1041 |
|
|
|
1064 |
|
1042 |
1065 |
if (e.getType().equals(TypeMessage.MODIF_STRUCTURE)) {
|
1043 |
1066 |
// System.out.println("UnitToolbar.traiterEvent: Update toolbar ");
|
1044 |
1067 |
UnitToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
|
1045 |
|
|
|
1068 |
|
1046 |
1069 |
@Override
|
1047 |
1070 |
public void run() {
|
1048 |
1071 |
setEnable(!analecCorpus.isVide());
|
... | ... | |
1053 |
1076 |
else if (e.getType().equals(TypeMessage.MODIF_ELEMENT)) {
|
1054 |
1077 |
// System.out.println("UnitToolbar.traiterEvent: Update toolbar ");
|
1055 |
1078 |
UnitToolbar.this.annotationArea.getDisplay().syncExec(new Runnable() {
|
1056 |
|
|
|
1079 |
|
1057 |
1080 |
@Override
|
1058 |
1081 |
public void run() {
|
1059 |
1082 |
// reloadUnits();
|
... | ... | |
1061 |
1084 |
});
|
1062 |
1085 |
}
|
1063 |
1086 |
}
|
1064 |
|
|
|
1087 |
|
1065 |
1088 |
protected synchronized boolean tryHighlightingUnitsWord(String id, org.txm.searchengine.cqp.corpus.CQPCorpus c) throws CqiClientException {
|
1066 |
1089 |
EditionPanel panel = editor.getEditionPanel(0);
|
1067 |
1090 |
if (panel == null) return false;
|
1068 |
1091 |
if (id != null) {
|
1069 |
|
|
|
1092 |
|
1070 |
1093 |
}
|
1071 |
1094 |
QueryResult r = c.query(new CQLQuery("[_.text_id=\"" + panel.getEdition().getText().getName() + "\" & id=\"" + id + "\"]"), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
1072 |
1095 |
List<Match> matches = r.getMatches();
|
... | ... | |
1088 |
1111 |
}
|
1089 |
1112 |
i++;
|
1090 |
1113 |
}
|
1091 |
|
|
|
1114 |
|
1092 |
1115 |
if (matching_units.size() > 0) {
|
1093 |
1116 |
// get index in matching_units of the current unit if any
|
1094 |
1117 |
int iUnite = matching_units.indexOf(navigationField.getSelectionIndex() - 1);
|
1095 |
|
|
|
1118 |
|
1096 |
1119 |
if (iUnite == -1) iUnite = 0; // current unit is not present, take the first in matching_units
|
1097 |
1120 |
else iUnite = (iUnite + 1) % matching_units.size(); // take the next unit in matching_units
|
1098 |
|
|
|
1121 |
|
1099 |
1122 |
iUnite = matching_units.get(iUnite); // get the real unit position in 'unites'
|
1100 |
1123 |
navigationField.setSelectionIndex(iUnite + 1, false); // call onIndentifiantComboChanged(...)
|
1101 |
|
|