Révision 2915

tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 2915)
506 506
		try {
507 507
			if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
508 508
				if (Log.getLevel().intValue() < Level.INFO.intValue()) annotManager.checkData();
509
				editor.refresh(false);
509
				// editor.fillDisplayArea(false);
510 510
			}
511 511
			else {
512 512
				return;
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 2915)
79 79
import org.txm.utils.logger.Log;
80 80

  
81 81
public class KRAnnotation extends AnnotationArea {
82

  
82
	
83 83
	/**
84 84
	 * the limit number of annotation when a confirm dialog box is shown
85 85
	 */
86 86
	protected static final int NALERTAFFECTANNOTATIONS = 100;
87
	
87 88
	public static final String EMPTYTEXT = ""; //$NON-NLS-1$
88

  
89
	
89 90
	/** The annotation service */
90 91
	protected AnnotationManager annotManager;
91

  
92
	//boolean annotation_expert_mode = TxmPreferences.getBoolean(AnnotationPreferencePage.MODE, false);
93

  
92
	
93
	// boolean annotation_expert_mode = TxmPreferences.getBoolean(AnnotationPreferencePage.MODE, false);
94
	
94 95
	protected Point annotationSize;
95

  
96
	
96 97
	/** The annot btn : starts the annotation */
97 98
	private Button addAnnotationTypeLink;
98

  
99
	
99 100
	protected Text annotationValuesText;
101
	
100 102
	protected ComboViewer annotationTypesCombo;
101

  
103
	
102 104
	protected List<TypedValue> typeValuesList;
103

  
105
	
104 106
	protected TableColumn annotationColumn;
105

  
107
	
106 108
	protected Combo addRemoveCombo;
109
	
107 110
	protected Combo affectCombo;
111
	
108 112
	protected Button affectAnnotationButton;
109

  
113
	
110 114
	protected Button infosAnnotTypeSelectedLink;
111

  
115
	
112 116
	protected KnowledgeRepository currentKnowledgeRepository = null;
113
	protected Vector<AnnotationType> typesList = new Vector<AnnotationType>(); 
114

  
117
	
118
	protected Vector<AnnotationType> typesList = new Vector<>();
119
	
115 120
	protected Button addTypedValueLink;
116

  
121
	
117 122
	protected Label withLabel;
118

  
123
	
119 124
	protected Label equalLabel;
120

  
125
	
121 126
	protected TypedValue value_to_add;
122

  
127
	
123 128
	protected Concordance concordance;
124

  
129
	
125 130
	private CQPCorpus corpus;
126

  
131
	
127 132
	private ConcordanceAnnotations annotations = null;
128

  
133
	
129 134
	ConcordanceEditor editor;
130

  
135
	
131 136
	public KRAnnotation() {
132

  
137
		
133 138
	}
134

  
139
	
140
	@Override
135 141
	public String getName() {
136 142
		return KRAnnotationUIMessages.squencesDeMotsCatgorievaleur;
137 143
	}
138

  
144
	
139 145
	@Override
140 146
	public boolean install(TXMEditor<? extends TXMResult> txmeditor, AnnotationExtension ext, Composite parent, int position) throws Exception {
141

  
147
		
142 148
		this.extension = ext;
143
		this.editor = (ConcordanceEditor)txmeditor;
149
		this.editor = (ConcordanceEditor) txmeditor;
144 150
		this.concordance = this.editor.getConcordance();
145 151
		this.corpus = concordance.getCorpus();
146 152
		this.annotations = new ConcordanceAnnotations(this.editor.getConcordance());
147 153
		this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
148

  
154
		
149 155
		TableViewer viewer = this.editor.getLineTableViewer();
150

  
156
		
151 157
		// RESULT
152

  
158
		
153 159
		if (position < 0) {
154 160
			position = 3 + extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
155 161
		}
156

  
162
		
157 163
		TableViewerColumn annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
158 164
		annotationColumn = annotationColumnViewer.getColumn();
159 165
		annotationColumn.setText(KRAnnotationUIMessages.category);
......
162 168
		annotationColumn.pack();
163 169
		annotationColumn.addControlListener(new ConcordanceColumnSizeControlListener(annotationColumn));
164 170
		annotationColumnViewer.setLabelProvider(new ColumnLabelProvider() {
165

  
171
			
166 172
			@Override
167 173
			public String getText(Object element) {
168
				Line line = (Line)element;
174
				Line line = (Line) element;
169 175
				AnnotationLine annotationLine = annotations.getAnnotationLine(line);
170
				if (annotationLine == null) return EMPTYTEXT ;
171
				if (annotationLine.getAnnotation()!=null) {
176
				if (annotationLine == null) return EMPTYTEXT;
177
				if (annotationLine.getAnnotation() != null) {
172 178
					String value = annotationLine.getAnnotationValue().getStandardName();
173 179
					Annotation a = annotationLine.getAnnotation();
174 180
					if (value == null) value = a.getValue();
175

  
181
					
176 182
					if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
177
						value = "… "+value; //$NON-NLS-1$
183
						value = "… " + value; //$NON-NLS-1$
178 184
					}
179

  
185
					
180 186
					if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
181
						value = value+" …"; //$NON-NLS-1$
182
					} 
187
						value = value + " …"; //$NON-NLS-1$
188
					}
183 189
					return value;
184
				} else {
190
				}
191
				else {
185 192
					return EMPTYTEXT;
186 193
				}
187 194
			}
188 195
		});
189

  
196
		
190 197
		ext.getSaveButton().setEnabled(true);
