private String computeJavadocIndent(IDocument document,int line,JavaHeuristicScanner scanner,ITypedRegion partition) throws BadLocationException {
  if (line == 0)   return null;
  final IRegion lineInfo=document.getLineInformation(line);
  final int lineStart=lineInfo.getOffset();
  final int lineLength=lineInfo.getLength();
  final int lineEnd=lineStart + lineLength;
  int nonWS=scanner.findNonWhitespaceForwardInAnyPartition(lineStart,lineEnd);
  if (nonWS == JavaHeuristicScanner.NOT_FOUND || document.getChar(nonWS) != '*') {
    if (nonWS == JavaHeuristicScanner.NOT_FOUND)     return document.get(lineStart,lineLength);
    return document.get(lineStart,nonWS - lineStart);
  }
  IRegion previousLine=document.getLineInformation(line - 1);
  int previousLineStart=previousLine.getOffset();
  int previousLineLength=previousLine.getLength();
  int previousLineEnd=previousLineStart + previousLineLength;
  StringBuffer buf=new StringBuffer();
  int previousLineNonWS=scanner.findNonWhitespaceForwardInAnyPartition(previousLineStart,previousLineEnd);
  if (previousLineNonWS == JavaHeuristicScanner.NOT_FOUND || document.getChar(previousLineNonWS) != '*') {
    previousLine=document.getLineInformationOfOffset(partition.getOffset());
    previousLineStart=previousLine.getOffset();
    previousLineLength=previousLine.getLength();
    previousLineEnd=previousLineStart + previousLineLength;
    previousLineNonWS=scanner.findNonWhitespaceForwardInAnyPartition(previousLineStart,previousLineEnd);
    if (previousLineNonWS == JavaHeuristicScanner.NOT_FOUND)     previousLineNonWS=previousLineEnd;
    buf.append(' ');
  }
  String indentation=document.get(previousLineStart,previousLineNonWS - previousLineStart);
  buf.insert(0,indentation);
  return buf.toString();
}

private String computeJavadocIndent ( IDocument document , int line , JavaHeuristicScanner scanner , ITypedRegion partition ) throws BadLocationException { if ( line == 0 ) return null ; final IRegion lineInfo = document . getLineInformation ( line ) ; final int lineStart = lineInfo . getOffset ( ) ; final int lineLength = lineInfo . getLength ( ) ; final int lineEnd = lineStart + lineLength ; int nonWS = scanner . findNonWhitespaceForwardInAnyPartition ( lineStart , lineEnd ) ; if ( nonWS == JavaHeuristicScanner . NOT_FOUND || document . getChar ( nonWS ) != '*' ) { if ( nonWS == JavaHeuristicScanner . NOT_FOUND ) return document . get ( lineStart , lineLength ) ; return document . get ( lineStart , nonWS - lineStart ) ; } IRegion previousLine = document . getLineInformation ( line - 1 ) ; int previousLineStart = previousLine . getOffset ( ) ; int previousLineLength = previousLine . getLength ( ) ; int previousLineEnd = previousLineStart + previousLineLength ; StringBuffer buf = new StringBuffer ( ) ; int previousLineNonWS = scanner . findNonWhitespaceForwardInAnyPartition ( previousLineStart , previousLineEnd ) ; if ( previousLineNonWS == JavaHeuristicScanner . NOT_FOUND || document . getChar ( previousLineNonWS ) != '*' ) { previousLine = document . getLineInformationOfOffset ( partition . getOffset ( ) ) ; previousLineStart = previousLine . getOffset ( ) ; previousLineLength = previousLine . getLength ( ) ; previousLineEnd = previousLineStart + previousLineLength ; previousLineNonWS = scanner . findNonWhitespaceForwardInAnyPartition ( previousLineStart , previousLineEnd ) ; if ( previousLineNonWS == JavaHeuristicScanner . NOT_FOUND ) previousLineNonWS = previousLineEnd ; buf . append ( ' ' ) ; } String indentation = document . get ( previousLineStart , previousLineNonWS - previousLineStart ) ; buf . insert ( 0 , indentation ) ; return buf . toString ( ) ; }
computes and returns the indentation for a javadoc line . the line must be inside a javadoc comment .
