protected void updateReplacementLengthForString(IDocument document,int offset,String replacement){
  boolean isString=replacement.startsWith("\"") || replacement.startsWith("'");
  if (isString) {
    int length=document.getLength();
    int pos=offset;
    char c;
    while (pos < length) {
      try {
        c=document.getChar(pos);
switch (c) {
case '\r':
case '\n':
case '\t':
case ' ':
          return;
case '"':
case '\'':
        setReplacementLength(getReplacementLength() + pos - offset + 1);
      return;
  }
  ++pos;
}
 catch (BadLocationException e) {
  e.printStackTrace();
}
}
}
}

protected void updateReplacementLengthForString ( IDocument document , int offset , String replacement ) { boolean isString = replacement . startsWith ( "\"" ) || replacement . startsWith ( "'" ) ; if ( isString ) { int length = document . getLength ( ) ; int pos = offset ; char c ; while ( pos < length ) { try { c = document . getChar ( pos ) ; switch ( c ) { case '\r' : case '\n' : case '\t' : case ' ' : return ; case '"' : case '\'' : setReplacementLength ( getReplacementLength ( ) + pos - offset + 1 ) ; return ; } ++ pos ; } catch ( BadLocationException e ) { e . printStackTrace ( ) ; } } } }
compute new replacement length for string replacement .
