From 397158b8fa55ff66f186e9ba6047885efdf7579e Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Thu, 6 Mar 2014 19:10:29 +0400 Subject: [PATCH] VcsNotifier methods renamed according to their notification groups --- .../com/intellij/openapi/vcs/VcsNotifier.java | 14 +++--- .../git4idea/branch/GitMergeOperation.java | 6 +-- .../git4idea/cherrypick/GitCherryPicker.java | 4 +- .../git4idea/merge/GitConflictResolver.java | 2 +- .../src/git4idea/push/GitPushResult.java | 2 +- .../git4idea/src/git4idea/push/GitPusher.java | 2 +- .../src/git4idea/stash/GitChangesSaver.java | 14 +++--- .../git4idea/stash/GitStashChangesSaver.java | 46 +++++++++---------- .../src/git4idea/ui/GitUnstashDialog.java | 6 +-- .../src/git4idea/update/GitFetcher.java | 2 +- .../src/git4idea/update/GitRebaseUpdater.java | 7 +-- .../git4idea/src/git4idea/util/GitUIUtil.java | 2 +- 12 files changed, 54 insertions(+), 53 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsNotifier.java index ef6ee8e6689f..a98734da85b8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsNotifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/VcsNotifier.java @@ -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 diff --git a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java index 4323bd9a47dc..81e5cc35f750 100644 --- a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java +++ b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java @@ -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. Resolve now.", - getResolveLinkListener()); + VcsNotifier.getInstance(myProject).notifyImportantWarning("Merged branch " + myBranchToMerge + " with conflicts", + "Unresolved conflicts remain in the project. Resolve now.", + getResolveLinkListener()); } } diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java index cbb566965f5d..a19ea0726201 100644 --- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java +++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java @@ -183,7 +183,7 @@ public class GitCherryPicker { String description = commitDetails(commit) + "
Unresolved conflicts remain in the working tree. Resolve them."; 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 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) { diff --git a/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java b/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java index fedace79dd06..214c026307d5 100644 --- a/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java +++ b/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java @@ -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) { diff --git a/plugins/git4idea/src/git4idea/push/GitPushResult.java b/plugins/git4idea/src/git4idea/push/GitPushResult.java index e8afb973a897..1d105eaea0f1 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushResult.java +++ b/plugins/git4idea/src/git4idea/push/GitPushResult.java @@ -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); } } diff --git a/plugins/git4idea/src/git4idea/push/GitPusher.java b/plugins/git4idea/src/git4idea/push/GitPusher.java index 98492e2bd173..31e289dba806 100644 --- a/plugins/git4idea/src/git4idea/push/GitPusher.java +++ b/plugins/git4idea/src/git4idea/push/GitPusher.java @@ -573,7 +573,7 @@ public final class GitPusher { description = "Push has been cancelled, because there were conflicts during update.
" + "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 { diff --git a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java index e2e174e8cec5..1e783918c334 100644 --- a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java @@ -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
" + - getSaverName() + - ".
" + - "Update is not complete, you have unresolved merges in your working tree
" + - "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 " + + getSaverName() + + ".
" + + "Update is not complete, you have unresolved merges in your working tree
" + + "Resolve conflicts, complete update and restore changes manually.", + new ShowSavedChangesNotificationListener() ); } } diff --git a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java index 39b06942db09..8e20a67fceab 100644 --- a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java @@ -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 stash.
" + - "Unstash is not complete, you have unresolved merges in your working tree
" + - "Resolve 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( - 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 stash.
" + + "Unstash is not complete, you have unresolved merges in your working tree
" + + "Resolve 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( + myStashedRoots), + myStashedRoots.iterator().next() + ); + } + else if (event.getDescription().equals("resolve")) { + mergeNoProceed(); + } + } + } + } ); } diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index 644b2e02ae23..63b51a8c4b56 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -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
" + - "Resolve 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
" + + "Resolve conflicts.", new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { diff --git a/plugins/git4idea/src/git4idea/update/GitFetcher.java b/plugins/git4idea/src/git4idea/update/GitFetcher.java index 015ef348e8ec..71111366bdbd 100644 --- a/plugins/git4idea/src/git4idea/update/GitFetcher.java +++ b/plugins/git4idea/src/git4idea/update/GitFetcher.java @@ -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; diff --git a/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java b/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java index a61c56ee6e31..04ed3ac845ca 100644 --- a/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java +++ b/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java @@ -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(); } diff --git a/plugins/git4idea/src/git4idea/util/GitUIUtil.java b/plugins/git4idea/src/git4idea/util/GitUIUtil.java index 614295485229..71a818d186b8 100644 --- a/plugins/git4idea/src/git4idea/util/GitUIUtil.java +++ b/plugins/git4idea/src/git4idea/util/GitUIUtil.java @@ -69,7 +69,7 @@ public class GitUIUtil { notificator.notifyError(title, desc); } else { - notificator.notifyStrongWarning(title, desc, null); + notificator.notifyImportantWarning(title, desc, null); } }