Révision 2855

tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 2855)
19 19
import org.eclipse.jface.viewers.ISelectionChangedListener;
20 20
import org.eclipse.jface.viewers.IStructuredSelection;
21 21
import org.eclipse.jface.viewers.SelectionChangedEvent;
22
import org.eclipse.jface.viewers.StructuredSelection;
22 23
import org.eclipse.jface.viewers.TableViewer;
23 24
import org.eclipse.jface.viewers.TableViewerColumn;
24 25
import org.eclipse.osgi.util.NLS;
......
134 135
	public String getName() {
135 136
		return KRAnnotationUIMessages.squencesDeMotsCatgorievaleur;
136 137
	}
137
	
138

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

  
......
144 145
		this.corpus = concordance.getCorpus();
145 146
		this.annotations = new ConcordanceAnnotations(this.editor.getConcordance());
146 147
		this.annotManager = KRAnnotationEngine.getAnnotationManager(corpus);
147
		
148

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

  
150 151
		// RESULT
......
152 153
		if (position < 0) {
153 154
			position = 3 + extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
154 155
		}
155
		
156

  
156 157
		TableViewerColumn annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
157 158
		annotationColumn = annotationColumnViewer.getColumn();
158 159
		annotationColumn.setText(KRAnnotationUIMessages.category);
......
216 217
			Log.fine(" KR: "+kr); //$NON-NLS-1$
217 218
			List<AnnotationType> krtypes = kr.getAllAnnotationTypes();
218 219
			for (AnnotationType type : krtypes) {
219
				 if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
220
					 typesList.add(type);
221
				 }
220
				if (type.getEffect().equals(AnnotationEffect.SEGMENT)) {
221
					typesList.add(type);
222
				}
222 223
			}
223 224

  
224 225
			Log.fine(NLS.bind(KRAnnotationUIMessages.availableAnnotationTypesColonP0, typesList));
......
299 300
			annotationTypesCombo.getCombo().select(0);
300 301
			annotations.setViewAnnotation(typesList.get(0));
301 302
		}
302
		
303

  
303 304
		annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
304 305
			@Override
305 306
			public void selectionChanged(SelectionChangedEvent event) {
......
382 383
					if (dialog.open() == InputDialog.OK) {
383 384
						String name = dialog.getValue();
384 385
						if (name.trim().length() == 0) return;
385
						String baseid = AsciiUtils.buildId(name);
386 386
						String id = AsciiUtils.buildId(name);
387
						int c = 1;
388
						while (kr.getType(id) != null) {
389
							id = baseid+"_"+(c++); //$NON-NLS-1$
387
						AnnotationType existingType = kr.getType(id);
388
						if (existingType != null) {
389
							Log.warning(NLS.bind("The ''{0}'' annotation type already exists. Please use another name ({1}).", id, name));
390
							annotationTypesCombo.setSelection(new StructuredSelection(existingType));
391
							return;
390 392
						}
391 393
						AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
392 394
						type.setEffect(AnnotationEffect.SEGMENT);
......
532 534
			@Override
533 535
			public void widgetDefaultSelected(SelectionEvent e) { }
534 536
		});
535
//		Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
536
//		saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
537
//		saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
538
//
539
//		saveAnnotationButton.addSelectionListener(new SelectionListener() {
540
//			@Override
541
//			public void widgetSelected(SelectionEvent e) {
542
//
543
//				try {
544
//					AnnotationManager am = KRAnnotationEngine.getAnnotationManager(corpus);
545
//					if (am != null && am.hasChanges()) {
546
//						// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
547
//						JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
548
//						
549
//						if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
550
//							// update editor corpus
551
//							System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
552
//						}
553
//						
554
//						CorporaView.refresh();
555
//					}
556
//				} catch(Exception ex) {
557
//					ex.printStackTrace();
558
//				}
559
//			}
560
//
561
//			@Override
562
//			public void widgetDefaultSelected(SelectionEvent e) { }
563
//		});
564
		
537
		//		Button saveAnnotationButton = new Button(annotationArea, SWT.PUSH);
538
		//		saveAnnotationButton.setToolTipText(KRAnnotationUIMessages.saveTheAnnotations);
539
		//		saveAnnotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
540
		//
541
		//		saveAnnotationButton.addSelectionListener(new SelectionListener() {
542
		//			@Override
543
		//			public void widgetSelected(SelectionEvent e) {
544
		//
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
		//			}
562
		//
563
		//			@Override
564
		//			public void widgetDefaultSelected(SelectionEvent e) { }
565
		//		});
566

  
565 567
		Button closeButton = new Button(annotationArea, SWT.PUSH);
566 568
		closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
567 569
		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_DELETE));
