int start= offset - insert.length(); if (start >= 0 && offset <= document.getLength()) {
int off; if (fPosition != null) { off= fPosition.getOffset(); } else { off= Math.max(0, offset - insert.length()); } int length= offset - off;  if (offset <= document.getLength()) {
		public boolean validate(IDocument document, int offset, DocumentEvent event) {			// ignore event			String insert= getDisplayString();			if (insert == null)				return false;						int start= offset - insert.length();			if (start >= 0 && offset <= document.getLength()) {				try {					String content= document.get(start, offset - start);//					while (content.length() > 0) {						if (insert.startsWith(content))							return true;//						else//							content= content.substring(1);//					}				} catch (BadLocationException e) {					JavaPlugin.log(e);					// and ignore and return false				}			}			return false;		}