diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java index 41785d0ffcbf..412923e122e5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java @@ -28,7 +28,6 @@ import com.intellij.openapi.diff.impl.patch.apply.ApplyFilePatchBase; import com.intellij.openapi.diff.impl.patch.apply.ApplyTextFilePatch; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Condition; @@ -37,7 +36,6 @@ import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.changes.patch.ApplyPatchAction; -import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.ReadonlyStatusHandler; import com.intellij.openapi.vfs.VfsUtilCore; @@ -387,7 +385,7 @@ public class PatchApplier { protected ApplyPatchStatus executeWritable() { final ReadonlyStatusHandler.OperationStatus readOnlyFilesStatus = getReadOnlyFilesStatus(myVerifier.getWritableFiles()); if (readOnlyFilesStatus.hasReadonlyFiles()) { - showError(myProject, readOnlyFilesStatus.getReadonlyFilesMessage(), true); + showError(myProject, readOnlyFilesStatus.getReadonlyFilesMessage()); return ApplyPatchStatus.ABORT; } myFailedPatches.addAll(myVerifier.filterBadFileTypePatches()); @@ -503,7 +501,7 @@ public class PatchApplier { } } catch (IOException e) { - showError(myProject, e.getMessage(), true); + showError(myProject, e.getMessage()); return ApplyPatchStatus.ABORT; } return status; @@ -541,14 +539,15 @@ public class PatchApplier { } protected static void showApplyStatus(@NotNull Project project, final ApplyPatchStatus status) { + VcsNotifier vcsNotifier = VcsNotifier.getInstance(project); if (status == ApplyPatchStatus.ALREADY_APPLIED) { - showError(project, VcsBundle.message("patch.apply.already.applied"), false); + vcsNotifier.notifyMinorInfo(VcsBundle.message("patch.apply.dialog.title"), VcsBundle.message("patch.apply.already.applied")); } else if (status == ApplyPatchStatus.PARTIAL) { - showError(project, VcsBundle.message("patch.apply.partially.applied"), false); - } else if (ApplyPatchStatus.SUCCESS.equals(status)) { - final String message = VcsBundle.message("patch.apply.success.applied.text"); - VcsBalloonProblemNotifier.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(project); + vcsNotifier.notifyMinorInfo(VcsBundle.message("patch.apply.dialog.title"), VcsBundle.message("patch.apply.partially.applied")); + } + else if (status == ApplyPatchStatus.SUCCESS) { + vcsNotifier.notifySuccess(VcsBundle.message("patch.apply.success.applied.text")); } } @@ -562,29 +561,14 @@ public class PatchApplier { return ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(fileArray); } - public static void showError(final Project project, final String message, final boolean error) { + public static void showError(final Project project, final String message) { final Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode()) { return; } final String title = VcsBundle.message("patch.apply.dialog.title"); - final Runnable messageShower = new Runnable() { - @Override - public void run() { - if (error) { - Messages.showErrorDialog(project, message, title); - } - else { - Messages.showInfoMessage(project, message, title); - } - } - }; - WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { - @Override - public void run() { - messageShower.run(); - } - }, null, project); + final Runnable messageShower = () -> Messages.showErrorDialog(project, message, title); + WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> messageShower.run(), null, project); } private static class FilesMover implements Consumer> { diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java index 7fda3cb0ab80..6dc1296582cb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java @@ -222,13 +222,12 @@ public class PathsVerifier { fileType = FileTypeChooser.associateFileType(file.getName()); if (fileType == null) { PatchApplier - .showError(myProject, "Cannot apply content for " + file.getPresentableName() + " file from patch because its type not defined.", - true); + .showError(myProject, "Cannot apply content for " + file.getPresentableName() + " file from patch because its type not defined."); return false; } } if (fileType.isBinary()) { - PatchApplier.showError(myProject, "Cannot apply file " + file.getPresentableName() + " from patch because it is binary.", true); + PatchApplier.showError(myProject, "Cannot apply file " + file.getPresentableName() + " from patch because it is binary."); return false; } return true; @@ -420,7 +419,7 @@ public class PathsVerifier { } private void revert(final String errorMessage) { - PatchApplier.showError(myProject, errorMessage, true); + PatchApplier.showError(myProject, errorMessage); // move back /*for (MovedFileData movedFile : myMovedFiles) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index 79bc9daf35d8..36752a4e4f5e 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -561,11 +561,11 @@ public class ShelveChangesManager extends AbstractProjectComponent implements JD } catch (IOException e) { LOG.info(e); - PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage(), true); + PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage()); return; } catch (PatchSyntaxException e) { - PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage(), true); + PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage()); LOG.info(e); return; }