1 |
1 |
package org.txm.annotation.kr.rcp.edition;
|
2 |
2 |
|
3 |
3 |
import java.util.ArrayList;
|
|
4 |
import java.util.Arrays;
|
4 |
5 |
import java.util.HashMap;
|
|
6 |
import java.util.HashSet;
|
5 |
7 |
import java.util.List;
|
6 |
8 |
import java.util.Vector;
|
7 |
9 |
import java.util.logging.Level;
|
|
10 |
import java.util.regex.Pattern;
|
8 |
11 |
|
9 |
12 |
import org.eclipse.core.runtime.IProgressMonitor;
|
10 |
13 |
import org.eclipse.core.runtime.IStatus;
|
... | ... | |
46 |
49 |
import org.txm.annotation.kr.core.repository.TypedValue;
|
47 |
50 |
import org.txm.annotation.kr.rcp.commands.InitializeKnowledgeRepository;
|
48 |
51 |
import org.txm.annotation.kr.rcp.commands.SaveAnnotations;
|
49 |
|
import org.txm.annotation.kr.rcp.concordance.ConcordanceAnnotations;
|
50 |
52 |
import org.txm.annotation.kr.rcp.messages.Messages;
|
51 |
53 |
import org.txm.annotation.kr.rcp.views.knowledgerepositories.KRView;
|
52 |
54 |
import org.txm.annotation.rcp.editor.AnnotationArea;
|
53 |
55 |
import org.txm.annotation.rcp.editor.AnnotationExtension;
|
54 |
|
import org.txm.concordance.core.functions.Concordance;
|
55 |
56 |
import org.txm.concordance.rcp.messages.ConcordanceUIMessages;
|
56 |
57 |
import org.txm.core.messages.TXMCoreMessages;
|
57 |
58 |
import org.txm.core.results.TXMResult;
|
|
59 |
import org.txm.edition.rcp.editors.RGBA;
|
58 |
60 |
import org.txm.edition.rcp.editors.SynopticEditionEditor;
|
59 |
61 |
import org.txm.objects.Match;
|
60 |
62 |
import org.txm.objects.Match2P;
|
... | ... | |
65 |
67 |
import org.txm.rcp.swt.dialog.ConfirmDialog;
|
66 |
68 |
import org.txm.rcp.swt.provider.SimpleLabelProvider;
|
67 |
69 |
import org.txm.rcp.utils.JobHandler;
|
|
70 |
import org.txm.searchengine.cqp.AbstractCqiClient;
|
68 |
71 |
import org.txm.searchengine.cqp.CQPSearchEngine;
|
|
72 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
|
69 |
73 |
import org.txm.searchengine.cqp.corpus.CQPCorpus;
|
70 |
74 |
import org.txm.searchengine.cqp.corpus.WordProperty;
|
71 |
75 |
import org.txm.utils.AsciiUtils;
|
72 |
76 |
import org.txm.utils.logger.Log;
|
73 |
77 |
|
74 |
78 |
public class WordAnnotationToolbar extends AnnotationArea {
|
75 |
|
|
|
79 |
|
76 |
80 |
/**
|
77 |
81 |
* the limit number of annotation when a confirm dialog box is shown
|
78 |
82 |
*/
|
79 |
83 |
protected static final int NALERTAFFECTANNOTATIONS = 100;
|
80 |
|
|
|
84 |
|
81 |
85 |
public static final String EMPTYTEXT = ""; //$NON-NLS-1$
|
82 |
|
|
|
86 |
|
83 |
87 |
/** The annotation service */
|
84 |
88 |
protected AnnotationManager annotManager;
|
85 |
|
|
|
89 |
|
86 |
90 |
protected SynopticEditionEditor editor;
|
87 |
|
|
|
91 |
|
88 |
92 |
/**
|
89 |
93 |
* The concordance annotations to show in the concordance column table
|
90 |
94 |
*/
|
91 |
95 |
private EditionAnnotations annotations = null;
|
92 |
|
|
|
96 |
|
93 |
97 |
/**
|
94 |
98 |
* All available annotation types
|
95 |
99 |
*/
|
96 |
100 |
protected List<TypedValue> typeValuesList;
|
97 |
|
|
|
101 |
|
98 |
102 |
protected ComboViewer annotationTypesCombo;
|
99 |
|
|
|
103 |
|
100 |
104 |
protected Label equalLabel;
|
101 |
|
|
|
105 |
|
102 |
106 |
protected Text annotationValuesText;
|
103 |
|
|
|
107 |
|
104 |
108 |
protected Button affectAnnotationButton;
|
105 |
|
|
|
109 |
|
106 |
110 |
protected Button deleteAnnotationButton;
|
107 |
|
|
|
111 |
|
108 |
112 |
protected KnowledgeRepository currentKnowledgeRepository = null;
|
109 |
|
|
|
113 |
|
110 |
114 |
protected Vector<AnnotationType> typesList = new Vector<>();
|
111 |
|
|
|
115 |
|
112 |
116 |
protected AnnotationType tagAnnotationType; // the tag annotation type if annotation mode is simple
|
113 |
|
|
|
117 |
|
114 |
118 |
protected TypedValue value_to_add;
|
115 |
|
|
|
119 |
|
116 |
120 |
//protected Concordance concordance;
|
117 |
|
|
|
121 |
|
118 |
122 |
private CQPCorpus corpus;
|
119 |
|
|
|
123 |
|
120 |
124 |
private TableViewerColumn annotationColumnViewer;
|
121 |
|
|
|
125 |
|
122 |
126 |
private Font annotationColummnFont;
|
123 |
|
|
|
127 |
|
124 |
128 |
private Font defaultColummnFont;
|
125 |
|
|
|
129 |
|
126 |
130 |
private Button addAnnotationTypeLink;
|
127 |
|
|
|
131 |
|
128 |
132 |
private Button addTypedValueLink;
|
129 |
|
|
|
133 |
|
|
134 |
protected Label colorsLabel;
|
|
135 |
|
|
136 |
protected Text colorsValuesText;
|
|
137 |
|
130 |
138 |
@Override
|
131 |
139 |
public String getName() {
|
132 |
140 |
return Messages.motsPropritsInfDfaut;
|
133 |
141 |
}
|
134 |
|
|
|
142 |
|
135 |
143 |
@Override
|
136 |
144 |
public boolean allowMultipleAnnotations() {
|
137 |
145 |
return true;
|
138 |
146 |
}
|
139 |
|
|
|
147 |
|
140 |
148 |
public WordAnnotationToolbar() {}
|
141 |
|
|
|
149 |
|
142 |
150 |
protected AnnotationType getSelectedAnnotationType() {
|
143 |
151 |
return annotations.getViewAnnotation();
|
144 |
152 |
}
|
145 |
|
|
|
153 |
|
146 |
154 |
public void updateAnnotationWidgetStates() {
|
147 |
155 |
if (annotationArea == null) return; // :)
|
148 |
|
|
|
156 |
|
149 |
157 |
if (getSelectedAnnotationType() != null) {
|
150 |
158 |
annotationValuesText.setEnabled(true);
|
151 |
159 |
affectAnnotationButton.setEnabled(true);
|
... | ... | |
157 |
165 |
deleteAnnotationButton.setEnabled(false);
|
158 |
166 |
}
|
159 |
167 |
}
|
160 |
|
|
|
168 |
|
161 |
169 |
protected void affectAnnotationToSelection(String[] word_selection) {
|
162 |
|
|
|
170 |
|
|
171 |
if (word_selection == null) return;
|
|
172 |
|
163 |
173 |
ArrayList<Match> matches = new ArrayList<>();
|
164 |
174 |
|
|
175 |
if (word_selection[1] == null) word_selection[1] = word_selection[0];
|
|
176 |
|
165 |
177 |
try {
|
|
178 |
|
166 |
179 |
int[] indexes = CQPSearchEngine.getCqiClient().str2Id(corpus.getProperty("id").getQualifiedName(), word_selection);
|
167 |
180 |
int[] allPositions = CQPSearchEngine.getCqiClient().idList2Cpos(corpus.getProperty("id").getQualifiedName(), indexes);
|
168 |
|
for (int p : allPositions) {
|
|
181 |
for (int p = allPositions[0] ; p <= allPositions[1] ; p++) {
|
169 |
182 |
matches.add(new Match2P(p));
|
170 |
183 |
}
|
171 |
184 |
affectAnnotationsToMatches(matches);
|
... | ... | |
174 |
187 |
e.printStackTrace();
|
175 |
188 |
}
|
176 |
189 |
}
|
177 |
|
|
|
190 |
|
178 |
191 |
protected void affectAnnotationValues(final List<? extends Match> matches, final AnnotationType type, final String svalue, JobHandler job) {
|
179 |
192 |
value_to_add = null; // reset
|
180 |
193 |
if (matches == null || matches.size() == 0) {
|
... | ... | |
182 |
195 |
return;
|
183 |
196 |
}
|
184 |
197 |
if (type == null) return; // no type, no annotation
|
185 |
|
|
|
198 |
|
186 |
199 |
job.syncExec(new Runnable() {
|
187 |
|
|
|
200 |
|
188 |
201 |
@Override
|
189 |
202 |
public void run() {
|
190 |
203 |
if (matches.size() > NALERTAFFECTANNOTATIONS) {
|
... | ... | |
192 |
205 |
"confirm_annotate", //$NON-NLS-1$
|
193 |
206 |
Messages.confirmAnnotationAffectation,
|
194 |
207 |
NLS.bind(Messages.youAreAboutToAnnotateP0ElementsContinue, matches.size()));
|
195 |
|
|
|
208 |
|
196 |
209 |
if (dialog.open() == ConfirmDialog.CANCEL) {
|
197 |
210 |
Log.info("Annotation aborted by user.");
|
198 |
211 |
matches.clear();
|
... | ... | |
200 |
213 |
}
|
201 |
214 |
}
|
202 |
215 |
});
|
203 |
|
|
|
216 |
|
204 |
217 |
// get value from combo text value
|
205 |
218 |
Log.fine(NLS.bind(Messages.lookingForTypedValueWithIdEqualsP0, svalue));
|
206 |
219 |
final KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
|
207 |
220 |
value_to_add = kr.getValue(type, svalue);
|
208 |
|
|
209 |
|
|
|
221 |
|
|
222 |
|
210 |
223 |
if (value_to_add == null && kr instanceof LocalKnowledgeRepository) { // create or not the annotation is simple mode
|
211 |
224 |
value_to_add = kr.addValue(svalue, svalue, type.getId());
|
212 |
225 |
}
|
213 |
|
|
|
226 |
|
214 |
227 |
if (value_to_add == null) {
|
215 |
228 |
job.syncExec(new Runnable() {
|
216 |
|
|
|
229 |
|
217 |
230 |
@Override
|
218 |
231 |
public void run() {
|
219 |
232 |
String mess = Messages.bind(Messages.noValueFoundWithTheP0Id, svalue);
|
... | ... | |
223 |
236 |
});
|
224 |
237 |
return;
|
225 |
238 |
}
|
226 |
|
|
|
239 |
|
227 |
240 |
Log.info(TXMCoreMessages.bind(Messages.AffectP0ToP1SelectionEqualsP2, value_to_add.getId(), value_to_add.getTypeID(), matches.size()));
|
228 |
|
|
|
241 |
|
229 |
242 |
// finally we can 'try' to create the annotations \o/
|
230 |
243 |
try {
|
231 |
244 |
HashMap<Match, List<Annotation>> existingAnnots = annotManager.createAnnotations(type, value_to_add, matches, job);
|
232 |
|
|
|
245 |
|
233 |
246 |
// did we had problems ?
|
234 |
247 |
if (existingAnnots != null && existingAnnots.size() > 0) {
|
235 |
248 |
String message = NLS.bind(Messages.couldNotAnnotateTheValueP0OnCertainSequences, value_to_add.getStandardName());
|
236 |
249 |
for (Match m : existingAnnots.keySet()) {
|
237 |
250 |
message += NLS.bind(Messages.theSequenceP0IsOverlappingWith, m);
|
238 |
|
|
|
251 |
|
239 |
252 |
for (Annotation existingAnnot : existingAnnots.get(m)) {
|
240 |
253 |
if (existingAnnot.getStart() < m.getStart()) {
|
241 |
254 |
message += TXMCoreMessages.bind(Messages.theEndOfAStructureP0AtP1P2, existingAnnot.getType(), existingAnnot.getStart(), existingAnnot.getEnd());
|
... | ... | |
247 |
260 |
}
|
248 |
261 |
final String final_message = message;
|
249 |
262 |
job.syncExec(new Runnable() {
|
250 |
|
|
|
263 |
|
251 |
264 |
@Override
|
252 |
265 |
public void run() {
|
253 |
266 |
MessageDialog.openInformation(editor.getSite().getShell(), Messages.aboutAnnotations, final_message);
|
... | ... | |
256 |
269 |
}
|
257 |
270 |
// if (history != null && !history.get(type).contains(value_to_add))
|
258 |
271 |
// history.get(type).add(value_to_add);
|
259 |
|
|
|
272 |
|
260 |
273 |
if (Log.getLevel().intValue() < Level.INFO.intValue() && annotManager != null) {
|
261 |
274 |
annotManager.checkData();
|
262 |
275 |
}
|
... | ... | |
267 |
280 |
Log.printStackTrace(e1);
|
268 |
281 |
return;
|
269 |
282 |
}
|
270 |
|
|
|
283 |
|
271 |
284 |
job.syncExec(new Runnable() {
|
272 |
|
|
|
285 |
|
273 |
286 |
@Override
|
274 |
287 |
public void run() {
|
275 |
288 |
try {
|
... | ... | |
282 |
295 |
}
|
283 |
296 |
});
|
284 |
297 |
}
|
285 |
|
|
|
298 |
|
|
299 |
private HashMap<RGBA, HashSet<String>> previousSelectedTypeUnitIDS;
|
|
300 |
|
|
301 |
public void clearHighlight() {
|
|
302 |
|
|
303 |
if (previousSelectedTypeUnitIDS != null) {
|
|
304 |
if (!editor.isDisposed()) {
|
|
305 |
for (RGBA color : previousSelectedTypeUnitIDS.keySet()) {
|
|
306 |
editor.removeHighlightWordsById(color, previousSelectedTypeUnitIDS.get(color));
|
|
307 |
}
|
|
308 |
}
|
|
309 |
previousSelectedTypeUnitIDS = null; // release memory
|
|
310 |
} else {
|
|
311 |
previousSelectedTypeUnitIDS = new HashMap<RGBA, HashSet<String>>();
|
|
312 |
}
|
|
313 |
}
|
|
314 |
|
286 |
315 |
protected void deleteAnnotationValues(String[] word_selection) {
|
287 |
|
|
|
316 |
|
|
317 |
if (word_selection == null) return;
|
|
318 |
|
288 |
319 |
ArrayList<Match> matches = new ArrayList<>();
|
289 |
320 |
try {
|
290 |
321 |
int[] indexes = CQPSearchEngine.getCqiClient().str2Id(corpus.getProperty("id").getQualifiedName(), word_selection);
|
... | ... | |
297 |
328 |
catch (Exception e) {
|
298 |
329 |
e.printStackTrace();
|
299 |
330 |
}
|
300 |
|
|
|
331 |
|
301 |
332 |
}
|
302 |
|
|
|
333 |
|
303 |
334 |
protected void deleteAnnotationValues(final List<Match> matches) {
|
304 |
335 |
final AnnotationType type = getSelectedAnnotationType();
|
305 |
|
|
|
336 |
|
306 |
337 |
JobHandler job = new JobHandler(Messages.annotatingConcordanceSelection, true) {
|
307 |
|
|
|
338 |
|
308 |
339 |
@Override
|
309 |
340 |
protected IStatus run(IProgressMonitor monitor) {
|
310 |
341 |
this.runInit(monitor);
|
311 |
342 |
try {
|
312 |
343 |
deleteAnnotationValues(matches, type, this);
|
|
344 |
|
|
345 |
this.syncExec(new Runnable() {
|
|
346 |
|
|
347 |
@Override
|
|
348 |
public void run() {
|
|
349 |
updateHighlights(null);
|
|
350 |
editor.updateWordStyles();
|
|
351 |
}
|
|
352 |
});
|
|
353 |
|
313 |
354 |
}
|
314 |
355 |
catch (Exception e) {
|
315 |
356 |
Log.severe(NLS.bind(Messages.errorWhileAnnotatingConcordanceSelectionColonP0, e));
|
... | ... | |
320 |
361 |
Log.info(Messages.annotationCanceledByUser);
|
321 |
362 |
return Status.CANCEL_STATUS;
|
322 |
363 |
}
|
323 |
|
|
|
364 |
|
324 |
365 |
return Status.OK_STATUS;
|
325 |
366 |
}
|
326 |
367 |
};
|
327 |
368 |
job.startJob(true);
|
328 |
369 |
}
|
329 |
|
|
|
370 |
|
330 |
371 |
protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {
|
331 |
|
|
|
372 |
|
332 |
373 |
if (matches.size() == 0) {
|
333 |
374 |
Log.warning("No lines selected. Aborting.");
|
334 |
375 |
return;
|
335 |
376 |
}
|
336 |
|
|
|
377 |
|
337 |
378 |
if (type == null) {
|
338 |
379 |
return;
|
339 |
380 |
}
|
340 |
|
|
|
381 |
|
341 |
382 |
try {
|
342 |
383 |
if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
|
343 |
384 |
if (Log.getLevel().intValue() < Level.INFO.intValue()) annotManager.checkData();
|
344 |
|
|
|
385 |
|
345 |
386 |
}
|
346 |
387 |
else {
|
347 |
388 |
return;
|
... | ... | |
352 |
393 |
Log.printStackTrace(e1);
|
353 |
394 |
return;
|
354 |
395 |
}
|
355 |
|
|
|
396 |
|
356 |
397 |
job.syncExec(new Runnable() {
|
357 |
|
|
|
398 |
|
358 |
399 |
@Override
|
359 |
400 |
public void run() {
|
360 |
401 |
try {
|
361 |
|
editor.refresh(false);
|
|
402 |
updateHighlights(null);
|
|
403 |
editor.updateWordStyles();
|
362 |
404 |
}
|
363 |
405 |
catch (Exception e) {
|
364 |
406 |
Log.printStackTrace(e);
|
... | ... | |
366 |
408 |
}
|
367 |
409 |
});
|
368 |
410 |
}
|
369 |
|
|
|
411 |
|
370 |
412 |
protected void affectAnnotationsToMatches(final List<? extends Match> matches) {
|
371 |
413 |
final AnnotationType type = getSelectedAnnotationType();
|
372 |
414 |
final String svalue = annotationValuesText.getText();
|
373 |
|
|
|
415 |
|
374 |
416 |
JobHandler job = new JobHandler(Messages.annotatingConcordanceSelection, true) {
|
375 |
|
|
|
417 |
|
376 |
418 |
@Override
|
377 |
419 |
protected IStatus run(IProgressMonitor monitor) {
|
378 |
420 |
this.runInit(monitor);
|
379 |
421 |
try {
|
380 |
422 |
affectAnnotationValues(matches, type, svalue, this);
|
|
423 |
updateHighlights(null);
|
|
424 |
|
|
425 |
this.syncExec(new Runnable() {
|
|
426 |
|
|
427 |
@Override
|
|
428 |
public void run() {
|
|
429 |
editor.updateWordStyles();
|
|
430 |
}
|
|
431 |
});
|
|
432 |
|
381 |
433 |
}
|
382 |
434 |
catch (Exception e) {
|
383 |
435 |
Log.severe(NLS.bind(Messages.errorWhileAnnotatingConcordanceSelectionColonP0, e));
|
... | ... | |
388 |
440 |
Log.info(Messages.annotationCanceledByUser);
|
389 |
441 |
return Status.CANCEL_STATUS;
|
390 |
442 |
}
|
391 |
|
|
|
443 |
|
392 |
444 |
return Status.OK_STATUS;
|
393 |
445 |
}
|
394 |
446 |
};
|
395 |
447 |
job.startJob(true);
|
396 |
448 |
}
|
397 |
|
|
|
449 |
|
398 |
450 |
@Override
|
399 |
451 |
public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
|
400 |
|
|
|
452 |
|
401 |
453 |
this.extension = ext;
|
402 |
454 |
this.editor = (SynopticEditionEditor) txmeditor;
|
403 |
455 |
this.corpus = editor.getCorpus();
|
404 |
456 |
this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
|
405 |
457 |
this.annotations = new EditionAnnotations(this.editor);
|
406 |
|
|
|
458 |
|
407 |
459 |
// TODO install browser listeners here
|
408 |
|
|
|
460 |
|
409 |
461 |
List<KnowledgeRepository> krs = InitializeKnowledgeRepository.get(corpus.getMainCorpus());
|
410 |
462 |
typesList.clear();
|
411 |
463 |
Log.fine("Corpus KRs: " + krs); //$NON-NLS-1$
|
412 |
|
|
|
464 |
|
413 |
465 |
currentKnowledgeRepository = KnowledgeRepositoryManager.getKnowledgeRepository(corpus.getMainCorpus().getID());
|
414 |
466 |
if (currentKnowledgeRepository == null) {
|
415 |
467 |
HashMap<String, HashMap<String, ?>> conf = new HashMap<>();
|
... | ... | |
419 |
471 |
conf.put(KRAnnotationEngine.KNOWLEDGE_TYPES, fields);
|
420 |
472 |
HashMap<String, HashMap<String, String>> strings = new HashMap<>();
|
421 |
473 |
conf.put(KRAnnotationEngine.KNOWLEDGE_STRINGS, strings);
|
422 |
|
|
|
474 |
|
423 |
475 |
access.put("mode", DatabasePersistenceManager.ACCESS_FILE); //$NON-NLS-1$
|
424 |
476 |
access.put("version", "0"); //$NON-NLS-1$ //$NON-NLS-2$
|
425 |
477 |
currentKnowledgeRepository = KnowledgeRepositoryManager.createKnowledgeRepository(corpus.getMainCorpus().getID(), conf);
|
426 |
478 |
KnowledgeRepositoryManager.registerKnowledgeRepository(currentKnowledgeRepository);
|
427 |
479 |
// KRAnnotationEngine.registerKnowledgeRepositoryName(corpus, corpus.getMainCorpus().getID());
|
428 |
480 |
}
|
429 |
|
|
|
481 |
|
430 |
482 |
List<WordProperty> wordProperties = corpus.getProperties();
|
431 |
483 |
for (WordProperty p : wordProperties) {
|
432 |
484 |
if (p.getName().equals("id")) continue; //$NON-NLS-1$
|
... | ... | |
439 |
491 |
type.setEffect(AnnotationEffect.TOKEN);
|
440 |
492 |
}
|
441 |
493 |
}
|
442 |
|
|
|
494 |
|
443 |
495 |
Log.fine("KR: " + currentKnowledgeRepository); //$NON-NLS-1$
|
444 |
496 |
List<AnnotationType> krtypes = currentKnowledgeRepository.getAllAnnotationTypes();
|
445 |
497 |
for (AnnotationType type : krtypes) {
|
... | ... | |
447 |
499 |
typesList.add(type);
|
448 |
500 |
}
|
449 |
501 |
}
|
450 |
|
|
|
502 |
|
451 |
503 |
Log.fine(NLS.bind(Messages.availableAnnotationTypesColonP0, typesList));
|
452 |
|
|
|
504 |
|
453 |
505 |
annotationArea = new GLComposite(parent, SWT.NONE, Messages.concordanceAnnotationArea);
|
454 |
506 |
annotationArea.getLayout().numColumns = 12;
|
455 |
507 |
annotationArea.getLayout().horizontalSpacing = 2;
|
456 |
508 |
annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
457 |
|
|
|
509 |
|
458 |
510 |
GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
|
459 |
511 |
gdata.widthHint = 90;
|
460 |
|
|
|
512 |
|
461 |
513 |
new Label(annotationArea, SWT.NONE).setText(TXMCoreMessages.common_property);
|
462 |
|
|
|
514 |
|
463 |
515 |
// Display combo with list of Annotation Type
|
464 |
516 |
annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
|
465 |
517 |
annotationTypesCombo.setContentProvider(new ArrayContentProvider());
|
466 |
518 |
annotationTypesCombo.setLabelProvider(new SimpleLabelProvider() {
|
467 |
|
|
|
519 |
|
468 |
520 |
@Override
|
469 |
521 |
public String getColumnText(Object element, int columnIndex) {
|
470 |
522 |
return ((AnnotationType) element).getName();
|
471 |
523 |
}
|
472 |
|
|
|
524 |
|
473 |
525 |
@Override
|
474 |
526 |
public String getText(Object element) {
|
475 |
527 |
return ((AnnotationType) element).getName();
|
... | ... | |
498 |
550 |
// @Override
|
499 |
551 |
// public void keyPressed(KeyEvent e) { }
|
500 |
552 |
// });
|
501 |
|
|
|
553 |
|
502 |
554 |
gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
|
503 |
555 |
gdata.widthHint = 200;
|
504 |
|
|
|
556 |
|
505 |
557 |
annotationTypesCombo.getCombo().setLayoutData(gdata);
|
506 |
558 |
annotationTypesCombo.setInput(typesList);
|
507 |
559 |
annotationTypesCombo.getCombo().select(0);
|
... | ... | |
513 |
565 |
// annotationColumn.setText(name);
|
514 |
566 |
// }
|
515 |
567 |
// }
|
516 |
|
|
|
568 |
|
517 |
569 |
annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
|
518 |
|
|
|
570 |
|
519 |
571 |
@Override
|
520 |
572 |
public void selectionChanged(SelectionChangedEvent event) {
|
521 |
573 |
onAnnotationTypeSelected(event);
|
522 |
574 |
}
|
523 |
575 |
});
|
524 |
|
|
|
576 |
|
525 |
577 |
addAnnotationTypeLink = new Button(annotationArea, SWT.PUSH);
|
526 |
578 |
addAnnotationTypeLink.setToolTipText(Messages.addANewCategory);
|
527 |
579 |
addAnnotationTypeLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
|
528 |
580 |
addAnnotationTypeLink.setEnabled(true);
|
529 |
581 |
addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
530 |
582 |
addAnnotationTypeLink.addSelectionListener(new SelectionListener() {
|
531 |
|
|
|
583 |
|
532 |
584 |
@Override
|
533 |
585 |
public void widgetSelected(SelectionEvent e) {
|
534 |
586 |
if (currentKnowledgeRepository == null) return;
|
535 |
587 |
if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
|
536 |
|
|
|
588 |
|
537 |
589 |
LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
|
538 |
|
|
|
590 |
|
539 |
591 |
InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), "New property", "Enter the new property name", "", null);
|
540 |
592 |
if (dialog.open() == InputDialog.OK) {
|
541 |
593 |
String name = dialog.getValue();
|
... | ... | |
549 |
601 |
}
|
550 |
602 |
AnnotationType type = kr.addType(name, id, "", AnnotationEffect.TOKEN); //$NON-NLS-1$
|
551 |
603 |
typesList.add(type);
|
552 |
|
|
|
604 |
|
553 |
605 |
if (annotationTypesCombo != null) annotationTypesCombo.refresh();
|
554 |
606 |
if (typesList.size() == 1) {
|
555 |
607 |
if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(typesList.size() - 1);
|
556 |
|
|
|
608 |
|
557 |
609 |
annotations.setViewAnnotation(type);
|
558 |
610 |
annotations.setAnnotationOverlap(true);
|
559 |
611 |
try {
|
... | ... | |
564 |
616 |
e1.printStackTrace();
|
565 |
617 |
}
|
566 |
618 |
annotationArea.layout(true);
|
567 |
|
|
|
619 |
|
568 |
620 |
}
|
569 |
621 |
else {
|
570 |
622 |
if (typesList.size() > 1) {
|
... | ... | |
583 |
635 |
Log.info("Creation aborted.");
|
584 |
636 |
}
|
585 |
637 |
}
|
586 |
|
|
|
638 |
|
587 |
639 |
@Override
|
588 |
640 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
589 |
641 |
});
|
590 |
|
|
|
642 |
|
591 |
643 |
equalLabel = new Label(annotationArea, SWT.NONE);
|
592 |
644 |
equalLabel.setText("="); //$NON-NLS-1$
|
593 |
645 |
equalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
594 |
|
|
|
646 |
|
595 |
647 |
annotationValuesText = new Text(annotationArea, SWT.BORDER);
|
596 |
648 |
annotationValuesText.setToolTipText(Messages.enterAValueForAnId);
|
597 |
649 |
GridData gdata2 = new GridData(SWT.FILL, SWT.CENTER, false, false);
|
598 |
650 |
gdata2.widthHint = 200;
|
599 |
651 |
annotationValuesText.setLayoutData(gdata2);
|
600 |
652 |
annotationValuesText.addKeyListener(new KeyListener() {
|
601 |
|
|
|
653 |
|
602 |
654 |
@Override
|
603 |
655 |
public void keyReleased(KeyEvent e) {
|
604 |
656 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
605 |
657 |
affectAnnotationToSelection(editor.getEditionPanel(0).getWordSelection());
|
606 |
658 |
}
|
607 |
659 |
}
|
608 |
|
|
|
660 |
|
609 |
661 |
@Override
|
610 |
662 |
public void keyPressed(KeyEvent e) {}
|
611 |
663 |
});
|
612 |
|
|
|
664 |
|
613 |
665 |
addTypedValueLink = new Button(annotationArea, SWT.PUSH);
|
614 |
666 |
addTypedValueLink.setText("..."); //$NON-NLS-1$
|
615 |
667 |
addTypedValueLink.setToolTipText(Messages.selectAValueAmongTheList);
|
616 |
668 |
addTypedValueLink.setEnabled(true);
|
617 |
669 |
addTypedValueLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
618 |
670 |
addTypedValueLink.addSelectionListener(new SelectionListener() {
|
619 |
|
|
|
671 |
|
620 |
672 |
@Override
|
621 |
673 |
public void widgetSelected(SelectionEvent e) {
|
622 |
674 |
if (currentKnowledgeRepository == null) return;
|
623 |
675 |
if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
|
624 |
|
|
|
676 |
|
625 |
677 |
AnnotationType type = getSelectedAnnotationType();
|
626 |
678 |
if (type == null) return;
|
627 |
|
|
|
679 |
|
628 |
680 |
LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
|
629 |
|
|
|
681 |
|
630 |
682 |
ListDialog dialog = new ListDialog(e.widget.getDisplay().getActiveShell());
|
631 |
683 |
String title = currentKnowledgeRepository.getString(editor.getCorpus().getLang(), "ConcordancesEditor_100"); //$NON-NLS-1$
|
632 |
684 |
if (title == null) title = Messages.availableValuesForP0;
|
633 |
685 |
dialog.setTitle(ConcordanceUIMessages.bind(title, type.getName()));// +"valeurs de "+type.getName());
|
634 |
686 |
dialog.setContentProvider(new ArrayContentProvider());
|
635 |
687 |
dialog.setLabelProvider(new SimpleLabelProvider() {
|
636 |
|
|
|
688 |
|
637 |
689 |
@Override
|
638 |
690 |
public String getColumnText(Object element, int columnIndex) {
|
639 |
691 |
if (element instanceof TypedValue) {
|
... | ... | |
655 |
707 |
TypedValue value = (TypedValue) dialog.getResult()[0];
|
656 |
708 |
String name = value.getId();
|
657 |
709 |
if (name.trim().length() == 0) return;
|
658 |
|
|
|
710 |
|
659 |
711 |
annotationValuesText.setText(name);
|
660 |
712 |
}
|
661 |
713 |
else {
|
662 |
|
|
|
714 |
|
663 |
715 |
}
|
664 |
716 |
}
|
665 |
|
|
|
717 |
|
666 |
718 |
@Override
|
667 |
719 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
668 |
720 |
});
|
669 |
|
|
|
721 |
|
670 |
722 |
new Label(annotationArea, SWT.NONE).setText(" ");
|
671 |
|
|
|
723 |
|
672 |
724 |
affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
|
673 |
725 |
affectAnnotationButton.setText(Messages.oK);
|
674 |
726 |
affectAnnotationButton.setToolTipText(Messages.proceedToAnnotation);
|
675 |
727 |
affectAnnotationButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
676 |
728 |
affectAnnotationButton.addSelectionListener(new SelectionListener() {
|
677 |
|
|
|
729 |
|
678 |
730 |
@Override
|
679 |
731 |
public void widgetSelected(SelectionEvent e) {
|
680 |
732 |
affectAnnotationToSelection(editor.getEditionPanel(0).getWordSelection());
|
681 |
733 |
}
|
682 |
|
|
|
734 |
|
683 |
735 |
@Override
|
684 |
736 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
685 |
737 |
});
|
686 |
|
|
|
738 |
|
687 |
739 |
deleteAnnotationButton = new Button(annotationArea, SWT.PUSH);
|
688 |
740 |
deleteAnnotationButton.setText(Messages.delete);
|
689 |
741 |
deleteAnnotationButton.setToolTipText(Messages.delete);
|
690 |
742 |
deleteAnnotationButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
691 |
743 |
deleteAnnotationButton.addSelectionListener(new SelectionListener() {
|
692 |
|
|
|
744 |
|
693 |
745 |
@Override
|
694 |
746 |
public void widgetSelected(SelectionEvent e) {
|
695 |
747 |
deleteAnnotationValues(editor.getEditionPanel(0).getWordSelection());
|
|
748 |
|
696 |
749 |
}
|
697 |
|
|
|
750 |
|
698 |
751 |
@Override
|
699 |
752 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
700 |
753 |
});
|
701 |
|
|
|
754 |
|
702 |
755 |
Button closeButton = new Button(annotationArea, SWT.PUSH);
|
703 |
756 |
closeButton.setToolTipText(Messages.closeTheToolbarWithoutSaving);
|
704 |
757 |
closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
|
705 |
|
|
|
758 |
|
706 |
759 |
closeButton.addSelectionListener(new SelectionListener() {
|
707 |
|
|
|
760 |
|
708 |
761 |
@Override
|
709 |
762 |
public void widgetSelected(SelectionEvent e) {
|
710 |
763 |
extension.closeArea(WordAnnotationToolbar.this, true);
|
711 |
764 |
}
|
712 |
|
|
|
765 |
|
713 |
766 |
@Override
|
714 |
767 |
public void widgetDefaultSelected(SelectionEvent e) {}
|
715 |
768 |
});
|
716 |
|
|
|
769 |
|
|
770 |
|
|
771 |
colorsLabel = new Label(annotationArea, SWT.NONE);
|
|
772 |
colorsLabel.setText("Colors"); //$NON-NLS-1$
|
|
773 |
colorsLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
|
|
774 |
|
|
775 |
colorsValuesText = new Text(annotationArea, SWT.BORDER);
|
|
776 |
colorsValuesText.setToolTipText(Messages.enterAValueForAnId);
|
|
777 |
gdata2 = new GridData(SWT.FILL, SWT.CENTER, false, false);
|
|
778 |
gdata2.widthHint = 200;
|
|
779 |
colorsValuesText.setLayoutData(gdata2);
|
|
780 |
colorsValuesText.addKeyListener(new KeyListener() {
|
|
781 |
|
|
782 |
@Override
|
|
783 |
public void keyReleased(KeyEvent e) {
|
|
784 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
|
|
785 |
|
|
786 |
updateHighlights(colorsValuesText.getText());
|
|
787 |
|
|
788 |
editor.updateWordStyles();
|
|
789 |
}
|
|
790 |
}
|
|
791 |
|
|
792 |
@Override
|
|
793 |
public void keyPressed(KeyEvent e) {}
|
|
794 |
});
|
|
795 |
|
|
796 |
|
717 |
797 |
updateAnnotationWidgetStates();
|
718 |
798 |
editor.layout(true);
|
719 |
|
// ext.getSaveButton().setEnabled(true);
|
|
799 |
// ext.getSaveButton().setEnabled(true);
|
720 |
800 |
return true;
|
721 |
801 |
}
|
722 |
802 |
|
|
803 |
HashMap<RGBA, String> colorsRules;
|
|
804 |
public void updateHighlights(String rules) {
|
|
805 |
|
|
806 |
if (rules != null) {
|
|
807 |
String[] couples = rules.split(",");
|
|
808 |
|
|
809 |
colorsRules = new HashMap<RGBA, String>();
|
|
810 |
if (couples.length > 0) {
|
|
811 |
for (String couple : couples) {
|
|
812 |
String[] colorValue = couple.split("=", 2);
|
|
813 |
|
|
814 |
if (colorValue[0].startsWith("#")) {
|
|
815 |
colorsRules.put(new RGBA(colorValue[0]), colorValue[1]);
|
|
816 |
} else {
|
|
817 |
colorsRules.put(new RGBA(RGBA.nameToHex(colorValue[0])), colorValue[1]);
|
|
818 |
}
|
|
819 |
}
|
|
820 |
}
|
|
821 |
}
|
|
822 |
|
|
823 |
if (colorsRules == null) return; // nothing to do
|
|
824 |
|
|
825 |
clearHighlight();
|
|
826 |
|
|
827 |
AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
|
|
828 |
|
|
829 |
try {
|
|
830 |
WordProperty property = corpus.getProperty(getSelectedAnnotationType().getId());
|
|
831 |
WordProperty idproperty = corpus.getProperty("id");
|
|
832 |
|
|
833 |
// // Page word positions range (start, end)
|
|
834 |
// String idstart = editor.getEditionPanel(0).getCurrentPage().getWordId();
|
|
835 |
// String idend = editor.getEditionPanel(0).getCurrentPage().getLastWordID();
|
|
836 |
//
|
|
837 |
// int pStart = CQI.str2Id(idproperty.getQualifiedName(), new String[] {idstart})[0];
|
|
838 |
// int pEnd = corpus.getSize()-1;
|
|
839 |
// if (!idstart.equals(idend)) {
|
|
840 |
// pEnd = CQI.str2Id(idproperty.getQualifiedName(), new String[] {idend})[0];
|
|
841 |
// } else {
|
|
842 |
// String text = editor.getEditionPanel(0).getCurrentText().getName();
|
|
843 |
// org.txm.objects.Text nextText = editor.getEditionPanel(0).getNextText();
|
|
844 |
// String nextTextName = nextText.getName();
|
|
845 |
// if (!text.equals(nextTextName)) {
|
|
846 |
// idend = nextText.getEdition(editor.getEditionPanel(0).getEdition().getName()).getFirstPage().getWordId();
|
|
847 |
// pEnd = CQI.str2Id(idproperty.getQualifiedName(), new String[] {idend})[0];
|
|
848 |
// }
|
|
849 |
// }
|
|
850 |
// //System.out.println("start="+pStart+" end="+pEnd);
|
|
851 |
//
|
|
852 |
// List<Match> matches = new ArrayList<Match>();
|
|
853 |
// for (int p = pStart ; p <=pEnd ; p++) {
|
|
854 |
// matches.add(new Match2P(p));
|
|
855 |
// }
|
|
856 |
|
|
857 |
List<Annotation> annotations = annotManager.getAnnotations(getSelectedAnnotationType(), false);
|
|
858 |
|
|
859 |
//System.out.println("annotations="+annotations);
|
|
860 |
previousSelectedTypeUnitIDS = new HashMap<RGBA, HashSet<String>>();
|
|
861 |
for (RGBA color : colorsRules.keySet()) {
|
|
862 |
|
|
863 |
Pattern regex = Pattern.compile(colorsRules.get(color));
|
|
864 |
// get words per value
|
|
865 |
// System.out.println("FIND WORDS FOR COLOR AND VALUE "+color+"="+colorsRules.get(color));
|
|
866 |
// int[] ids = CQI.regex2Id(property.getQualifiedName(), colorsRules.get(color));
|
|
867 |
// System.out.println("ids="+Arrays.toString(ids));
|
|
868 |
// int[] positions = CQI.idList2Cpos(property.getQualifiedName(), ids);
|
|
869 |
// System.out.println("positions="+Arrays.toString(positions));
|
|
870 |
|
|
871 |
// get annotations for the current page range and select those who matches the
|
|
872 |
List<Integer> positionsList = new ArrayList<Integer>();
|
|
873 |
|
|
874 |
for (Annotation annot : annotations) {
|
|
875 |
if (regex.matcher(annot.getValue()).matches()) {
|
|
876 |
positionsList.add(annot.getStart());
|
|
877 |
}
|
|
878 |
}
|
|
879 |
|
|
880 |
int[] positions = new int[positionsList.size()];
|
|
881 |
for (int i = 0 ; i < positionsList.size() ; i++) {
|
|
882 |
positions[i] = positionsList.get(i);
|
|
883 |
}
|
|
884 |
String[] wordIds = CQI.cpos2Str(idproperty.getQualifiedName(), positions);
|
|
885 |
HashSet<String> h = new HashSet<String>();
|
|
886 |
for (String a : wordIds) {
|
|
887 |
h.add(a);
|
|
888 |
}
|
|
889 |
//System.out.println("h="+h);
|
|
890 |
|
|
891 |
previousSelectedTypeUnitIDS.put(color, h);
|
|
892 |
editor.setHighlightWordsById(color, h);
|
|
893 |
//System.out.println("SET "+h);
|
|
894 |
}
|
|
895 |
} catch (Exception e1) {
|
|
896 |
// TODO Auto-generated catch block
|
|
897 |
e1.printStackTrace();
|
|
898 |
}
|
|
899 |
}
|
|
900 |
|
723 |
901 |
protected void onAnnotationTypeSelected(SelectionChangedEvent event) {
|
724 |
|
|
|
902 |
|
725 |
903 |
IStructuredSelection sel = (IStructuredSelection) annotationTypesCombo.getSelection();
|
726 |
904 |
AnnotationType type = (AnnotationType) sel.getFirstElement();
|
727 |
905 |
if (type == null) return;
|
728 |
|
|
|
906 |
|
729 |
907 |
if (type.getSize() != AnnotationType.ValuesSize.LARGE) {
|
730 |
908 |
try {
|
731 |
909 |
KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
|
... | ... | |
736 |
914 |
e.printStackTrace();
|
737 |
915 |
}
|
738 |
916 |
}
|
739 |
|
|
|
917 |
|
740 |
918 |
annotations.setViewAnnotation(type);
|
741 |
919 |
annotations.setAnnotationOverlap(true);
|
742 |
920 |
try {
|
... | ... | |
746 |
924 |
// TODO Auto-generated catch block
|
747 |
925 |
e.printStackTrace();
|
748 |
926 |
}
|
749 |
|
|
|
927 |
|
750 |
928 |
updateAnnotationWidgetStates();
|
751 |
929 |
}
|
752 |
|
|
|
930 |
|
753 |
931 |
protected void createNewType(TypedEvent e, String typeName) {
|
754 |
|
|
|
932 |
|
755 |
933 |
if (currentKnowledgeRepository == null) return;
|
756 |
934 |
if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
|
757 |
|
|
|
935 |
|
758 |
936 |
LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
|
759 |
937 |
if (typeName == null) typeName = ""; //$NON-NLS-1$
|
760 |
938 |
InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), Messages.nouvelleProprit, Messages.nomDeLaPropritPatternEqualsazaz09Plus, typeName,
|
... | ... | |
773 |
951 |
annotationTypesCombo.refresh();
|
774 |
952 |
StructuredSelection selection = new StructuredSelection(type);
|
775 |
953 |
annotationTypesCombo.setSelection(selection, true);
|
776 |
|
|
|
954 |
|
777 |
955 |
// if (annotationTypesCombo != null) annotationTypesCombo.refresh();
|
778 |
956 |
// if (typesList.size() == 1) {
|
779 |
957 |
// if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
|
... | ... | |
795 |
973 |
// }
|
796 |
974 |
// KRView.refresh();
|
797 |
975 |
// updateAnnotationWidgetStates();
|
798 |
|
|
|
976 |
|
799 |
977 |
// onAnnotationTypeSelected(null);
|
800 |
978 |
}
|
801 |
979 |
else {
|
802 |
980 |
Log.info("Creation aborted.");
|
803 |
981 |
}
|
804 |
982 |
}
|
805 |
|
|
|
983 |
|
806 |
984 |
@Override
|
807 |
985 |
public boolean save() {
|
808 |
986 |
try {
|
... | ... | |
828 |
1006 |
return false;
|
829 |
1007 |
}
|
830 |
1008 |
}
|
831 |
|
|
|
1009 |
|
832 |
1010 |
@Override
|
833 |
1011 |
public boolean hasChanges() {
|
834 |
1012 |
AnnotationManager am;
|
... | ... | |
847 |
1025 |
return false;
|
848 |
1026 |
}
|
849 |
1027 |
}
|
850 |
|
|
|
1028 |
|
851 |
1029 |
@Override
|
852 |
1030 |
public boolean notifyStartOfCompute() throws Exception {
|
853 |
1031 |
if (annotationArea == null) return false;
|
854 |
1032 |
if (annotationArea.isDisposed()) return false;
|
855 |
|
|
|
1033 |
|
856 |
1034 |
AnnotationType type = getSelectedAnnotationType();
|
857 |
1035 |
if (type != null) {
|
858 |
1036 |
annotations.setViewAnnotation(type);
|
859 |
1037 |
annotations.setAnnotationOverlap(true);
|
860 |
1038 |
}
|
861 |
|
|
|
1039 |
|
862 |
1040 |
return true;
|
863 |
1041 |
}
|
864 |
|
|
|
1042 |
|
865 |
1043 |
@Override
|
866 |
1044 |
public boolean notifyEndOfCompute() throws Exception {
|
867 |
1045 |
return true;
|
868 |
1046 |
}
|
869 |
|
|
|
1047 |
|
870 |
1048 |
@Override
|
871 |
1049 |
public boolean isAnnotationEnable() {
|
872 |
1050 |
return annotationArea != null;
|
873 |
1051 |
}
|
874 |
|
|
|
1052 |
|
875 |
1053 |
@Override
|
876 |
1054 |
public void notifyStartOfRefresh() throws Exception {
|
877 |
1055 |
if (annotationArea == null) return;
|
878 |
1056 |
if (annotationArea.isDisposed()) return;
|
879 |
|
|
|
1057 |
|
880 |
1058 |
Page currentPage = editor.getEditionPanel(0).getCurrentPage();
|
881 |
1059 |
if (currentPage == null) return;
|
882 |
|
|
|
1060 |
|
883 |
1061 |
String startID = currentPage.getWordId();
|
884 |
1062 |
Page nextPage = currentPage.getEdition().getNextPage(currentPage);
|
885 |
1063 |
String endID = nextPage.getWordId();
|
886 |
|
|
|
1064 |
|
887 |
1065 |
annotations.computeStrings(startID, endID);
|
888 |
|
|
|
1066 |
|
889 |
1067 |
updateAnnotationWidgetStates();
|
890 |
|
|
|
1068 |
|
891 |
1069 |
}
|
892 |
|
|
|
1070 |
|
893 |
1071 |
@Override
|
894 |
1072 |
protected void _close() {
|
895 |
1073 |
if (!annotationArea.isDisposed()) annotationArea.dispose();
|
896 |
1074 |
extension.layout();
|
897 |
1075 |
}
|
898 |
|
|
|
1076 |
|
899 |
1077 |
@Override
|
900 |
1078 |
public void notifyEndOfRefresh() throws Exception {
|
901 |
1079 |
// TODO Auto-generated method stub
|
902 |
1080 |
}
|
903 |
|
|
|
1081 |
|
904 |
1082 |
@Override
|
905 |
1083 |
public void notifyStartOfCreatePartControl() throws Exception {
|
906 |
1084 |
// TODO Auto-generated method stub
|
907 |
1085 |
}
|
908 |
|
|
|
1086 |
|
909 |
1087 |
@Override
|
910 |
1088 |
public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
|
911 |
1089 |
return org.txm.objects.Text.class;
|
912 |
1090 |
}
|
913 |
|
|
|
1091 |
|
914 |
1092 |
@Override
|
915 |
1093 |
public boolean isDirty() {
|
916 |
1094 |
if (annotManager != null) {
|
... | ... | |
918 |
1096 |
}
|
919 |
1097 |
return false;
|
920 |
1098 |
}
|
921 |
|
|
|
1099 |
|
922 |
1100 |
@Override
|
923 |
1101 |
public boolean discardChanges() {
|
924 |
1102 |
return false;
|
925 |
1103 |
}
|
926 |
|
|
|
1104 |
|
927 |
1105 |
@Override
|
928 |
1106 |
public boolean needToUpdateIndexes() {
|
929 |
1107 |
return KRAnnotationPreferences.getInstance().getBoolean(KRAnnotationPreferences.UPDATE);
|
930 |
1108 |
}
|
931 |
|
|
|
1109 |
|
932 |
1110 |
@Override
|
933 |
1111 |
public boolean needToUpdateEditions() {
|
934 |
1112 |
return KRAnnotationPreferences.getInstance().getBoolean(KRAnnotationPreferences.UPDATE_EDITION);
|