568 570
		closeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
569 571
		closeButton.addSelectionListener(new SelectionListener() {
570
			
572

  
571 573
			@Override
572 574
			public void widgetSelected(SelectionEvent e) {
573 575
				extension.removeAnnotationArea(KRAnnotation.this);
574 576
			}
575
			
577

  
576 578
			@Override
577 579
			public void widgetDefaultSelected(SelectionEvent e) {}
578 580
		});
579
		
581

  
580 582
		updateAnnotationWidgetStates();
581 583
		editor.layout(true);
582 584

  
......
599 601
			return false;
600 602
		}
601 603
	}
602
	
604

  
603 605
	protected void affectAnnotationToSelection(ISelection selection) {
604 606

  
605 607
		final IStructuredSelection lineSelection = (IStructuredSelection) selection;
......
614 616

  
615 617
	protected AnnotationType getSelectedAnnotationType() {
616 618
		if (annotationTypesCombo.getCombo().isDisposed()) return null;
617
		
619

  
618 620
		IStructuredSelection isel = (IStructuredSelection)annotationTypesCombo.getSelection();
619 621
		if (isel.isEmpty()) {
620 622
			return null;
......
654 656

  
655 657
	public void updateAnnotationWidgetStates() {
656 658
		if (annotationArea == null) return; // :)
659
		if (annotationArea.isDisposed()) return;
660

  
657 661
		annotationArea.getDisplay().syncExec(new Runnable() {
658 662

  
659 663
			@Override
......
683 687
					}
684 688
				}
685 689

  
686
					if (infosAnnotTypeSelectedLink != null) {
687
						infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
688
					}
690
				if (infosAnnotTypeSelectedLink != null) {
691
					infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
692
				}
689 693
				if (addTypedValueLink != null) {
690 694
					addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
691 695
				}
......
860 864
	}
861 865

  
862 866
	public boolean notifyStartOfCompute() throws Exception {
863
		if (annotationArea != null) {
864
			annotationArea.getDisplay().syncExec(new Runnable() {
865
				@Override
866
				public void run() {
867
					AnnotationType type = getSelectedAnnotationType();
868
					if (type != null) {
869
						annotations.setViewAnnotation(type);
870
						annotations.setAnnotationOverlap(true);
871
					}
867
		if (annotationArea == null) return false;
868
		if (annotationArea.isDisposed()) return false;
869

  
870
		annotationArea.getDisplay().syncExec(new Runnable() {
871
			@Override
872
			public void run() {
873
				AnnotationType type = getSelectedAnnotationType();
874
				if (type != null) {
875
					annotations.setViewAnnotation(type);
876
					annotations.setAnnotationOverlap(true);
872 877
				}
873
			});
874
		}
878
			}
879
		});
880

  
875 881
		return true;
876 882
	}
877 883

  
878 884
	public boolean notifyEndOfCompute() throws Exception {
879 885
		updateAnnotationWidgetStates();
880

  
886
		if (annotationArea == null) return false;
887
		if (annotationArea.isDisposed()) return false;
888
		
881 889
		// update annotation column width
882 890
		if (annotationArea != null) {
883 891
			annotationArea.getDisplay().syncExec(new Runnable() {
......
937 945
	@Override
938 946
	public void notifyEndOfRefresh() throws Exception {
939 947
		// TODO Auto-generated method stub
940
		
948

  
941 949
	}
942 950

  
943 951
	@Override
944 952
	public void notifyStartOfCreatePartControl() throws Exception {
945 953
		// TODO Auto-generated method stub
946
		
954

  
947 955
	}
948 956

  
949 957
	@Override
......
956 964
	public Class<? extends TXMResult> getAnnotatedTXMResultClass() {
957 965
		return Concordance.class;
958 966
	}
959
	
967

  
960 968
	public boolean isDirty() {
961 969
		return annotManager != null;
962 970
	}
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 2855)
130 130
	public String getName() {
131 131
		return KRAnnotationUIMessages.motsPropritsInfDfaut;
132 132
	}
133
	
133

  
134 134
	@Override
135 135
	public boolean allowMultipleAnnotations() {
136 136
		return true;
......
217 217
		}
218 218

  
219 219
		Log.info(TXMCoreMessages.bind(KRAnnotationUIMessages.AffectP0ToSelectionEqualsP1, value_to_add.getId(), value_to_add.getTypeID(), matches.size()));
220
		
220

  
221 221
		// finally we can 'try' to create the annotations \o/
222 222
		try {
223 223
			HashMap<Match, List<Annotation>> existingAnnots = annotManager.createAnnotations(type, value_to_add, matches, job);
......
270 270
			}
271 271
		});
272 272
	}
273
	
273

  
274 274
	protected void deleteAnnotationValues(ISelection selection) {
275 275

  
276 276
		final IStructuredSelection lineSelection = (IStructuredSelection) selection;
......
282 282

  
283 283
		deleteAnnotationValues(matches);
284 284
	}
285
	
285

  
286 286
	protected void deleteAnnotationValues(final List<Match> matches) {
287 287
		final AnnotationType type = getSelectedAnnotationType();
288 288

  
......
386 386
		if (position < 0) {
387 387
			position = 3 + extension.getNumberOfAnnotationArea(); // after keyword column and previous annotation columns
388 388
		}
389
		
389

  
390 390
		annotationColumnViewer = new TableViewerColumn(viewer, SWT.CENTER, position);
391 391
		annotationColumn = annotationColumnViewer.getColumn();
392 392
		annotationColumn.setText(KRAnnotationUIMessages.property);
......
422 422
					return EMPTYTEXT;
423 423
				}
424 424
			}
425
			
425

  
426 426
			@Override
427 427
			public Font getFont(Object element) {
428 428
				Line line = (Line)element;
429
				
429

  
430 430
				AnnotationLine annotationLine = annotations.getAnnotationLine(line);
431 431
				if (annotationLine == null) return null;
432
				
432

  
433 433
				Annotation a = annotationLine.getAnnotation();
434 434
				if (a == null) return null;
435 435

  
436 436
				String value = annotationLine.getAnnotationValue().getStandardName();
437 437
				if (a instanceof CQPAnnotation) return null;
438
				
438

  
439 439
				return annotationColummnFont;
440 440
			}
441 441
		});
......
492 492
		gdata.widthHint = 90;
493 493

  
494 494
		new Label(annotationArea, SWT.NONE).setText(TXMCoreMessages.common_property);
495
		
495

  
496 496
		//Display combo with list of Annotation Type 
497 497
		annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
498 498
		annotationTypesCombo.setContentProvider(new ArrayContentProvider());
......
506 506
				return ((AnnotationType)element).getName(); //$NON-NLS-1$
507 507
			}
