void (final Project project, final String path) { VirtualFile file = ApplicationManager.getApplication().runWriteAction(new Computable<>() { @Override public VirtualFile compute() { try { File file = new File(path); VirtualFile parent = VfsUtil.createDirectories(file.getParent()); return parent.createChildData(this, file.getName()); } catch (IOException e) { Messages.showErrorDialog(project, e.getMessage(), DevKitBundle.message("testdata.create.dialog.title")); return null; } } }); if (file != null) { PsiNavigationSupport.getInstance().createNavigatable(project, file, -1).navigate(true); } }