VirtualFile (@NotNull VirtualFile parentDir, @NotNull String name, @NotNull String text) { return ApplicationManager.getApplication().runWriteAction(new Computable<>() { @Override public VirtualFile compute() { try { final VirtualFile virtualFile = parentDir.createChildData(this, name); VfsUtil.saveText(virtualFile, text + "\n"); return virtualFile; } catch (IOException e) { throw new RuntimeException(e); } } }); }