question: protected void smartIndentAfterNewLine ( IDocument document , DocumentCommand command ) { int docLength = document . getLength ( ) ; if ( command . offset == - 1 || docLength == 0 ) { return ; } try { int p = ( command . offset == docLength ? command . offset - 1 : command . offset ) ; int line = document . getLineOfOffset ( p ) ; StringBuffer buf = new StringBuffer ( command . text ) ; if ( command . offset < docLength && document . getChar ( command . offset ) == '}' ) { int indLine = findMatchingOpenBracket ( document , line , command . offset , 0 ) ; if ( indLine == - 1 ) { indLine = line ; } buf . append ( getIndentOfLine ( document , indLine ) ) ; } else { int start = document . getLineOffset ( line ) ; int whiteend = findEndOfWhiteSpace ( document , start , command . offset ) ; buf . append ( document . get ( start , whiteend - start ) ) ; if ( getBracketCount ( document , start , command . offset , true ) > 0 ) { buf . append ( getIndentToken ( ) ) ; } } command . text = buf . toString ( ) ; } catch ( BadLocationException e ) { GWTPluginLog . logError ( e ) ; } }
target:  Set the indent of a new line based on the command provided in the supplied document.