if (viewer instanceof ISourceViewer) { ISourceViewer sv= (ISourceViewer) viewer; IAnnotationModel model= sv.getAnnotationModel(); if (model instanceof IAnnotationModelExtension) { IAnnotationModelExtension ext= (IAnnotationModelExtension) model; IAnnotationModel ourModel= ext.getAnnotationModel(getUniqueKey()); if (ourModel == null) { LinkedPositionAnnotations lpa= new LinkedPositionAnnotations(); lpa.setTargets(fIterator.getPositions()); lpa.setExitTarget(fExitPosition); ext.addAnnotationModel(getUniqueKey(), lpa); fCurrentTarget.fAnnotationModel= lpa; } } }
createAnnotationModel();
	private void connect() {		Assert.isNotNull(fCurrentTarget);		ITextViewer viewer= fCurrentTarget.getViewer();		Assert.isNotNull(viewer);		fCurrentTarget.fWidget= viewer.getTextWidget();		if (fCurrentTarget.fWidget == null)			leave(ILinkedListener.EXIT_ALL);		if (fCurrentTarget.fKeyListener == null) {			fCurrentTarget.fKeyListener= new LinkedUIKeyListener();			((ITextViewerExtension) viewer).prependVerifyKeyListener(fCurrentTarget.fKeyListener);		} else			fCurrentTarget.fKeyListener.setEnabled(true);				((IPostSelectionProvider) viewer).addPostSelectionChangedListener(fSelectionListener);		if (viewer instanceof ISourceViewer) {			ISourceViewer sv= (ISourceViewer) viewer;			IAnnotationModel model= sv.getAnnotationModel();			if (model instanceof IAnnotationModelExtension) {				IAnnotationModelExtension ext= (IAnnotationModelExtension) model;				IAnnotationModel ourModel= ext.getAnnotationModel(getUniqueKey());				if (ourModel == null) {					LinkedPositionAnnotations lpa= new LinkedPositionAnnotations();					lpa.setTargets(fIterator.getPositions());					lpa.setExitTarget(fExitPosition);					ext.addAnnotationModel(getUniqueKey(), lpa);					fCurrentTarget.fAnnotationModel= lpa;				}			}		}		fCurrentTarget.fWidget.showSelection();		fCurrentTarget.fWidget.addVerifyListener(fCaretListener);		fCurrentTarget.fWidget.addModifyListener(fCaretListener);		fCurrentTarget.fShell= fCurrentTarget.fWidget.getShell();		if (fCurrentTarget.fShell == null)			leave(ILinkedListener.EXIT_ALL);		fCurrentTarget.fShell.addShellListener(fCloser);		fAssistant.install(viewer);	}