191 198
		return composeAnnotationArea(parent);
192 199
	}
193

  
200
	
194 201
	public boolean initialiseInput(ConcordanceEditor editor) throws Exception {
195 202
		this.editor = editor;
196 203
		concordance = editor.getConcordance();
197 204
		annotations = new ConcordanceAnnotations(concordance);
198 205
		corpus = concordance.getCorpus();
199

  
206
		
200 207
		CQPCorpus corpus = editor.getCorpus();
201

  
208
		
202 209
		this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
203

  
210
		
204 211
		return true;
205 212
	}
206

  
207
	private boolean composeAnnotationArea(final Composite parent){ 
208

  
213
	
214
	private boolean composeAnnotationArea(final Composite parent) {
215
		
209 216
		List<KnowledgeRepository> krs = InitializeKnowledgeRepository.get(corpus.getMainCorpus());
210 217
		typesList.clear();
211
		Log.fine("Corpus KRs: "+krs); //$NON-NLS-1$
212

  
218
		Log.fine("Corpus KRs: " + krs); //$NON-NLS-1$
219
		
213 220
		for (KnowledgeRepository kr : krs) {
214 221
			if (kr == null) continue;
215

  
222
			
216 223
			currentKnowledgeRepository = kr;
217
			Log.fine(" KR: "+kr); //$NON-NLS-1$
224
			Log.fine(" KR: " + kr); //$NON-NLS-1$
218 225
			List<AnnotationType> krtypes = kr.getAllAnnotationTypes();
219 226
			for (AnnotationType type : krtypes) {
220 227
				if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
221 228
					typesList.add(type);
222 229
				}
223 230
			}
224

  
231
			
225 232
			Log.fine(NLS.bind(KRAnnotationUIMessages.availableAnnotationTypesColonP0, typesList));
226 233
			break;
227 234
		}
228

  
235
		
229 236
		if (currentKnowledgeRepository == null) {
230 237
			System.out.println(KRAnnotationUIMessages.errorColonNoSuitableKnowledgeRepositoryFound);
231 238
			return false;
232 239
		}
233

  
240
		
234 241
		annotationArea = new GLComposite(parent, SWT.NONE, KRAnnotationUIMessages.concordanceAnnotationArea);
235 242
		annotationArea.getLayout().numColumns = 12;
236 243
		annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
237

  
244
		
238 245
		addRemoveCombo = new Combo(annotationArea, SWT.READ_ONLY);
239 246
		String affectLabel = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_22"); //$NON-NLS-1$
240
		if (affectLabel == null) affectLabel= KRAnnotationUIMessages.affect;
247
		if (affectLabel == null) affectLabel = KRAnnotationUIMessages.affect;
241 248
		String removeLabel = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_24"); //$NON-NLS-1$
242
		if (removeLabel == null) removeLabel= KRAnnotationUIMessages.delete;
243
		String items[] = {affectLabel, removeLabel};
249
		if (removeLabel == null) removeLabel = KRAnnotationUIMessages.delete;
250
		String items[] = { affectLabel, removeLabel };
244 251
		addRemoveCombo.setItems(items);
245 252
		addRemoveCombo.select(0);
246 253
		addRemoveCombo.addSelectionListener(new SelectionListener() {
254
			
247 255
			@Override
248 256
			public void widgetSelected(SelectionEvent e) {
249 257
				if (addRemoveCombo.getSelectionIndex() == 0) { // add
250 258
					annotationValuesText.setEnabled(true);
251 259
					String withLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_83"); //$NON-NLS-1$
252
					if (withLabelText == null) withLabelText= KRAnnotationUIMessages.withTheCategory;
260
					if (withLabelText == null) withLabelText = KRAnnotationUIMessages.withTheCategory;
253 261
					withLabel.setText(withLabelText);
254 262
					if (equalLabel != null) equalLabel.setText("="); //$NON-NLS-1$
255
				} else { // remove
263
				}
264
				else { // remove
256 265
					annotationValuesText.setEnabled(false);
257 266
					withLabel.setText(""); //$NON-NLS-1$
258 267
					if (equalLabel != null) equalLabel.setText(""); //$NON-NLS-1$
......
261 270
				annotationArea.layout();
262 271
				updateAnnotationWidgetStates();
263 272
			}
273
			
264 274
			@Override
265
			public void widgetDefaultSelected(SelectionEvent e) { }
275
			public void widgetDefaultSelected(SelectionEvent e) {}
266 276
		});
267 277
		GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
268 278
		gdata.widthHint = 90;
269 279
		addRemoveCombo.setLayoutData(gdata);
270

  
280
		
271 281
		withLabel = new Label(annotationArea, SWT.NONE);
272 282
		String withLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_83"); //$NON-NLS-1$
273
		if (withLabelText == null) withLabelText= KRAnnotationUIMessages.withTheCategory;
283
		if (withLabelText == null) withLabelText = KRAnnotationUIMessages.withTheCategory;
274 284
		withLabel.setText(withLabelText);
275 285
		withLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
276

  
286
		
277 287
		equalLabel = new Label(annotationArea, SWT.NONE);
278 288
		equalLabel.setText("="); //$NON-NLS-1$
279 289
		equalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
280

  
281
		//Display combo with list of Annotation Type 
290
		
291
		// Display combo with list of Annotation Type
282 292
		annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
283 293
		annotationTypesCombo.setContentProvider(new ArrayContentProvider());
284 294
		annotationTypesCombo.setLabelProvider(new SimpleLabelProvider() {
295
			
285 296
			@Override
286 297
			public String getColumnText(Object element, int columnIndex) {
287
				return ((AnnotationType)element).getName(); //$NON-NLS-1$
298
				return ((AnnotationType) element).getName();
288 299
			}
300
			
289 301
			@Override
290 302
			public String getText(Object element) {
291
				return ((AnnotationType)element).getName(); //$NON-NLS-1$
303
				return ((AnnotationType) element).getName();
292 304
			}
293 305
		});
294 306
		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
295 307
		gdata.widthHint = 200;
296

  
308
		
297 309
		annotationTypesCombo.getCombo().setLayoutData(gdata);
298 310
		annotationTypesCombo.setInput(typesList);
299 311
		if (typesList.size() > 0) {
300 312
			annotationTypesCombo.getCombo().select(0);
301 313
			annotations.setViewAnnotation(typesList.get(0));
302 314
		}
303

  
315
		
304 316
		annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
317
			
305 318
			@Override
306 319
			public void selectionChanged(SelectionChangedEvent event) {
307 320
				AnnotationType type = getSelectedAnnotationType();
......
310 323
					try {
311 324
						KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
312 325
						typeValuesList = kr.getValues(type);
313
					} catch (Exception e) {
326
					}
327
					catch (Exception e) {
314 328
						// TODO Auto-generated catch block
315 329
						e.printStackTrace();
316 330
					}
317 331
				}
318

  
332
				
319 333
				annotationColumn.setText(type.getName());
320 334
				if (concordance != null) {
321 335
					annotations.setViewAnnotation(type);
322 336
					annotations.setAnnotationOverlap(true);
323 337
					try {
324 338
						editor.refresh(false);
325
					} catch (Exception e) {
339
					}
340
					catch (Exception e) {
326 341
						// TODO Auto-generated catch block
327 342
						e.printStackTrace();
328 343
					}
329 344
				}
330

  
345
				
331 346
				updateAnnotationWidgetStates();
332 347
			}
333 348
		});
