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;
}
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);
}
}
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;
}
}
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];
}
Aggregations