Search in sources :

Example 1 with VcsNotifier

use of com.intellij.openapi.vcs.VcsNotifier in project intellij-community by JetBrains.

the class HgUpdateCommand method updateRepoToInCurrentThread.

public static boolean updateRepoToInCurrentThread(@NotNull final Project project, @NotNull final VirtualFile repository, @NotNull final String targetRevision, final boolean clean) {
    final HgUpdateCommand hgUpdateCommand = new HgUpdateCommand(project, repository);
    hgUpdateCommand.setRevision(targetRevision);
    hgUpdateCommand.setClean(clean);
    HgCommandResult result = hgUpdateCommand.execute();
    new HgConflictResolver(project).resolve(repository);
    boolean success = !HgErrorUtil.isCommandExecutionFailed(result);
    boolean hasUnresolvedConflicts = HgConflictResolver.hasConflicts(project, repository);
    if (!success) {
        new HgCommandResultNotifier(project).notifyError(result, "", "Update failed");
    } else if (hasUnresolvedConflicts) {
        new VcsNotifier(project).notifyImportantWarning("Unresolved conflicts.", HgVcsMessages.message("hg4idea.update.warning.merge.conflicts", repository.getPath()));
    }
    getRepositoryManager(project).updateRepository(repository);
    HgErrorUtil.markDirtyAndHandleErrors(project, repository);
    return success;
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier) HgConflictResolver(org.zmlx.hg4idea.provider.update.HgConflictResolver) VcsNotifier(com.intellij.openapi.vcs.VcsNotifier)

Example 2 with VcsNotifier

use of com.intellij.openapi.vcs.VcsNotifier in project intellij-community by JetBrains.

the class GitUIUtil method notifyMessages.

public static void notifyMessages(@NotNull Project project, @NotNull String title, @Nullable String description, boolean important, @Nullable Collection<String> messages) {
    String desc = (description != null ? description.replace("\n", "<br/>") : "");
    if (messages != null && !messages.isEmpty()) {
        desc += StringUtil.join(messages, "<hr/><br/>");
    }
    VcsNotifier notificator = VcsNotifier.getInstance(project);
    if (important) {
        notificator.notifyError(title, desc);
    } else {
        notificator.notifyImportantWarning(title, desc, null);
    }
}
Also used : VcsNotifier(com.intellij.openapi.vcs.VcsNotifier)

Example 3 with VcsNotifier

use of com.intellij.openapi.vcs.VcsNotifier in project intellij-community by JetBrains.

the class GitIntegrationEnabler method initOrNotifyError.

protected boolean initOrNotifyError(@NotNull final VirtualFile projectDir) {
    VcsNotifier vcsNotifier = VcsNotifier.getInstance(myProject);
    GitCommandResult result = myGit.init(myProject, projectDir);
    if (result.success()) {
        refreshVcsDir(projectDir, GitUtil.DOT_GIT);
        vcsNotifier.notifySuccess("Created Git repository in " + projectDir.getPresentableUrl());
        return true;
    } else {
        if (myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
            vcsNotifier.notifyError("Couldn't git init " + projectDir.getPresentableUrl(), result.getErrorOutputAsHtmlString());
            LOG.info(result.getErrorOutputAsHtmlString());
        }
        return false;
    }
}
Also used : GitCommandResult(git4idea.commands.GitCommandResult) VcsNotifier(com.intellij.openapi.vcs.VcsNotifier)

Example 4 with VcsNotifier

use of com.intellij.openapi.vcs.VcsNotifier 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)4 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)2 GitCommandResult (git4idea.commands.GitCommandResult)1 HgCommandResultNotifier (org.zmlx.hg4idea.action.HgCommandResultNotifier)1 HgInitCommand (org.zmlx.hg4idea.command.HgInitCommand)1 HgCommandResultHandler (org.zmlx.hg4idea.execution.HgCommandResultHandler)1 HgConflictResolver (org.zmlx.hg4idea.provider.update.HgConflictResolver)1