334

  
349
		
335 350
		if (currentKnowledgeRepository instanceof SQLKnowledgeRepository) {
336 351
			infosAnnotTypeSelectedLink = new Button(annotationArea, SWT.PUSH);
337 352
			infosAnnotTypeSelectedLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_INFO));
338 353
			infosAnnotTypeSelectedLink.setEnabled(true);
339
			infosAnnotTypeSelectedLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
354
			infosAnnotTypeSelectedLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
340 355
			infosAnnotTypeSelectedLink.addSelectionListener(new SelectionListener() {
356
				
341 357
				@Override
342 358
				public void widgetSelected(SelectionEvent e) {
343 359
					AnnotationType type = getSelectedAnnotationType();
344 360
					if (type == null) return;
345

  
361
					
346 362
					String typedValueURL = type.getURL(); // may be null/empty
347 363
					if (typedValueURL != null && typedValueURL.length() > 0) {
348 364
						KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
......
350 366
					}
351 367
					if (typedValueURL != null && typedValueURL.length() > 0) {
352 368
						OpenBrowser.openfile(typedValueURL, new File(typedValueURL).getName());
353
					} else {
369
					}
370
					else {
354 371
						IWorkbenchWindow window = editor.getSite().getWorkbenchWindow();
355 372
						try {
356 373
							OpenKRView.openView(window, type);
357
						} catch (PartInitException e1) {
374
						}
375
						catch (PartInitException e1) {
358 376
							e1.printStackTrace();
359 377
						}
360 378
					}
361 379
				}
362

  
380
				
363 381
				@Override
364
				public void widgetDefaultSelected(SelectionEvent e) { }
382
				public void widgetDefaultSelected(SelectionEvent e) {}
365 383
			});
366 384
		}
367

  
385
		
368 386
		if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
369 387
			addAnnotationTypeLink = new Button(annotationArea, SWT.PUSH);
370 388
			addAnnotationTypeLink.setToolTipText(KRAnnotationUIMessages.addANewCategory);
371 389
			addAnnotationTypeLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
372 390
			addAnnotationTypeLink.setEnabled(true);
373
			addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
391
			addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
374 392
			addAnnotationTypeLink.addSelectionListener(new SelectionListener() {
393
				
375 394
				@Override
376 395
				public void widgetSelected(SelectionEvent e) {
377 396
					if (currentKnowledgeRepository == null) return;
378 397
					if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
379

  
380
					LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
381

  
382
					InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), KRAnnotationUIMessages.newCategory, KRAnnotationUIMessages.pleaseEnterTheNewTypeName, "", null); //$NON-NLS-3$ //$NON-NLS-1$
398
					
399
					LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
400
					
401
					InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), KRAnnotationUIMessages.newCategory, KRAnnotationUIMessages.pleaseEnterTheNewTypeName, "", null); //$NON-NLS-1$
