Search in sources :

Example 1 with HgInitCommand

use of org.zmlx.hg4idea.command.HgInitCommand in project intellij-community by JetBrains.

the class HgIntegrationEnabler method initOrNotifyError.

@Override
protected boolean initOrNotifyError(@NotNull final VirtualFile projectDir) {
    final boolean[] success = new boolean[1];
    new HgInitCommand(myProject).executeAsynchronously(projectDir, new HgCommandResultHandler() {

        @Override
        public void process(@Nullable HgCommandResult result) {
            VcsNotifier notifier = VcsNotifier.getInstance(myProject);
            if (!HgErrorUtil.hasErrorsInCommandExecution(result)) {
                success[0] = true;
                refreshVcsDir(projectDir, HgUtil.DOT_HG);
                notifier.notifySuccess(message("hg4idea.init.created.notification.title"), message("hg4idea.init.created.notification.description", projectDir.getPresentableUrl()));
            } else {
                success[0] = false;
                String errors = result != null ? result.getRawError() : "";
                notifier.notifyError(message("hg4idea.init.error.description", projectDir.getPresentableUrl()), errors);
            }
        }
    });
    return success[0];
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) HgCommandResultHandler(org.zmlx.hg4idea.execution.HgCommandResultHandler) HgInitCommand(org.zmlx.hg4idea.command.HgInitCommand) VcsNotifier(com.intellij.openapi.vcs.VcsNotifier)

Aggregations

VcsNotifier (com.intellij.openapi.vcs.VcsNotifier)1 HgInitCommand (org.zmlx.hg4idea.command.HgInitCommand)1 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)1 HgCommandResultHandler (org.zmlx.hg4idea.execution.HgCommandResultHandler)1