508 508
		});
509
//		annotationTypesCombo.getCombo().addKeyListener(new KeyListener() {
510
//			
511
//			@Override
512
//			public void keyReleased(KeyEvent e) {
513
//				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
514
//					String name = annotationTypesCombo.getCombo().getText();
515
//					if (currentKnowledgeRepository.getType(name) == null) {
516
//						createNewType(e, name);
517
//					} else {
518
//						for (AnnotationType type : typesList) {
519
//							if (name.equals(type.getId())) {
520
//								StructuredSelection selection = new StructuredSelection(type);
521
//								annotationTypesCombo.setSelection(selection, true);
522
//								break;
523
//							}
524
//						}
525
//					}
526
//				}
527
//			}
528
//			
529
//			@Override
530
//			public void keyPressed(KeyEvent e) { }
531
//		});
532
	
509
		//		annotationTypesCombo.getCombo().addKeyListener(new KeyListener() {
510
		//			
511
		//			@Override
512
		//			public void keyReleased(KeyEvent e) {
513
		//				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
514
		//					String name = annotationTypesCombo.getCombo().getText();
515
		//					if (currentKnowledgeRepository.getType(name) == null) {
516
		//						createNewType(e, name);
517
		//					} else {
518
		//						for (AnnotationType type : typesList) {