383 402
					if (dialog.open() == InputDialog.OK) {
384 403
						String name = dialog.getValue();
385 404
						if (name.trim().length() == 0) return;
......
393 412
						AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
394 413
						type.setEffect(AnnotationEffect.SEGMENT);
395 414
						typesList.add(type);
396

  
415
						
397 416
						if (annotationTypesCombo != null) annotationTypesCombo.refresh();
398
						if (typesList.size() == 1) {
399
							if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
400
							if (concordance != null) {
401
								annotations.setViewAnnotation(type);
402
								annotations.setAnnotationOverlap(true);
403
								editor.fillDisplayArea(false);
404
							}
405
							annotationArea.layout(true);
406
						} else {
407
							if (typesList.size() > 1) {
408
								if (annotationTypesCombo != null) {
409
									annotationTypesCombo.getCombo().select(typesList.size()-1);
410
								}
411
							}
412
						}
417
						
418
						// if (typesList.size() == 1) {
419
						// if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
420
						// if (concordance != null) {
421
						// annotations.setAnnotationOverlap(true);
422
						// try {
423
						// annotationColumn.setText(type.getId());
424
						// editor.refresh(false);
425
						// }
426
						// catch (Exception e1) {
427
						// // TODO Auto-generated catch block
428
						// e1.printStackTrace();
429
						// }
430
						// }
431
						// annotationArea.layout(true);
432
						// }
433
						// else {
434
						// if (typesList.size() > 1) {
435
						// if (annotationTypesCombo != null) {
436
						// annotationTypesCombo.getCombo().select(typesList.size() - 1);
437
						// }
438
						// }
439
						// }
440
						
441
						annotations.setViewAnnotation(type);
442
						annotationTypesCombo.setSelection(new StructuredSelection(typesList.get(typesList.size() - 1))); // select the new annotation
443
						annotationArea.layout(true);
444
						
413 445
						KRView.refresh();
414 446
						updateAnnotationWidgetStates();
415
					} else {
447
					}
448
					else {
416 449
						System.out.println("Creation aborted."); //$NON-NLS-1$
417 450
					}
418 451
				}
419

  
452
				
420 453
				@Override
421
				public void widgetDefaultSelected(SelectionEvent e) { }
454
				public void widgetDefaultSelected(SelectionEvent e) {}
422 455
			});
423 456
		}
424

  
457
		
425 458
		Label valueLabel = new Label(annotationArea, SWT.NONE);
426 459
		String valueLabelText = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_80"); //$NON-NLS-1$
427 460
		if (valueLabelText == null) {
428
			valueLabelText= KRAnnotationUIMessages.valueEquals;
461
			valueLabelText = KRAnnotationUIMessages.valueEquals;
429 462
		}
430 463
		valueLabel.setText(valueLabelText);
431 464
		valueLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
432

  
465
		
433 466
		annotationValuesText = new Text(annotationArea, SWT.BORDER);
434 467
		annotationValuesText.setToolTipText(KRAnnotationUIMessages.enterAValueForAnId);
435 468
		GridData gdata2 = new GridData(SWT.FILL, SWT.CENTER, false, false);
436 469
		gdata2.widthHint = 200;
437 470
		annotationValuesText.setLayoutData(gdata2);
438 471
		annotationValuesText.addKeyListener(new KeyListener() {
472
			
439 473
			@Override
440 474
			public void keyReleased(KeyEvent e) {
441 475
				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
442 476
					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
443 477
				}
444 478
			}
445

  
479
			
446 480
			@Override
447
			public void keyPressed(KeyEvent e) { }
481
			public void keyPressed(KeyEvent e) {}
448 482
		});
449

  
483
		
450 484
		if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
451 485
			addTypedValueLink = new Button(annotationArea, SWT.PUSH);
452 486
			addTypedValueLink.setText("..."); //$NON-NLS-1$
453 487
			addTypedValueLink.setToolTipText(KRAnnotationUIMessages.selectAValueAmongTheList);
454 488
			addTypedValueLink.setEnabled(true);
455
			addTypedValueLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, false));
489
			addTypedValueLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
456 490
			addTypedValueLink.addSelectionListener(new SelectionListener() {
491
				
457 492
				@Override
458 493
				public void widgetSelected(SelectionEvent e) {
459 494
					if (currentKnowledgeRepository == null) return;
460 495
					if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
461

  
496
					
462 497
					AnnotationType type = getSelectedAnnotationType();
463 498
					if (type == null) return;
464

  
465
					LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
466

  
499
					
500
					LocalKnowledgeRepository kr = (LocalKnowledgeRepository) currentKnowledgeRepository;
501
					
467 502
					ListDialog dialog = new ListDialog(e.widget.getDisplay().getActiveShell());
468 503
					String title = currentKnowledgeRepository.getString(editor.getLocale(), "ConcordancesEditor_100"); //$NON-NLS-1$
469 504
					if (title == null) title = KRAnnotationUIMessages.availableValuesForP0;
470
					dialog.setTitle(ConcordanceUIMessages.bind(title, type.getName()));//+"valeurs de "+type.getName());
505
					dialog.setTitle(ConcordanceUIMessages.bind(title, type.getName()));// +"valeurs de "+type.getName());
471 506
					dialog.setContentProvider(new ArrayContentProvider());
472 507
					dialog.setLabelProvider(new SimpleLabelProvider() {
508
						
509
						@Override
473 510
						public String getColumnText(Object element, int columnIndex) {
474 511
							if (element instanceof TypedValue)
475
								return ((TypedValue)element).getId();
512
								return ((TypedValue) element).getId();
476 513
							return element.toString();
477 514
						}
478 515
					});
479 516
					List<TypedValue> values;
480 517
					try {
481 518
						values = kr.getValues(type);
482
					} catch (Exception e1) {
519
					}
520
					catch (Exception e1) {
483 521
						e1.printStackTrace();
484 522
						return;
485 523
					}
......
488 526
						TypedValue value = (TypedValue) dialog.getResult()[0];
489 527
						String name = value.getId();
490 528
						if (name.trim().length() == 0) return;
491

  
529
						
492 530
						annotationValuesText.setText(name);
493
					} else {
494

  
495 531
					}
532
					else {
533
						
534
					}
496 535
				}
497

  
536
				
498 537
				@Override
499
				public void widgetDefaultSelected(SelectionEvent e) { }
538
				public void widgetDefaultSelected(SelectionEvent e) {}
500 539
			});
