void (@NotNull Project project, @NotNull FileChooserDescriptor fcd, VirtualFile baseDir) { FileChooser.chooseFile(fcd, project, baseDir, root -> { if (GitUtil.isUnderGit(root) && Messages.showYesNoDialog(project, XmlStringUtil.wrapInHtml( GitBundle.message("init.warning.already.under.git", StringUtil.escapeXmlEntities(root.getPresentableUrl()))), GitBundle.message("init.warning.title"), Messages.getWarningIcon()) != Messages.YES) { return; } new Task.Backgroundable(project, GitBundle.message("common.refreshing")) { @Override public void run(@NotNull ProgressIndicator indicator) { GitCommandResult result = Git.getInstance().init(project, root); if (!result.success()) { VcsNotifier.getInstance(project).notifyError(INIT_FAILED, GitBundle.message("action.Git.Init.error"), result.getErrorOutputAsHtmlString(), true); return; } if (project.isDefault()) { return; } refreshAndConfigureVcsMappings(project, root, root.getPath()); } }.queue(); }); }