519
		//							if (name.equals(type.getId())) {
520
		//								StructuredSelection selection = new StructuredSelection(type);
521
		//								annotationTypesCombo.setSelection(selection, true);
522
		//								break;
523
		//							}
524
		//						}
525
		//					}
526
		//				}
527
		//			}
528
		//			
529
		//			@Override
530
		//			public void keyPressed(KeyEvent e) { }
531
		//		});
532

  
533 533
		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
534 534
		gdata.widthHint = 200;
535 535

  
......
538 538
		annotationTypesCombo.getCombo().select(0);
539 539
		annotations.setViewAnnotation(typesList.get(0));
540 540
		annotationColumn.setText(typesList.get(0).getName());
541
//		for (int i = 0 ; i < typesList.size(); i++) {
542
//			String name = typesList.get(i).getName();
543
//			if ("word".equals(name)) {
544
//				annotations.setViewAnnotation(typesList.get(i));
545
//				annotationColumn.setText(name);
546
//			}
547
//		}
541
		//		for (int i = 0 ; i < typesList.size(); i++) {
542
		//			String name = typesList.get(i).getName();
543
		//			if ("word".equals(name)) {
544
		//				annotations.setViewAnnotation(typesList.get(i));
545
		//				annotationColumn.setText(name);
546
		//			}
547
		//		}
548 548

  
549 549
		annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
550 550
			@Override
......
552 552
				onAnnotationTypeSelected(event);
553 553
			}
554 554
		});
555
		
555

  
556 556
		addAnnotationTypeLink = new Button(annotationArea, SWT.PUSH);
557 557
		addAnnotationTypeLink.setToolTipText(KRAnnotationUIMessages.addANewCategory);
558 558
		addAnnotationTypeLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
......
570 570
				if (dialog.open() == InputDialog.OK) {
571 571
					String name = dialog.getValue();
572 572
					if (name.trim().length() == 0) return;
573
					String baseid = AsciiUtils.buildId(name);
574 573
					String id = AsciiUtils.buildId(name);
575
					int c = 1;
576
					while (kr.getType(id) != null) {
577
						id = baseid+"_"+(c++); //$NON-NLS-1$
574
					AnnotationType existingType = kr.getType(id);
575
					if (existingType != null) {
576
						Log.warning(NLS.bind("The ''{0}'' annotation type already exists. Please use another name ({1}).", id, name));
577
						annotationTypesCombo.setSelection(new StructuredSelection(existingType));
578
						return;
578 579
					}
579 580
					AnnotationType type = kr.addType(name, id, "", AnnotationEffect.TOKEN); //$NON-NLS-1$
580 581
					typesList.add(type);
......
582 583
					if (annotationTypesCombo != null) annotationTypesCombo.refresh();
583 584
					if (typesList.size() == 1) {
584 585
						if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(typesList.size()-1);
585
						
586

  
586 587
						if (concordance != null) {
587 588
							annotations.setViewAnnotation(type);
588 589
							annotations.setAnnotationOverlap(true);
......
590 591
							editor.fillDisplayArea(false);
591 592
						}
592 593
						annotationArea.layout(true);
593
						
594

  
594 595
					} else {
595 596
						if (typesList.size() > 1) {
596 597
							if (annotationTypesCombo != null) {
......
632 633
			@Override
633 634
			public void keyPressed(KeyEvent e) { }
634 635
		});
635
		
636

  
636 637
		addTypedValueLink = new Button(annotationArea, SWT.PUSH);
637 638
		addTypedValueLink.setText("..."); //$NON-NLS-1$
638 639
		addTypedValueLink.setToolTipText(KRAnnotationUIMessages.selectAValueAmongTheList);
......
685 686
		});
686 687

  
687 688
		new Label(annotationArea, SWT.NONE).setText(" ");
688
		
689

  
689 690
		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
690 691
		affectAnnotationButton.setText(KRAnnotationUIMessages.oK);
691 692
		affectAnnotationButton.setToolTipText(KRAnnotationUIMessages.proceedToAnnotation);
......
699 700
			@Override
700 701
			public void widgetDefaultSelected(SelectionEvent e) { }
701 702
		});