501 540
		}
502

  
541
		
503 542
		affectCombo = new Combo(annotationArea, SWT.READ_ONLY);
504 543
		affectCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
505
		String items2[] = {KRAnnotationUIMessages.selectedLines, KRAnnotationUIMessages.allLines};
544
		String items2[] = { KRAnnotationUIMessages.selectedLines, KRAnnotationUIMessages.allLines };
506 545
		affectCombo.setItems(items2);
507 546
		affectCombo.select(0);
508 547
		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
509 548
		gdata.widthHint = 140;
510 549
		affectCombo.setLayoutData(gdata);
511

  
550
		
512 551
		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
513 552
		affectAnnotationButton.setText(KRAnnotationUIMessages.oK);
514 553
		affectAnnotationButton.setToolTipText(KRAnnotationUIMessages.proceedToAnnotation);
515 554
		affectAnnotationButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
516 555
		affectAnnotationButton.addSelectionListener(new SelectionListener() {
556
			
517 557
			@Override
518 558
			public void widgetSelected(SelectionEvent e) {
519 559
				int isel = affectCombo.getSelectionIndex();
520 560
				if (isel == 0) { // selected line
521 561
					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
522
				} else { // all
562
				}
563
				else { // all
523 564
					try {
524 565
						List<? extends Match> matches = concordance.getMatches();
525 566
						affectMatchesToSelection(matches);
526
					} catch (Exception e1) {
567
					}
568
					catch (Exception e1) {
527 569
						Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceColonP0, e1.getLocalizedMessage()));
528 570
						Log.printStackTrace(e1);
529 571
						return;
530 572
					}
531 573
				}
532 574
			}
533

  
575
			
534 576
			@Override
535
			public void widgetDefaultSelected(SelectionEvent e) { }
577
			public void widgetDefaultSelected(SelectionEvent e) {}
536 578
		});
537
		//		Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
538
		//		saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
539
		//		saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
579
		// Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
580
		// saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
581
		// saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
540 582
		//
541
		//		saveAnnotationButton.addSelectionListener(new SelectionListener() {
542
		//			@Override
543
		//			public void widgetSelected(SelectionEvent e) {
583
		// saveAnnotationButton.addSelectionListener(new SelectionListener() {
584
		// @Override
585
		// public void widgetSelected(SelectionEvent e) {
544 586
		//
545
		//				try {
546
		//					AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
547
		//					if (am != null && am.hasChanges()) {
548
		//						// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
549
		//						JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
550
		//						
551
		//						if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
552
		//							// update editor corpus
553
		//							System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
554
		//						}
555
		//						
556
		//						CorporaView.refresh();
557
		//					}
558
		//				} catch(Exception ex) {
559
		//					ex.printStackTrace();
560
		//				}
561
		//			}
587
		// try {
588
		// AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
589
		// if (am != null && am.hasChanges()) {
590
		// // && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
591
		// JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
562 592
		//
563
		//			@Override
564
		//			public void widgetDefaultSelected(SelectionEvent e) { }
565
		//		});
566

  
593
		// if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
594
		// // update editor corpus
595
		// System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
596
		// }
597
		//
598
		// CorporaView.refresh();
599
		// }
600
		// } catch(Exception ex) {
601
		// ex.printStackTrace();
602
		// }
603
		// }
604
		//
605
		// @Override
606
		// public void widgetDefaultSelected(SelectionEvent e) { }
607
		// });
608
		
567 609
		Button closeButton = new Button(annotationArea, SWT.PUSH);
568 610
		closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
569 611
		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
570 612
		closeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
571 613
		closeButton.addSelectionListener(new SelectionListener() {
572

  
614
			
573 615
			@Override
574 616
			public void widgetSelected(SelectionEvent e) {
575 617
				extension.removeAnnotationArea(KRAnnotation.this);
576 618
			}
577

  
619
			
578 620
			@Override
579 621
			public void widgetDefaultSelected(SelectionEvent e) {}
580 622
		});
581

  
623
		
582 624
		updateAnnotationWidgetStates();
583 625
		editor.layout(true);
584

  
626
		
585 627
		return true;
586 628
	}
587

  
629
	
588 630
	@Override
589 631
	public boolean hasChanges() {
590 632
		AnnotationManager am;
......
592 634
			am = KRAnnotationEngine.getAnnotationManager(corpus);
593 635
			if (am != null && am.hasChanges()) {
594 636
				return am.hasChanges();
595
			} else {
637
			}
638
			else {
596 639
				return false;
597 640
			}
598
		} catch (Exception e) {
641
		}
642
		catch (Exception e) {
599 643
			// TODO Auto-generated catch block
600 644
			e.printStackTrace();
601 645
			return false;
602 646
		}
603 647
	}
604

  
648
	
605 649
	protected void affectAnnotationToSelection(ISelection selection) {
606

  
650
		
607 651
		final IStructuredSelection lineSelection = (IStructuredSelection) selection;
608 652
		List<Line> lines = lineSelection.toList();
609
		ArrayList<Match> matches = new ArrayList<Match>();
653
		ArrayList<Match> matches = new ArrayList<>();
610 654
		for (Line l : lines) {
611 655
			matches.add(l.getMatch());
612 656
		}
613

  
657
		
614 658
		affectMatchesToSelection(matches);
615 659
	}
