Package com.intellij.psi

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


            public void run() {

                final PsiDocumentManager manager = PsiDocumentManager.getInstance(yamlFile.getProject());
                final 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


                new WriteCommandAction(yamlFile.getProject()) {
                    @Override
                    protected void run(Result result) throws Throwable {
                        document.insertString(goToPsi.getYamlKeyValue().getTextRange().getEndOffset(), finalInsertString);
                        manager.doPostponedOperationsAndUnblockDocument(document);
                        manager.commitDocument(document);
                    }

                    @Override
                    public String getGroupID() {
                        return "Translation Extraction";
View Full Code Here

        if (document == null) return;
        String join = StringUtil.join(vars, ", ");
        String newFunction = "\n" + name + "(" + join + ") ->\n erlang:error(not_implemented).\n";
        document.insertString(textOffset, newFunction);
        manager.commitDocument(document);
        CodeStyleManager.getInstance(project).reformatText(file, textOffset, textOffset + newFunction.length());
      }
    }

    private void exportAddedCallbackImplementations(@NotNull Project project, @NotNull ErlangFile file) {
View Full Code Here

            document.insertString(0, "C = A + B + <error>D</error>.");
          }
        });
      }
    });
    instance.commitDocument(document);
    HashMap<String, ErlangQVar> map = new HashMap<String, ErlangQVar>();
    map.put("A", (ErlangQVar) ErlangElementFactory.createQVarFromText(getProject(), "A"));
    map.put("B", (ErlangQVar) ErlangElementFactory.createQVarFromText(getProject(), "B"));
    file.putUserData(ErlangVarProcessor.ERLANG_VARIABLE_CONTEXT, map);
    myFile = file;
View Full Code Here

  }

  public final void commitAllDocuments() {
    final PsiDocumentManager manager = getDocumentManager();
    for (final Document document : myCurrentDocuments) {
      manager.commitDocument(document);
    }
  }

  private PsiDocumentManager getDocumentManager() {
    return PsiDocumentManager.getInstance(myProject);
View Full Code Here

      final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
      final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
      final Document document = psiFile == null? null : psiDocumentManager.getDocument(psiFile);
      if (document != null) {
        document.setText(text != null ? text : "");
        psiDocumentManager.commitDocument(document);
        FileDocumentManager.getInstance().saveDocument(document);
        return;
      }
    }
    VfsUtil.saveText(virtualFile, text != null ? text : "");
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.