702
		
703

  
703 704
		deleteAnnotationButton = new Button(annotationArea, SWT.PUSH);
704 705
		deleteAnnotationButton.setText(KRAnnotationUIMessages.delete);
705 706
		deleteAnnotationButton.setToolTipText(KRAnnotationUIMessages.delete);
......
735 736
			@Override
736 737
			public void widgetDefaultSelected(SelectionEvent e) { }
737 738
		});
738
		
739

  
739 740
		addAnnotationTypeButton = new Button(annotationArea, SWT.PUSH);
740 741
		addAnnotationTypeButton.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
741 742
		addAnnotationTypeButton.setToolTipText(KRAnnotationUIMessages.addANewCategory);
......
744 745
			@Override
745 746
			public void widgetSelected(SelectionEvent e) {
746 747
				try {
747
//					int position = -1;
748
//					TableColumn[] columns = editor.getLineTableViewer().getTable().getColumns();
749
//					TableColumn column = annotationColumnViewer.getColumn();
750
//					for (int i = 0 ; i < columns.length ; i++) {
751
//						if (columns[i] == column) {
752
//							position = i + 1; // after the current column
753
//						}
754
//					}
755
//					int position = 3 + extension.getNumberOfAnnotationArea();
748
					//					int position = -1;
749
					//					TableColumn[] columns = editor.getLineTableViewer().getTable().getColumns();
750
					//					TableColumn column = annotationColumnViewer.getColumn();
751
					//					for (int i = 0 ; i < columns.length ; i++) {
752
					//						if (columns[i] == column) {
753
					//							position = i + 1; // after the current column
754
					//						}
755
					//					}
756
					//					int position = 3 + extension.getNumberOfAnnotationArea();
756 757
					extension.openAnnotationMode(new WordAnnotationToolbar(), -1);
757 758
				} catch (Exception e1) {
758 759
					// TODO Auto-generated catch block
......
763 764
			@Override
764 765
			public void widgetDefaultSelected(SelectionEvent e) { }
765 766
		});
766
		
767

  
767 768
		Button closeButton = new Button(annotationArea, SWT.PUSH);
768 769
		closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
769 770
		closeButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_REMOVE));
770
		
771

  
771 772
		closeButton.addSelectionListener(new SelectionListener() {
772
			
773

  
773 774
			@Override
774 775
			public void widgetSelected(SelectionEvent e) {
775 776
				extension.removeAnnotationArea(WordAnnotationToolbar.this);
776 777
			}
777
			
778

  
778 779
			@Override
779 780
			public void widgetDefaultSelected(SelectionEvent e) {}
780 781
		});
......
789 790
		IStructuredSelection sel = (IStructuredSelection) annotationTypesCombo.getSelection();
