Révision 2284

tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 2284)
616 616

  
617 617
	public boolean notifyStartOfCompute() throws Exception {
618 618
		if (annotationArea != null) {
619
			AnnotationType type = getSelectedAnnotationType();
620
			if (type != null) {
621
				annotations.setViewAnnotation(type);
622
				annotations.setAnnotationOverlap(true);
623
			}
619
			annotationArea.getDisplay().syncExec(new Runnable() {
620
				@Override
621
				public void run() {
622
					AnnotationType type = getSelectedAnnotationType();
623
					if (type != null) {
624
						annotations.setViewAnnotation(type);
625
						annotations.setAnnotationOverlap(true);
626
					}
627
				}
628
			});
629
			
624 630
		}
625 631
		return true;
626 632
	}
......
630 636

  
631 637
		// update annotation column width
632 638
		if (annotationArea != null) {
633
			annotationColumn.pack();
634

  
635
			annotationColumn.setResizable(true);
639
			annotationArea.getDisplay().syncExec(new Runnable() {
640
				@Override
641
				public void run() {
642
					annotationColumn.pack();
643
					annotationColumn.setResizable(true);
644
				}
645
			});
636 646
		} else { 
637 647
			annotationColumn.setWidth(0);
638 648
		}
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 2284)
532 532
			@Override
533 533
			public void widgetDefaultSelected(SelectionEvent e) { }
534 534
		});
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
		});
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 564
		
565 565
		Button closeButton = new Button(annotationArea, SWT.PUSH);
566 566
		closeButton.setToolTipText(KRAnnotationUIMessages.closeTheToolbarWithoutSaving);
......
654 654

  
655 655
	public void updateAnnotationWidgetStates() {
656 656
		if (annotationArea == null) return; // :)
657
		annotationArea.getDisplay().syncExec(new Runnable() {
657 658

  
658
		if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
659
			@Override
660
			public void run() {
661
				if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
659 662

  
660
			if (getSelectedAnnotationType() != null) {
661
				annotationValuesText.setEnabled(true);
663
					if (getSelectedAnnotationType() != null) {
664
						annotationValuesText.setEnabled(true);
662 665

  
663
				affectAnnotationButton.setEnabled(true);
664
				affectCombo.setEnabled(true);
665
			} else {
666
				annotationValuesText.setEnabled(false);
666
						affectAnnotationButton.setEnabled(true);
667
						affectCombo.setEnabled(true);
668
					} else {
669
						annotationValuesText.setEnabled(false);
667 670

  
668
				affectAnnotationButton.setEnabled(false);
669
				affectCombo.setEnabled(false);
670
			}
671
		} else {
672
			annotationValuesText.setEnabled(false);
671
						affectAnnotationButton.setEnabled(false);
672
						affectCombo.setEnabled(false);
673
					}
674
				} else {
675
					annotationValuesText.setEnabled(false);
673 676

  
674
			if (getSelectedAnnotationType() != null) {
675
				affectAnnotationButton.setEnabled(true);
676
				affectCombo.setEnabled(true);
677
			} else {
678
				affectAnnotationButton.setEnabled(false);
679
				affectCombo.setEnabled(false);
680
			}
681
		}
677
					if (getSelectedAnnotationType() != null) {
678
						affectAnnotationButton.setEnabled(true);
679
						affectCombo.setEnabled(true);
680
					} else {
681
						affectAnnotationButton.setEnabled(false);
682
						affectCombo.setEnabled(false);
683
					}
684
				}
682 685

  
683
			if (infosAnnotTypeSelectedLink != null) {
684
				infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
686
					if (infosAnnotTypeSelectedLink != null) {
687
						infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
688
					}
689
				if (addTypedValueLink != null) {
690
					addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
691
				}
692

  
693
				if (concordance == null) {
694
					affectAnnotationButton.setEnabled(false);
695
					affectCombo.setEnabled(false);
696
				}
685 697
			}
686
		if (addTypedValueLink != null) {
687
			addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
688
		}
689

  
690
		if (concordance == null) {
691
			affectAnnotationButton.setEnabled(false);
692
			affectCombo.setEnabled(false);
693
		}
698
		});
694 699
	}
695 700

  
696 701
	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
......
856 861

  
857 862
	public boolean notifyStartOfCompute() throws Exception {
858 863
		if (annotationArea != null) {
859
			AnnotationType type = getSelectedAnnotationType();
860
			if (type != null) {
861
				annotations.setViewAnnotation(type);
862
				annotations.setAnnotationOverlap(true);
863
			}
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
					}
872
				}
873
			});
864 874
		}
865 875
		return true;
866 876
	}
......
870 880

  
871 881
		// update annotation column width
872 882
		if (annotationArea != null) {
873
			annotationColumn.pack();
874

  
875
			annotationColumn.setResizable(true);
883
			annotationArea.getDisplay().syncExec(new Runnable() {
884
				@Override
885
				public void run() {
886
					annotationColumn.pack();
887
					annotationColumn.setResizable(true);
888
				}
889
			});
876 890
		} else { 
877 891
			annotationColumn.setWidth(0);
878 892
		}
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/CQPAnnotationManager.java (revision 2284)
264 264
					start = m.getStart();
265 265
					end = m.getEnd();
266 266
				}
267
				if(smatch[1] < start) { // next struct
267
				if (smatch[1] < start) { // next struct
268 268
					iStruct++;
269 269
					if (iStruct < Nstruct)
270 270
						smatch = CQPSearchEngine.getCqiClient().struc2Cpos(sup.getQualifiedName(), iStruct);
......
310 310
					values.add(null);
311 311
					annotationsStartEnd.add(null);
312 312
					iMatch++;
313
				} 
313
				} else {
314
					values.add(null);
315
					annotationsStartEnd.add(null);
316
					iMatch++;
317
				}
314 318
			}
315 319
		}
316 320

  

Formats disponibles : Unified diff