VcsNotifier methods renamed according to their notification groups

This commit is contained in:
Nadya Zabrodina
2014-03-06 19:11:31 +04:00
parent 24ce9d6beb
commit 397158b8fa
12 changed files with 54 additions and 53 deletions
@@ -47,12 +47,12 @@ public class VcsNotifier {
private static Notification createNotification(@NotNull NotificationGroup notificationGroup,
@NotNull String title, @NotNull String message, @NotNull NotificationType type,
@Nullable NotificationListener listener) {
// title can be empty; description can't be neither null, nor empty
// title can be empty; message can't be neither null, nor empty
if (StringUtil.isEmptyOrSpaces(message)) {
message = title;
title = "";
}
// if both title and description were empty, then it is a problem in the calling code => Notifications engine assertion will notify.
// if both title and message were empty, then it is a problem in the calling code => Notifications engine assertion will notify.
return notificationGroup.createNotification(title, message, type, listener);
}
@@ -110,13 +110,13 @@ public class VcsNotifier {
}
@NotNull
public Notification notifyWeakWarning(@NotNull String title, @NotNull String message, @Nullable NotificationListener listener) {
public Notification notifyMinorWarning(@NotNull String title, @NotNull String message, @Nullable NotificationListener listener) {
return notify(MINOR_NOTIFICATION, title, message, NotificationType.WARNING, listener);
}
@NotNull
public Notification notifyWeakWarning(@NotNull String title, @NotNull String description) {
return notifyWeakWarning(title, description, null);
public Notification notifyMinorWarning(@NotNull String title, @NotNull String message) {
return notifyMinorWarning(title, message, null);
}
@NotNull
@@ -125,8 +125,8 @@ public class VcsNotifier {
}
@NotNull
public Notification notifyStrongWarning(@NotNull String title, @NotNull String content, @Nullable NotificationListener listener) {
return notify(IMPORTANT_ERROR_NOTIFICATION, title, content, NotificationType.WARNING, listener);
public Notification notifyImportantWarning(@NotNull String title, @NotNull String message, @Nullable NotificationListener listener) {
return notify(IMPORTANT_ERROR_NOTIFICATION, title, message, NotificationType.WARNING, listener);
}
@NotNull
@@ -364,9 +364,9 @@ class GitMergeOperation extends GitBranchOperation {
@Override
protected void notifyUnresolvedRemain() {
VcsNotifier.getInstance(myProject).notifyStrongWarning("Merged branch " + myBranchToMerge + " with conflicts",
"Unresolved conflicts remain in the project. <a href='resolve'>Resolve now.</a>",
getResolveLinkListener());
VcsNotifier.getInstance(myProject).notifyImportantWarning("Merged branch " + myBranchToMerge + " with conflicts",
"Unresolved conflicts remain in the project. <a href='resolve'>Resolve now.</a>",
getResolveLinkListener());
}
}
@@ -183,7 +183,7 @@ public class GitCherryPicker {
String description = commitDetails(commit)
+ "<br/>Unresolved conflicts remain in the working tree. <a href='resolve'>Resolve them.<a/>";
description += getSuccessfulCommitDetailsIfAny(successfulCommits);
VcsNotifier.getInstance(myProject).notifyStrongWarning("Cherry-picked with conflicts", description, resolveLinkListener);
VcsNotifier.getInstance(myProject).notifyImportantWarning("Cherry-picked with conflicts", description, resolveLinkListener);
}
private void notifyCommitCancelled(@NotNull GitCommitWrapper commit, @NotNull List<GitCommitWrapper> successfulCommits) {
@@ -193,7 +193,7 @@ public class GitCherryPicker {
}
String description = commitDetails(commit);
description += getSuccessfulCommitDetailsIfAny(successfulCommits);
VcsNotifier.getInstance(myProject).notifyWeakWarning("Cherry-pick cancelled", description, null);
VcsNotifier.getInstance(myProject).notifyMinorWarning("Cherry-pick cancelled", description, null);
}
private CherryPickData updateChangeListManager(@NotNull final VcsFullCommitDetails commit) {
@@ -181,7 +181,7 @@ public class GitConflictResolver {
}
private void notifyWarning(String title, String content) {
VcsNotifier.getInstance(myProject).notifyStrongWarning(title, content, new ResolveNotificationListener());
VcsNotifier.getInstance(myProject).notifyImportantWarning(title, content, new ResolveNotificationListener());
}
private boolean merge(boolean mergeDialogInvokedFromNotification) {
@@ -282,7 +282,7 @@ class GitPushResult {
vcsNotifier.notifyError(title, sb.toString(), viewUpdateFilesListener);
}
else {
vcsNotifier.notifyStrongWarning(title, sb.toString(), viewUpdateFilesListener);
vcsNotifier.notifyImportantWarning(title, sb.toString(), viewUpdateFilesListener);
}
}
@@ -573,7 +573,7 @@ public final class GitPusher {
description = "Push has been cancelled, because there were conflicts during update.<br/>" +
"Check that conflicts were resolved correctly, and invoke push again.";
}
VcsNotifier.getInstance(myProject).notifyWeakWarning(title, description);
VcsNotifier.getInstance(myProject).notifyMinorWarning(title, description);
return false;
}
else {
@@ -114,13 +114,13 @@ public abstract class GitChangesSaver {
public void notifyLocalChangesAreNotRestored() {
if (wereChangesSaved()) {
LOG.info("Update is incomplete, changes are not restored");
VcsNotifier.getInstance(myProject).notifyStrongWarning("Local changes were not restored",
"Before update your uncommitted changes were saved to <a href='saver'>" +
getSaverName() +
"</a>.<br/>" +
"Update is not complete, you have unresolved merges in your working tree<br/>" +
"Resolve conflicts, complete update and restore changes manually.",
new ShowSavedChangesNotificationListener()
VcsNotifier.getInstance(myProject).notifyImportantWarning("Local changes were not restored",
"Before update your uncommitted changes were saved to <a href='saver'>" +
getSaverName() +
"</a>.<br/>" +
"Update is not complete, you have unresolved merges in your working tree<br/>" +
"Resolve conflicts, complete update and restore changes manually.",
new ShowSavedChangesNotificationListener()
);
}
}
@@ -178,29 +178,29 @@ public class GitStashChangesSaver extends GitChangesSaver {
@Override
protected void notifyUnresolvedRemain() {
VcsNotifier.getInstance(myProject).notifyStrongWarning("Local changes were restored with conflicts",
"Your uncommitted changes were saved to <a href='saver'>stash</a>.<br/>" +
"Unstash is not complete, you have unresolved merges in your working tree<br/>" +
"<a href='resolve'>Resolve</a> conflicts and drop the stash.",
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification,
@NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (event.getDescription().equals("saver")) {
// we don't use #showSavedChanges to specify unmerged root first
GitUnstashDialog.showUnstashDialog(myProject,
new ArrayList<VirtualFile>(
myStashedRoots),
myStashedRoots.iterator().next()
);
}
else if (event.getDescription().equals("resolve")) {
mergeNoProceed();
}
}
}
}
VcsNotifier.getInstance(myProject).notifyImportantWarning("Local changes were restored with conflicts",
"Your uncommitted changes were saved to <a href='saver'>stash</a>.<br/>" +
"Unstash is not complete, you have unresolved merges in your working tree<br/>" +
"<a href='resolve'>Resolve</a> conflicts and drop the stash.",
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification,
@NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (event.getDescription().equals("saver")) {
// we don't use #showSavedChanges to specify unmerged root first
GitUnstashDialog.showUnstashDialog(myProject,
new ArrayList<VirtualFile>(
myStashedRoots),
myStashedRoots.iterator().next()
);
}
else if (event.getDescription().equals("resolve")) {
mergeNoProceed();
}
}
}
}
);
}
@@ -445,9 +445,9 @@ public class GitUnstashDialog extends DialogWrapper {
@Override
protected void notifyUnresolvedRemain() {
VcsNotifier.getInstance(myProject).notifyStrongWarning("Conflicts were not resolved during unstash",
"Unstash is not complete, you have unresolved merges in your working tree<br/>" +
"<a href='resolve'>Resolve</a> conflicts.", new NotificationListener() {
VcsNotifier.getInstance(myProject).notifyImportantWarning("Conflicts were not resolved during unstash",
"Unstash is not complete, you have unresolved merges in your working tree<br/>" +
"<a href='resolve'>Resolve</a> conflicts.", new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
@@ -287,7 +287,7 @@ public class GitFetcher {
if (result.isSuccess()) {
VcsNotifier.getInstance(project).notifySuccess("Fetched successfully" + result.getAdditionalInfo());
} else if (result.isCancelled()) {
VcsNotifier.getInstance(project).notifyWeakWarning("", "Fetch cancelled by user" + result.getAdditionalInfo());
VcsNotifier.getInstance(project).notifyMinorWarning("", "Fetch cancelled by user" + result.getAdditionalInfo());
} else if (result.isNotAuthorized()) {
String title;
String description;
@@ -148,9 +148,10 @@ public class GitRebaseUpdater extends GitUpdater {
// so we just notify the user about problems with collecting the updated changes.
LOG.info("Couldn't mark end for repository " + myRoot, e);
VcsNotifier.getInstance(myProject).
notifyWeakWarning("Couldn't collect the updated files info",
String.format("Update of %s was successful, but we couldn't collect the updated changes because of an error",
myRoot), null);
notifyMinorWarning("Couldn't collect the updated files info",
String.format("Update of %s was successful, but we couldn't collect the updated changes because of an error",
myRoot), null
);
}
return result.success();
}
@@ -69,7 +69,7 @@ public class GitUIUtil {
notificator.notifyError(title, desc);
}
else {
notificator.notifyStrongWarning(title, desc, null);
notificator.notifyImportantWarning(title, desc, null);
}
}