Examples of deleteString()


Examples of com.intellij.openapi.editor.Document.deleteString()

      if (CfmlEditorUtil.countSharpsBalance(editor) == 0) {
        final int offset = editor.getCaretModel().getOffset();
        final Document doc = editor.getDocument();
        char charAtOffset = DocumentUtils.getCharAt(doc, offset);
        if (charAtOffset == '#') {
          doc.deleteString(offset, offset + 1);
        }
      }
    }
    else if (c == '{' && file.findElementAt(editor.getCaretModel().getOffset()) == CfscriptTokenTypes.L_CURLYBRACKET) {
      final int offset = editor.getCaretModel().getOffset();
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

    else if (c == '{' && file.findElementAt(editor.getCaretModel().getOffset()) == CfscriptTokenTypes.L_CURLYBRACKET) {
      final int offset = editor.getCaretModel().getOffset();
      final Document doc = editor.getDocument();
      char charAtOffset = DocumentUtils.getCharAt(doc, offset);
      if (charAtOffset == '}') {
        doc.deleteString(offset, offset + 1);
      }
    }
  }

  public boolean charDeleted(char c, PsiFile file, Editor editor) {
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        final RangeMarker range = document.createRangeMarker(textRange.getStartOffset(), textRange.getEndOffset());
        setTemplateVariableValues(template, stringList);
        WriteCommandAction writeCommandAction = new WriteCommandAction(editor.getProject()) {
            @Override
            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(range.getStartOffset(), range.getEndOffset());
            }
        };
        writeCommandAction.execute();
        TemplateManager.getInstance(editor.getProject()).startTemplate(editor, "", template);
    }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        final RangeMarker rangeMarker;
        final int line = doc.getLineNumber(statement.getTextOffset());
        String variableName = startElement.getText();

        if (expressionIsTheWholeStatement(startElement, statement)) {
            doc.deleteString(doc.getLineStartOffset(line), doc.getLineEndOffset(line) + 1);
            rangeMarker = null;
        } else {
            rangeMarker = doc.createRangeMarker(startElement.getTextRange());
        }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        final Document document = editor.getDocument();
        RangeMarker range = document.createRangeMarker(statement.getTextOffset(), end);
        WriteCommandAction writeCommandAction = new WriteCommandAction(editor.getProject()) {
            @Override
            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(start, end);
                document.insertString(statement.getTextOffset(), declaration + "\n");
            }
        };
        writeCommandAction.execute();
        reformatPositions(statement.getContainingFile(), range);
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        RangeMarker range = document.createRangeMarker(outermostIf.getTextOffset(), condition.getTextOffset());
        final PsiElement finalOutermostIf = outermostIf;
        WriteCommandAction writeCommandAction = new WriteCommandAction(ifStatement.getContainingFile().getProject()) {
            @Override
            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(simpleStatement.getTextOffset(), condition.getTextOffset());
                document.insertString(finalOutermostIf.getTextOffset(), simpleStatement.getText() + "\n");
            }
        };
        writeCommandAction.execute();
        reformatPositions(ifStatement.getContainingFile(), range);
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

            final String finalReturnDeclaration = returnDeclaration;
            WriteCommandAction writeCommandAction = new WriteCommandAction(element.getContainingFile().getProject()) {
                @Override
                protected void run(@NotNull Result result) throws Throwable {
                    document.deleteString(rightCurlyPosition, rightCurlyPosition + 1);
                    document.insertString(leftCurlyPosition + 1, "\n" + finalReturnDeclaration + "\n}");
                }
            };
            writeCommandAction.execute();
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        doc.insertString(lineStartOffset, "}\n");

        int lineEndOffset = doc.getLineEndOffset(doc.getLineNumber(thenRange.getStartOffset()));
        doc.insertString(lineEndOffset, String.format("\nif %s {", rightExpr.getText()));

        doc.deleteString(leftExpr.getTextRange().getEndOffset(), rightExpr.getTextRange().getEndOffset());

        PsiFile file = element.getContainingFile();
        if (file != null) {
            reformatPositions(file, thenRangeMarker.getStartOffset(), thenRangeMarker.getEndOffset());
        }
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

        WriteCommandAction writeCommandAction = new WriteCommandAction(element.getContainingFile().getProject()) {
            @Override
            protected void run(@NotNull Result result) throws Throwable {
                document.replaceString(finalInner.getTextOffset(), innerEnd, simpleStatementAndExpression);

                document.deleteString(outerIfRange.getStartOffset(), outerIfRange.getEndOffset());
                document.deleteString(rightCurlyRange.getStartOffset(), rightCurlyRange.getEndOffset());
            }
        };
        writeCommandAction.execute();
View Full Code Here

Examples of com.intellij.openapi.editor.Document.deleteString()

            @Override
            protected void run(@NotNull Result result) throws Throwable {
                document.replaceString(finalInner.getTextOffset(), innerEnd, simpleStatementAndExpression);

                document.deleteString(outerIfRange.getStartOffset(), outerIfRange.getEndOffset());
                document.deleteString(rightCurlyRange.getStartOffset(), rightCurlyRange.getEndOffset());
            }
        };
        writeCommandAction.execute();

        PsiFile file = outer.getContainingFile();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.