616

  
660
	
617 661
	protected AnnotationType getSelectedAnnotationType() {
618 662
		if (annotationTypesCombo.getCombo().isDisposed()) return null;
619

  
620
		IStructuredSelection isel = (IStructuredSelection)annotationTypesCombo.getSelection();
663
		
664
		IStructuredSelection isel = (IStructuredSelection) annotationTypesCombo.getSelection();
621 665
		if (isel.isEmpty()) {
622 666
			return null;
623 667
		}
624 668
		return (AnnotationType) isel.getFirstElement();
625 669
	}
626

  
670
	
627 671
	protected void affectMatchesToSelection(final List<? extends Match> matches) {
628 672
		final AnnotationType type = getSelectedAnnotationType();
629 673
		final String svalue = annotationValuesText.getText();
630 674
		final boolean doAffect = addRemoveCombo.getSelectionIndex() == 0; // add is default
631

  
675
		
632 676
		JobHandler job = new JobHandler(KRAnnotationUIMessages.annotatingConcordanceSelection, true) {
677
			
633 678
			@Override
634 679
			protected IStatus run(IProgressMonitor monitor) {
635 680
				this.runInit(monitor);
636 681
				try {
637 682
					if (doAffect) {
638 683
						affectAnnotationValues(matches, type, svalue, this);
639
					} else {
684
					}
685
					else {
640 686
						deleteAnnotationValues(matches, type, this);
641 687
					}
642
				} catch(Exception e) {
688
				}
689
				catch (Exception e) {
643 690
					Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceSelectionColonP0, e));
644 691
					Log.printStackTrace(e);
645 692
					return Status.CANCEL_STATUS;
646
				} catch(ThreadDeath td) {
693
				}
694
				catch (ThreadDeath td) {
647 695
					System.out.println(KRAnnotationUIMessages.annotationCanceledByUser);
648 696
					return Status.CANCEL_STATUS;
649 697
				}
650

  
698
				
651 699
				return Status.OK_STATUS;
652 700
			}
653 701
		};
654 702
		job.startJob(true);
655 703
	}
656

  
704
	
657 705
	public void updateAnnotationWidgetStates() {
658 706
		if (annotationArea == null) return; // :)
659 707
		if (annotationArea.isDisposed()) return;
660

  
708
		
661 709
		annotationArea.getDisplay().syncExec(new Runnable() {
662

  
710
			
663 711
			@Override
664 712
			public void run() {
665 713
				if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
666

  
714
					
667 715
					if (getSelectedAnnotationType() != null) {
668 716
						annotationValuesText.setEnabled(true);
669

  
717
						
670 718
						affectAnnotationButton.setEnabled(true);
671 719
						affectCombo.setEnabled(true);
672
					} else {
720
					}
721
					else {
673 722
						annotationValuesText.setEnabled(false);
674

  
723
						
675 724
						affectAnnotationButton.setEnabled(false);
676 725
						affectCombo.setEnabled(false);
677 726
					}
678
				} else {
727
				}
728
				else {
679 729
					annotationValuesText.setEnabled(false);
680

  
730
					
681 731
					if (getSelectedAnnotationType() != null) {
682 732
						affectAnnotationButton.setEnabled(true);
683 733
						affectCombo.setEnabled(true);
684
					} else {
734
					}
735
					else {
685 736
						affectAnnotationButton.setEnabled(false);
686 737
						affectCombo.setEnabled(false);
687 738
					}
688 739
				}
689

  
740
				
690 741
				if (infosAnnotTypeSelectedLink != null) {
691 742
					infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
692 743
				}
693 744
				if (addTypedValueLink != null) {
694 745
					addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
695 746
				}
696

  
747
				
697 748
				if (concordance == null) {
698 749
					affectAnnotationButton.setEnabled(false);
699 750
					affectCombo.setEnabled(false);
......
701 752
			}
702 753
		});
703 754
	}
704

  
755
	
705 756
	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
706 757
		if (concordance == null) {
707 758
			return;
708 759
		}
709

  
760
		
710 761
		if (matches.size() == 0) {
711 762
			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
712 763
			return;
713 764
		}
714

  
765
		
715 766
		if (type == null) {
716 767
			return;
717 768
		}
718

  
769
		
719 770
		if (concordance != null) {
720 771
			try {
721 772
				if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
722 773
					if (Log.getLevel().intValue() < Level.INFO.intValue()) annotManager.checkData();
723
					concordance.reloadLines(editor.getTopLine(), editor.getBottomLine()+1);
724
				} else {
774
					concordance.reloadLines(editor.getTopLine(), editor.getBottomLine() + 1);
775
				}
776
				else {
725 777
					return;
726 778
				}
727
			} catch (Exception e1) {
779
			}
780
			catch (Exception e1) {
728 781
				System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
729 782
				Log.printStackTrace(e1);
730 783
				return;
731 784
			}
732

  
785
			
733 786
			job.syncExec(new Runnable() {
787
				
734 788
				@Override
735 789
				public void run() {
736
					editor.fillDisplayArea(false);
790
					try {
791
						editor.refresh(false);
792
					}
793
					catch (Exception e) {
794
						// TODO Auto-generated catch block
795
						e.printStackTrace();
796
					}
737 797
					CorporaView.refreshObject(corpus);
738 798
				}
739 799
			});
740 800
		}
741 801
	}
