Package com.intellij.openapi.editor

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


  public void append(@NotNull final String text) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        Document document = getConsole().getCurrentEditor().getDocument();
        document.insertString(document.getTextLength(), text);
      }
    });
  }

  public void execute() {
View Full Code Here


      @Override
      public void run() {
        WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
          @Override
          public void run() {
            document.insertString(0, "C = A + B + <error>D</error>.");
          }
        });
      }
    });
    instance.commitDocument(document);
View Full Code Here

        if (!StringUtil.startsWith(document.getCharsSequence(), caret, ";")) {
          String prefix = StringUtil.repeat(";", semicolonCount);
          if (document.getCharsSequence().charAt(caret) != ' ') {
            prefix += " ";
          }
          document.insertString(caret, prefix);
          editor.getCaretModel().moveToOffset(caret);
          originalHandler.execute(editor, dataContext);
          editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + prefix.length());
          return Result.Stop;
        }
View Full Code Here

      for (int i = offset; i < cs.length (); i++) {
        if (cs.charAt (i) == ';') return;
        if ( ! Character.isWhitespace (cs.charAt (i))) break;
      }

      document.insertString (offset, ";");
      caretModel.moveToOffset (offset + 1);
    }
  }

}
View Full Code Here

                        final String selectedQueryOperator = (String) QUERY_OPERATOR_LIST.getSelectedValue();
                        if (selectedQueryOperator == null) return;

                        ApplicationManager.getApplication().runWriteAction(new Runnable() {
                            public void run() {
                                document.insertString(offset, selectedQueryOperator);
                            }
                        });


                    }
View Full Code Here

            for (Line line : lines) {
              buffer.append(line.getValue());
            }
            int endBefore = document.getTextLength();
            int endBeforeLine = endBefore;
            document.insertString(endBefore, buffer.toString());
            for (Line line : lines) {
              myEditor.getMarkupModel().addRangeHighlighter(endBeforeLine, endBeforeLine + line.getValue().length(),
                                                            HighlighterLayer.ADDITIONAL_SYNTAX, line.getAttributes(),
                                                            HighlighterTargetArea.EXACT_RANGE);
              endBeforeLine += line.getValue().length();
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.