PsiDirectory (@NotNull Project project, @NotNull final VirtualFile parent, @NotNull final String name) { final VirtualFile[] dir = new VirtualFile[1]; ApplicationManager.getApplication().runWriteAction(() -> { try { dir[0] = parent.createChildDirectory(null, name); } catch (IOException e) { e.printStackTrace(); } }); return PsiDirectoryFactory.getInstance(project).createDirectory(dir[0]); }