if ((offset >= 0) && (offset <= region.getLength()))
if (!documentChanged && (offset >= 0) && (offset <= region.getLength()))
	private void leave2(boolean accept) {		StyledText text= fViewer.getTextWidget();			text.removePaintListener(this);		text.removeVerifyKeyListener(this);		text.removeModifyListener(this);		try {			IRegion region= fViewer.getVisibleRegion();			IDocument document= fViewer.getDocument();			if (accept) {				Position[] positions= document.getPositions(CARET_POSITION);				if ((positions != null) && (positions.length != 0)) {					int offset= positions[0].getOffset() - region.getOffset();							if ((offset >= 0) && (offset <= region.getLength()))						text.setSelection(offset, offset);				}			}			document.removePositionUpdater(fgUpdater);			document.removePositionCategory(CARET_POSITION);						if (!accept && (fCancelListener != null))				fCancelListener.performCancel();		} catch (BadPositionCategoryException e) {			JavaPlugin.log(e);			Assert.isTrue(false);		}				text.redraw();	}