fLastMainTokenEnd= -1;
mainTokenEnd= -1;
	private int computeHeaderEnd(IDocument document) {		if (document == null)			return -1;				try {			if (fLastMainTokenEnd >= 0 && document.hashCode() == fLastDocumentHash && fLastMainTokenEnd < document.getLength() && document.get(0, fLastMainTokenEnd).hashCode() == fLastHeaderHash)				return fLastDocumentsHeaderEnd;		} catch (BadLocationException e) {			// should not happen -> recompute		}				IScanner scanner= ToolFactory.createScanner(true, false, false, false);		scanner.setSource(document.get().toCharArray());		try {			int offset= -1;						int terminal= scanner.getNextToken();			while (terminal != ITerminalSymbols.TokenNameEOF && !(terminal == ITerminalSymbols.TokenNameclass || terminal == ITerminalSymbols.TokenNameinterface)) {								if (terminal == ITerminalSymbols.TokenNameCOMMENT_JAVADOC)					offset= scanner.getCurrentTokenStartPosition();								terminal= scanner.getNextToken();			}						int mainTokenEnd= scanner.getCurrentTokenEndPosition();			if (terminal != ITerminalSymbols.TokenNameEOF)				mainTokenEnd++;			else				offset= -1;						try {				fLastHeaderHash= document.get(0, mainTokenEnd).hashCode();			} catch (BadLocationException e) {				// should not happen -> recompute next time				fLastMainTokenEnd= -1;			}						fLastDocumentHash= document.hashCode();			fLastMainTokenEnd= mainTokenEnd;			fLastDocumentsHeaderEnd= offset;			return offset;					} catch (InvalidInputException ex) {			// enable formatting			return -1;		}	}