742

  
743
	protected void affectAnnotationValues(final List<? extends Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
802
	
803
	protected void affectAnnotationValues(final List<? extends Match> matches, final AnnotationType type, final String svalue, JobHandler job) {
744 804
		value_to_add = null; // reset
745 805
		if (concordance == null) {
746 806
			System.out.println("No concordance done. Aborting."); //$NON-NLS-1$
......
751 811
			return;
752 812
		}
753 813
		if (type == null) return; // no type, no annotation
754

  
814
		
755 815
		job.syncExec(new Runnable() {
816
			
756 817
			@Override
757 818
			public void run() {
758 819
				if (matches.size() > NALERTAFFECTANNOTATIONS) {
759
					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
820
					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(),
760 821
							"confirm_annotate",  //$NON-NLS-1$
761
							KRAnnotationUIMessages.confirmAnnotationAffectation, 
822
							KRAnnotationUIMessages.confirmAnnotationAffectation,
762 823
							NLS.bind(KRAnnotationUIMessages.youAreAboutToAnnotateP0ElementsContinue, matches.size()));
763

  
824
					
764 825
					if (dialog.open() == ConfirmDialog.CANCEL) {
765 826
						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
766 827
						matches.clear();
......
768 829
				}
769 830
			}
770 831
		});
771

  
832
		
772 833
		// get value from combo text value
773 834
		Log.fine(NLS.bind(KRAnnotationUIMessages.lookingForTypedValueWithIdEqualsP0, svalue));
774 835
		final KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
775 836
		value_to_add = kr.getValue(type, svalue);
776

  
777

  
837
		
838
		
778 839
		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) { // create or not the annotation is simple mode
779 840
			job.syncExec(new Runnable() {
841
				
780 842
				@Override
781 843
				public void run() {
782 844
					String title = kr.getString(editor.getLocale(), "ConcordancesEditor_110"); //$NON-NLS-1$
783 845
					String content = kr.getString(editor.getLocale(), "ConcordancesEditor_112"); //$NON-NLS-1$
784
					if (title == null ) title = KRAnnotationUIMessages.newValueP0ForCategoryP1;
785
					if (content == null ) content = KRAnnotationUIMessages.theValueP0IsNotAssociatedWithTheCategoryP1AssociateIt;
786
					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
846
					if (title == null) title = KRAnnotationUIMessages.newValueP0ForCategoryP1;
847
					if (content == null) content = KRAnnotationUIMessages.theValueP0IsNotAssociatedWithTheCategoryP1AssociateIt;
848
					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(),
787 849
							"create_value", //$NON-NLS-1$
788
							ConcordanceUIMessages.bind(title, svalue, type.getName()),  
850
							ConcordanceUIMessages.bind(title, svalue, type.getName()),
789 851
							ConcordanceUIMessages.bind(content, svalue, type.getName()));
790 852
					if (dialog.open() == ConfirmDialog.CANCEL) {
791 853
						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
792 854
						return;
793
					} else {
855
					}
856
					else {
794 857
						value_to_add = kr.addValue(svalue, svalue, type.getId());
795 858
						KRView.refresh();
796 859
					}
797 860
				}
798 861
			});
799 862
		}
800

  
863
		
801 864
		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) return; // canceled
802

  
803
		if (value_to_add == null) {	
865
		
866
		if (value_to_add == null) {
804 867
			job.syncExec(new Runnable() {
868
				
805 869
				@Override
806 870
				public void run() {
807 871
					String mess = ConcordanceUIMessages.bind(KRAnnotationUIMessages.noValueFoundWithTheP0Id, svalue);
......
811 875
			});
812 876
			return;
813 877
		}
814

  
815
		//Log.info("AFFECT "+value_to_add+" to SELECTION="+matches); //$NON-NLS-1$ //$NON-NLS-1$
816

  
878
		
879
		// Log.info("AFFECT "+value_to_add+" to SELECTION="+matches); //$NON-NLS-1$ //$NON-NLS-1$
880
		
817 881
		// finally we can 'try' to create the annotations \o/
818 882
		try {
819 883
			HashMap<Match, List<Annotation>> existingAnnots = annotManager.createAnnotations(type, value_to_add, matches, job);
820

  
884
			
821 885
			// did we had problems ?
822
			if (existingAnnots!=null && existingAnnots.size() > 0) {
886
			if (existingAnnots != null && existingAnnots.size() > 0) {
823 887
				String message = NLS.bind(KRAnnotationUIMessages.couldNotAnnotateTheValueP0OnCertainSequences, value_to_add.getStandardName());
824 888
				for (Match m : existingAnnots.keySet()) {
825 889
					message += NLS.bind(KRAnnotationUIMessages.theSequenceP0IsOverlappingWith, m);
826

  
890
					
827 891
					for (Annotation existingAnnot : existingAnnots.get(m)) {
828
						if (existingAnnot.getStart() < m.getStart()){
892
						if (existingAnnot.getStart() < m.getStart()) {
829 893
							message += TXMCoreMessages.bind(KRAnnotationUIMessages.theEndOfAStructureP0AtP1P2, existingAnnot.getType(), existingAnnot.getStart(), existingAnnot.getEnd());
830
						} else {
894
						}
895
						else {
831 896
							message += TXMCoreMessages.bind(KRAnnotationUIMessages.theStartOfAStructureP0AtP1P2, existingAnnot.getType(), existingAnnot.getStart(), existingAnnot.getEnd());
832 897
						}
833 898
					}
834 899
				}
835 900
				final String final_message = message;
836 901
				job.syncExec(new Runnable() {
902
					
837 903
					@Override
838 904
					public void run() {
839 905
						MessageDialog.openInformation(editor.getSite().getShell(), KRAnnotationUIMessages.aboutAnnotations, final_message);
840 906
					}
841 907
				});
842 908
			}
843
			//				if (history != null && !history.get(type).contains(value_to_add))
844
			//					history.get(type).add(value_to_add);
845

  
909
			// if (history != null && !history.get(type).contains(value_to_add))
910
			// history.get(type).add(value_to_add);
911
			
846 912
			if (Log.getLevel().intValue() < Level.INFO.intValue() && annotManager != null) {
847 913
				annotManager.checkData();
848 914
			}
849 915
			concordance.reloadCurrentLines();
850
		} catch (Exception e1) {
916
		}
917
		catch (Exception e1) {
851 918
			System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileAffectionAnnotationColonP0, e1));
852 919
			Log.printStackTrace(e1);
853 920
			return;
854 921
		}
855

  
922
		
856 923
		job.syncExec(new Runnable() {
924
			
857 925
			@Override
858 926
			public void run() {
859 927
				try {
860 928
					editor.refresh(false);
861 929
					CorporaView.refreshObject(corpus);
862
				} catch (Exception e) {
930
				}
931
				catch (Exception e) {
863 932
					e.printStackTrace();
864 933
				}
865 934
			}
866 935
		});
867

  
936
		
868 937
	}
869

  
938
	
939
	@Override
870 940
	public boolean notifyStartOfCompute() throws Exception {
871 941
		if (annotationArea == null) return false;
872 942
		if (annotationArea.isDisposed()) return false;
873

  
943
		
874 944
		annotationArea.getDisplay().syncExec(new Runnable() {
945
			
875 946
			@Override
876 947
			public void run() {
877 948
				AnnotationType type = getSelectedAnnotationType();
......
881 952
				}
882 953
			}
883 954
		});
884

  
955
		
885 956
		return true;
886 957
	}
