Examples of commitDocument()


Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

            private void removeImport(LineColRange range) {
                PsiDocumentManager manager = PsiDocumentManager.getInstance(psiFile.getProject());
                Document document = manager.getDocument(psiFile);
                if (document == null)
                    return;
                manager.commitDocument(document);
                TextRange textRange = range.getRange(psiFile);
                int start = textRange.getStartOffset();
                int end = textRange.getEndOffset();
                int line = document.getLineNumber(end);
                int lineStart = document.getLineStartOffset(line);
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

        }
    }

    private String getEditorContent(Editor editor, Project project) {
        final PsiDocumentManager pdm = PsiDocumentManager.getInstance(project);
        pdm.commitDocument(editor.getDocument());
        PsiFile file = pdm.getPsiFile(editor.getDocument());
        if (file != null) {
            return file.getText();
        }
        return "";
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

    try {
      final PsiDocumentManager manager = PsiDocumentManager.getInstance(project);
      final Document document = manager.getDocument(psiFile);
      if (document != null) {
        manager.commitDocument(document);
      }
      final PsiImportList oldImportList = ((PsiJavaFile) psiFile).getImportList();
      assert oldImportList != null;
      if (newImportList != null) {
        oldImportList.replace(newImportList);
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

        try {
            final PsiDocumentManager manager = PsiDocumentManager.getInstance(project);
            final Document document = manager.getDocument(psiFile);
            if (document != null) {
                manager.commitDocument(document);
            }
            final PsiImportList oldImportList = ((PsiJavaFile) psiFile).getImportList();
            assert oldImportList != null;
            if (newImportList != null) {
                oldImportList.replace(newImportList);
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

    public void run() {
        PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myPsiFile.getProject());
        Document document = documentManager.getDocument(myPsiFile);
        document.setText(mySortedXml);

        documentManager.commitDocument(document);
    }
}
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

  public static boolean insertCloseTagIfNeeded(Editor editor, PsiFile file, Project project) {
    final Document document = editor.getDocument();
    final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);

    int offset = editor.getCaretModel().getOffset();
    documentManager.commitDocument(document);
    char charAtOffset = DocumentUtils.getCharAt(document, offset);

    if (charAtOffset != '>') {
      EditorModificationUtil.insertStringAtCaret(editor, ">", true, 0);
    }
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

        public void run() {
          PsiDocumentManager manager = PsiDocumentManager.getInstance(project);
          Document document = manager.getDocument(yamlFile);
          int length = document.getTextLength();
          document.insertString(length, "\n" + "test:");
          manager.commitDocument(document);
        }
      });
    }
  }
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

        Project project = file.getProject();

        PsiDocumentManager pdm = PsiDocumentManager.getInstance(project);
        Document document = pdm.getDocument(file);
        if (document != null) {
            pdm.commitDocument(document);
        }

        Collection<GoImportDeclaration> unusedImports =
                UnusedImportsFinder.findUnusedImports(file);
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()

                }

                PsiDocumentManager manager = PsiDocumentManager.getInstance(yamlFile.getProject());
                Document document = manager.getDocument(yamlFile);
                if (document != null) {
                    manager.commitDocument(document);
                }

                final PsiElement yamlDocu = PsiTreeUtil.findChildOfType(yamlFile, YAMLDocument.class);
                if(yamlDocu == null) {
                    return;
View Full Code Here

Examples of com.intellij.psi.PsiDocumentManager.commitDocument()


                // @TODO: check is last array line on contains eol and indent and move above this line
                document.insertString(goToPsi.getYamlKeyValue().getTextRange().getEndOffset(), insertString);
                manager.doPostponedOperationsAndUnblockDocument(document);
                manager.commitDocument(document);

                // navigate to new psi element
                // @TODO: jump into quote value
                manager.commitAndRunReadAction(new Runnable() {
                    @Override
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.