code: protected String addWhiteSpace( int offset ) throws BadLocationException
    {
      StringBuilder whiteSpace = new StringBuilder();
      int line = _root.getElementIndex( offset );
      int i = _root.getElement( line ).getStartOffset();
      while( true )
      {
        String temp = getText( i, 1 );
        if( temp.equals( " " ) || temp.equals( "\t" ) )
        {
          whiteSpace.append( temp );
          i++;
        }
        else
        {
          break;
        }
      }
      return "\n" + whiteSpace;
    }
docs: /*
  Overide bracket matching for other languages