790 791
		AnnotationType type = (AnnotationType) sel.getFirstElement();
791 792
		if (type == null) return;
792
		
793

  
793 794
		if (type.getSize() != AnnotationType.ValuesSize.LARGE) {
794 795
			try {
795 796
				KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
......
814 815
	}
815 816

  
816 817
	protected void createNewType(TypedEvent e, String typeName) {
817
		
818

  
818 819
		if (currentKnowledgeRepository == null) return;
819 820
		if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
820 821

  
......
836 837
			StructuredSelection selection = new StructuredSelection(type);
837 838
			annotationTypesCombo.setSelection(selection, true);
838 839

  
839
//			if (annotationTypesCombo != null) annotationTypesCombo.refresh();
840
//			if (typesList.size() == 1) {
841
//				if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
842
//				annotations.setViewAnnotation(type);
843
//				annotations.setAnnotationOverlap(true);
844
//				try {
845
//					editor.refresh(false);
846
//				} catch (Exception e1) {
847
//					// TODO Auto-generated catch block
848
//					e1.printStackTrace();
849
//				}
850
//				annotationArea.layout(true);
851
//			} else {
852
//				if (typesList.size() > 1) {
853
//					if (annotationTypesCombo != null) {
854
//						annotationTypesCombo.getCombo().select(typesList.size()-1);
855
//					}
856
//				}
857
//			}
858
//			KRView.refresh();
859
//			updateAnnotationWidgetStates();
860
			
840
			//			if (annotationTypesCombo != null) annotationTypesCombo.refresh();
841
			//			if (typesList.size() == 1) {
842
			//				if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
843
			//				annotations.setViewAnnotation(type);
844
			//				annotations.setAnnotationOverlap(true);
845
			//				try {
846
			//					editor.refresh(false);
847
			//				} catch (Exception e1) {
848
			//					// TODO Auto-generated catch block
849
			//					e1.printStackTrace();
850
			//				}
851
			//				annotationArea.layout(true);
852
			//			} else {
853
			//				if (typesList.size() > 1) {
854
			//					if (annotationTypesCombo != null) {
855
			//						annotationTypesCombo.getCombo().select(typesList.size()-1);
856
			//					}
857
			//				}
858
			//			}
859
			//			KRView.refresh();
860
			//			updateAnnotationWidgetStates();
861

  
861 862
			//onAnnotationTypeSelected(null);
862 863
		} else {
863 864
			System.out.println("Creation aborted."); //$NON-NLS-1$
......
889 890
			return false;
890 891
		}
891 892
	}
892
	
893

  
893 894
	@Override
894 895
	public boolean hasChanges() {
895 896
		AnnotationManager am;
......
909 910

  
910 911
	@Override
911 912
	public boolean notifyStartOfCompute() throws Exception {
912
		if (annotationArea != null) {
913
			AnnotationType type = getSelectedAnnotationType();
914
			if (type != null) {
915
				annotations.setViewAnnotation(type);
916
				annotations.setAnnotationOverlap(true);
917
			}
913
		if (annotationArea == null) return false;
914
		if (annotationArea.isDisposed()) return false;
915

  
916
		AnnotationType type = getSelectedAnnotationType();
917
		if (type != null) {
918
			annotations.setViewAnnotation(type);
919
			annotations.setAnnotationOverlap(true);
918 920
		}
921

  
919 922
		return true;
920 923
	}
921 924

  
......
930 933

  
931 934
	@Override
932 935
	public void notifyStartOfRefresh() throws Exception {
936
		if (annotationArea == null) return;
937
		if (annotationArea.isDisposed()) return;
938

  
933 939
		List<Line> lines = concordance.getLines(concordance.getTopIndex(), concordance.getTopIndex()+concordance.getNLinePerPage());
934 940
		annotations.computeLines(lines);
935
		
941

  
936 942
		updateAnnotationWidgetStates();
937 943

  
938 944
		// update annotation column width

Formats disponibles : Unified diff