EA-22509 - IOE: StringLiteralManipulator.handleContentChange logging

This commit is contained in:
Gregory Shrago
2010-10-12 19:12:49 +04:00
parent dd32c6e247
commit 6929cf714f
@@ -28,7 +28,8 @@ import com.intellij.util.IncorrectOperationException;
*/
public class StringLiteralManipulator extends AbstractElementManipulator<PsiLiteralExpression> {
public PsiLiteralExpression handleContentChange(PsiLiteralExpression expr, TextRange range, String newContent) throws IncorrectOperationException {
if (!(expr.getValue() instanceof String)) throw new IncorrectOperationException("cannot handle content change");
final Object value = expr.getValue();
if (!(value instanceof String)) throw new IncorrectOperationException("cannot handle content change for: "+ value);
String oldText = expr.getText();
newContent = StringUtil.escapeStringCharacters(newContent);
String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());