887

  
958
	
959
	@Override
888 960
	public boolean notifyEndOfCompute() throws Exception {
889 961
		updateAnnotationWidgetStates();
890 962
		if (annotationArea == null) return false;
......
893 965
		// update annotation column width
894 966
		if (annotationArea != null) {
895 967
			annotationArea.getDisplay().syncExec(new Runnable() {
968
				
896 969
				@Override
897 970
				public void run() {
898 971
					annotationColumn.pack();
899 972
					annotationColumn.setResizable(true);
900 973
				}
901 974
			});
902
		} else { 
975
		}
976
		else {
903 977
			annotationColumn.setWidth(0);
904 978
		}
905

  
979
		
906 980
		return true;
907 981
	}
908

  
909

  
982
	
983
	
984
	@Override
910 985
	public boolean isAnnotationEnable() {
911 986
		return annotationArea != null;
912 987
	}
913

  
988
	
914 989
	@Override
915 990
	public boolean save() {
916 991
		try {
917 992
			AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
918 993
			if (am != null && am.hasChanges()) {
919
				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
994
				// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now
995
				// ?")
920 996
				JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
921 997
				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
922 998
					// update editor corpus
923 999
					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
924 1000
					return false;
925
				} else {
1001
				}
1002
				else {
926 1003
					if (annotationColumn != null && !annotationColumn.isDisposed()) {
927 1004
						annotationColumn.setText(annotations.getViewAnnotation().getName());
928 1005
					}
929 1006
					return true; // something was saved
930 1007
				}
931
			} else {
1008
			}
1009
			else {
932 1010
				return false;
933 1011
			}
934
		} catch(Exception ex) {
1012
		}
1013
		catch (Exception ex) {
935 1014
			ex.printStackTrace();
936 1015
			return false;
937 1016
		}
938 1017
	}
939

  
1018
	
940 1019
	@Override
941 1020
	protected void _close() {
942 1021
		if (!annotationColumn.isDisposed()) annotationColumn.dispose();
......
945 1024
		}
946 1025
		extension.layout();
947 1026
	}
948

  
1027
	
949 1028
	@Override
950 1029
	public void notifyEndOfRefresh() throws Exception {
951 1030
		// TODO Auto-generated method stub
952

  
1031
		
953 1032
	}
954

  
1033
	
955 1034
	@Override
956 1035
	public void notifyStartOfCreatePartControl() throws Exception {
957 1036
		// TODO Auto-generated method stub
958

  
1037
		
959 1038
	}
960

  
1039
	
961 1040
	@Override
962 1041
	public void notifyStartOfRefresh() throws Exception {
963
		List<Line> lines = concordance.getLines(concordance.getTopIndex(), concordance.getTopIndex()+concordance.getNLinePerPage());
1042
		List<Line> lines = concordance.getLines(concordance.getTopIndex(), concordance.getTopIndex() + concordance.getNLinePerPage());
964 1043
		annotations.computeLines(lines);
965 1044
	}
966

  
1045
	
967 1046
	@Override
968 1047
	public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
969 1048
		return Concordance.class;
970 1049
	}
971

  
1050
	
1051
	@Override
972 1052
	public boolean isDirty() {
973 1053
		return annotManager != null;
974 1054
	}
975

  
1055
	
976 1056
	@Override
977 1057
	public boolean discardChanges() {
978 1058
		return false;
979 1059
	}
980

  
1060
	
981 1061
	@Override
982 1062
	public boolean needToUpdateIndexes() {
983 1063
		return true;
984 1064
	}
985
}
1065
}

Formats disponibles : Unified diff