protected void smartInsertAfterBracket(IDocument document,DocumentCommand command){
  if (command.offset == -1 || document.getLength() == 0) {
    return;
  }
  try {
    int p=(command.offset == document.getLength() ? command.offset - 1 : command.offset);
    int line=document.getLineOfOffset(p);
    int start=document.getLineOffset(line);
    int whiteend=findEndOfWhiteSpace(document,start,command.offset);
    if (whiteend == command.offset) {
      int indLine=findMatchingOpenBracket(document,line,command.offset,1);
      if (indLine != -1 && indLine != line) {
        StringBuffer replaceText=new StringBuffer(getIndentOfLine(document,indLine));
        replaceText.append(document.get(whiteend,command.offset - whiteend));
        replaceText.append(command.text);
        command.length=command.offset - start;
        command.offset=start;
        command.text=replaceText.toString();
      }
    }
  }
 catch (  BadLocationException e) {
    GWTPluginLog.logError(e);
  }
}

protected void smartInsertAfterBracket ( IDocument document , DocumentCommand command ) { if ( command . offset == - 1 || document . getLength ( ) == 0 ) { return ; } try { int p = ( command . offset == document . getLength ( ) ? command . offset - 1 : command . offset ) ; int line = document . getLineOfOffset ( p ) ; int start = document . getLineOffset ( line ) ; int whiteend = findEndOfWhiteSpace ( document , start , command . offset ) ; if ( whiteend == command . offset ) { int indLine = findMatchingOpenBracket ( document , line , command . offset , 1 ) ; if ( indLine != - 1 && indLine != line ) { StringBuffer replaceText = new StringBuffer ( getIndentOfLine ( document , indLine ) ) ; replaceText . append ( document . get ( whiteend , command . offset - whiteend ) ) ; replaceText . append ( command . text ) ; command . length = command . offset - start ; command . offset = start ; command . text = replaceText . toString ( ) ; } } } catch ( BadLocationException e ) { GWTPluginLog . logError ( e ) ; } }
set the indent of a bracket based on the command provided in the supplied document .
