try { LinkedPositionManager manager= new LinkedPositionManager(document); for (int i= 0; i != fPositionOffsets.length; i++) manager.addPosition(replacementOffset + fPositionOffsets[i], fPositionLengths[i]);
if (LinkedPositionManager.hasActiveManager(document)) { fSelectedRegion= (fPositionOffsets.length == 0) ? new Region(replacementOffset + replacementString.length(), 0) : new Region(replacementOffset + fPositionOffsets[0], fPositionLengths[0]);
	public void apply(IDocument document, char trigger, int offset) {		super.apply(document, trigger, offset);		int replacementOffset= getReplacementOffset();		String replacementString= getReplacementString();				try {			LinkedPositionManager manager= new LinkedPositionManager(document);			for (int i= 0; i != fPositionOffsets.length; i++)				manager.addPosition(replacementOffset + fPositionOffsets[i], fPositionLengths[i]);						LinkedPositionUI editor= new LinkedPositionUI(fViewer, manager);			editor.setFinalCaretOffset(replacementOffset + replacementString.length());			editor.enter();			fSelectedRegion= editor.getSelectedRegion();		} catch (BadLocationException e) {			JavaPlugin.log(e);				openErrorDialog(e);		}			}