diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java index c09dea89e31a..dce4e8ee7c5a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java @@ -22,7 +22,9 @@ import com.intellij.openapi.vcs.update.ActionInfo; import com.intellij.openapi.vcs.update.UpdateInfoTree; import com.intellij.openapi.vcs.update.UpdatedFiles; import com.intellij.ui.content.ContentManager; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -31,6 +33,7 @@ public abstract class ProjectLevelVcsManagerEx extends ProjectLevelVcsManager { return (ProjectLevelVcsManagerEx) PeriodicalTasksCloser.getInstance().safeGetComponent(project, ProjectLevelVcsManager.class); } + @Nullable public abstract ContentManager getContentManager(); @NotNull @@ -45,6 +48,8 @@ public abstract class ProjectLevelVcsManagerEx extends ProjectLevelVcsManager { public abstract void notifyDirectoryMappingChanged(); + @CalledInAwt + @Nullable public abstract UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java index fa028da46b6f..6fdeca302e64 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java @@ -72,6 +72,7 @@ import com.intellij.util.Processor; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.text.DateFormatUtil; +import com.intellij.vcs.ViewUpdateInfoNotification; import org.jdom.Attribute; import org.jdom.DataConversionException; import org.jdom.Element; @@ -358,6 +359,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme AllVcses.getInstance(myProject).unregisterManually(vcs); } + @Nullable @Override public ContentManager getContentManager() { if (myContentManager == null) { @@ -483,9 +485,12 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme @Override public void showProjectOperationInfo(final UpdatedFiles updatedFiles, String displayActionName) { - showUpdateProjectInfo(updatedFiles, displayActionName, ActionInfo.STATUS, false); + UpdateInfoTree tree = showUpdateProjectInfo(updatedFiles, displayActionName, ActionInfo.STATUS, false); + if (tree != null) ViewUpdateInfoNotification.focusUpdateInfoTree(myProject, tree); } + @CalledInAwt + @Nullable @Override public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) { if (!myProject.isOpen() || myProject.isDisposed()) return null; @@ -494,8 +499,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme return null; // content manager is made null during dispose; flag is set later } final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo); - ContentUtilEx.addTabbedContent(contentManager, updateInfoTree, "Update Info", DateFormatUtil.formatDateTime(System.currentTimeMillis()), true, updateInfoTree); - ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null); + ContentUtilEx.addTabbedContent(contentManager, updateInfoTree, "Update Info", DateFormatUtil.formatDateTime(System.currentTimeMillis()), false, updateInfoTree); updateInfoTree.expandRootChildren(); return updateInfoTree; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java index d917e9c26f44..ea54a74e9994 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java @@ -19,6 +19,8 @@ import com.intellij.history.Label; import com.intellij.history.LocalHistory; import com.intellij.history.LocalHistoryAction; import com.intellij.ide.errorTreeView.HotfixData; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; @@ -26,9 +28,7 @@ import com.intellij.openapi.options.Configurable; import com.intellij.openapi.progress.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.actions.AbstractVcsAction; import com.intellij.openapi.vcs.actions.DescindingFilesFilter; @@ -38,13 +38,13 @@ import com.intellij.openapi.vcs.changes.VcsAnnotationRefresher; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vcs.changes.committed.CommittedChangesCache; import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; -import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.WaitForProgressToShow; import com.intellij.util.containers.MultiMap; import com.intellij.util.ui.OptionsDialog; +import com.intellij.vcs.ViewUpdateInfoNotification; import com.intellij.vcsUtil.VcsUtil; import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; @@ -53,6 +53,11 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.*; +import static com.intellij.openapi.util.text.StringUtil.pluralize; +import static com.intellij.openapi.util.text.StringUtil.toLowerCase; +import static com.intellij.openapi.vcs.VcsNotifier.STANDARD_NOTIFICATION; +import static com.intellij.util.ObjectUtils.notNull; + public abstract class AbstractCommonUpdateAction extends AbstractVcsAction { private final boolean myAlwaysVisible; private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.update.AbstractCommonUpdateAction"); @@ -423,8 +428,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction { private void appendGroup(final StringBuffer text, final FileGroup group) { final int s = group.getFiles().size(); if (s > 0) { - text.append("\n"); - text.append(s).append(" ").append(StringUtil.pluralize("File", s)).append(" ").append(group.getUpdateName()); + text.append(s).append(" ").append(pluralize("File", s)).append(" ").append(toLowerCase(group.getUpdateName())).append("
"); } final List list = group.getChildren(); @@ -502,24 +506,37 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction { final boolean noMerged = myUpdatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).isEmpty(); if (myUpdatedFiles.isEmpty() && myGroupedExceptions.isEmpty()) { + NotificationType type; + String content; if (someSessionWasCancelled) { - VcsBalloonProblemNotifier.showOverChangesView(myProject, VcsBundle.message("progress.text.updating.canceled"), MessageType.WARNING); + content = VcsBundle.message("progress.text.updating.canceled"); + type = NotificationType.WARNING; } else { - VcsBalloonProblemNotifier.showOverChangesView(myProject, getAllFilesAreUpToDateMessage(myRoots), MessageType.INFO); + content = getAllFilesAreUpToDateMessage(myRoots); + type = NotificationType.INFORMATION; } + VcsNotifier.getInstance(myProject).notify(STANDARD_NOTIFICATION.createNotification(content, type)); } else if (!myUpdatedFiles.isEmpty()) { final UpdateInfoTree tree = showUpdateTree(continueChainFinal && updateSuccess && noMerged, someSessionWasCancelled); final CommittedChangesCache cache = CommittedChangesCache.getInstance(myProject); cache.processUpdatedFiles(myUpdatedFiles, incomingChangeLists -> tree.setChangeLists(incomingChangeLists)); + NotificationType type; + String title; if (someSessionWasCancelled) { - VcsBalloonProblemNotifier.showOverChangesView(myProject, "VCS Update Incomplete" + prepareNotificationWithUpdateInfo(), MessageType.WARNING); + title = "Project Partially Updated"; + type = NotificationType.WARNING; } else { - VcsBalloonProblemNotifier.showOverChangesView(myProject, "VCS Update Finished" + prepareNotificationWithUpdateInfo(), MessageType.INFO); + title = "Project Updated"; + type = NotificationType.INFORMATION; } + + Notification notification = STANDARD_NOTIFICATION.createNotification(title, prepareNotificationWithUpdateInfo(), type, null); + notification.addAction(new ViewUpdateInfoNotification(myProject, tree, "View")); + VcsNotifier.getInstance(myProject).notify(notification); } ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges(); @@ -557,11 +574,10 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction { RestoreUpdateTree restoreUpdateTree = RestoreUpdateTree.getInstance(myProject); restoreUpdateTree.registerUpdateInformation(myUpdatedFiles, myActionInfo); final String text = getTemplatePresentation().getText() + ((willBeContinued || (myUpdateNumber > 1)) ? ("#" + myUpdateNumber) : ""); - final UpdateInfoTree updateInfoTree = myProjectLevelVcsManager.showUpdateProjectInfo(myUpdatedFiles, text, myActionInfo, wasCanceled); - + UpdateInfoTree updateInfoTree = notNull(myProjectLevelVcsManager.showUpdateProjectInfo(myUpdatedFiles, text, myActionInfo, + wasCanceled)); updateInfoTree.setBefore(myBefore); updateInfoTree.setAfter(myAfter); - updateInfoTree.setCanGroupByChangeList(canGroupByChangelist(myVcsToVirtualFiles.keySet())); return updateInfoTree; } diff --git a/platform/vcs-impl/src/com/intellij/vcs/ViewUpdateInfoNotification.java b/platform/vcs-impl/src/com/intellij/vcs/ViewUpdateInfoNotification.java new file mode 100644 index 000000000000..260ae0c6888f --- /dev/null +++ b/platform/vcs-impl/src/com/intellij/vcs/ViewUpdateInfoNotification.java @@ -0,0 +1,51 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.vcs; + +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; +import com.intellij.openapi.vcs.update.UpdateInfoTree; +import com.intellij.openapi.wm.ToolWindowId; +import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.ui.content.ContentManager; +import com.intellij.util.ContentUtilEx; +import org.jetbrains.annotations.NotNull; + +public class ViewUpdateInfoNotification extends NotificationAction { + @NotNull private final Project myProject; + @NotNull private final UpdateInfoTree myTree; + + public ViewUpdateInfoNotification(@NotNull Project project, @NotNull UpdateInfoTree updateInfoTree, @NotNull String actionName) { + super(actionName); + myProject = project; + myTree = updateInfoTree; + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { + focusUpdateInfoTree(myProject, myTree); + } + + public static void focusUpdateInfoTree(@NotNull Project project, @NotNull UpdateInfoTree updateInfoTree) { + ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS).activate(() -> { + ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager(); + if (contentManager != null) ContentUtilEx.selectContent(contentManager, updateInfoTree, true); + }, true, true); + } +} diff --git a/platform/vcs-tests/testSrc/com/intellij/vcs/test/utils.kt b/platform/vcs-tests/testSrc/com/intellij/vcs/test/utils.kt index c0a7601263e9..d299beec4d1e 100644 --- a/platform/vcs-tests/testSrc/com/intellij/vcs/test/utils.kt +++ b/platform/vcs-tests/testSrc/com/intellij/vcs/test/utils.kt @@ -20,7 +20,8 @@ import com.intellij.notification.NotificationType import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import org.junit.Assert +import com.intellij.testFramework.UsefulTestCase.assertOrderedEquals +import org.junit.Assert.assertEquals import org.picocontainer.MutablePicoContainer inline fun overrideService(project: Project): Impl { @@ -39,13 +40,23 @@ inline fun overrideService(): Impl { return service() as Impl } -fun assertNotification(type: NotificationType, title: String, content: String, actual: Notification): Notification { - Assert.assertEquals("Incorrect notification type: " + tos(actual), type, actual.type) - Assert.assertEquals("Incorrect notification title: " + tos(actual), title, actual.title) - Assert.assertEquals("Incorrect notification content: " + tos(actual), cleanupForAssertion(content), cleanupForAssertion(actual.content)) +fun assertNotification(type: NotificationType, title: String, content: String, actions: List, actual: Notification): Notification { + assertEquals("Incorrect notification type: " + tos(actual), type, actual.type) + assertEquals("Incorrect notification title: " + tos(actual), title, actual.title) + assertEquals("Incorrect notification content: " + tos(actual), cleanupForAssertion(content), cleanupForAssertion(actual.content)) + assertOrderedEquals("Incorrect notification actions", actions, actual.actions.map { it.templatePresentation.text }) return actual } +fun assertNotification(type: NotificationType, title: String, content: String, actual: Notification) = + assertNotification(type, title, content, listOf(), actual) + +fun assertSuccessfulNotification(title: String, content: String, actual: Notification) = + assertNotification(NotificationType.INFORMATION, title, content, actual) + +fun assertSuccessfulNotification(title: String, content: String, actions: List, actual: Notification) = + assertNotification(NotificationType.INFORMATION, title, content, actions, actual) + fun cleanupForAssertion(content: String): String { val nobr = content.replace("
", "\n").replace("
", "\n").replace("
", "\n") .replace(" ", " ").replace(" {2,}".toRegex(), " ") diff --git a/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java b/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java index 1171b1e0aee8..10be1a29888c 100644 --- a/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java +++ b/plugins/git4idea/src/git4idea/merge/GitMergeUtil.java @@ -31,6 +31,7 @@ import com.intellij.openapi.vcs.update.UpdatedFiles; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.GuiUtils; +import com.intellij.vcs.ViewUpdateInfoNotification; import git4idea.GitRevisionNumber; import git4idea.GitVcs; import git4idea.i18n.GitBundle; @@ -137,8 +138,11 @@ public class GitMergeUtil { GuiUtils.invokeLaterIfNeeded(() -> { ProjectLevelVcsManagerEx manager = (ProjectLevelVcsManagerEx)ProjectLevelVcsManager.getInstance(project); UpdateInfoTree tree = manager.showUpdateProjectInfo(files, actionName, actionInfo, false); - tree.setBefore(beforeLabel); - tree.setAfter(LocalHistory.getInstance().putSystemLabel(project, "After update")); + if (tree != null) { + tree.setBefore(beforeLabel); + tree.setAfter(LocalHistory.getInstance().putSystemLabel(project, "After update")); + ViewUpdateInfoNotification.focusUpdateInfoTree(project, tree); + } }, ModalityState.defaultModalityState()); Collection unmergedNames = files.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).getFiles(); diff --git a/plugins/git4idea/src/git4idea/push/GitPushResultNotification.java b/plugins/git4idea/src/git4idea/push/GitPushResultNotification.java index b865f0b1aa31..b0c8d0be48fa 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushResultNotification.java +++ b/plugins/git4idea/src/git4idea/push/GitPushResultNotification.java @@ -16,34 +16,33 @@ package git4idea.push; import com.intellij.dvcs.DvcsUtil; -import com.intellij.history.Label; -import com.intellij.ide.BrowserUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationGroup; -import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsNotifier; import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; -import com.intellij.openapi.vcs.update.ActionInfo; import com.intellij.openapi.vcs.update.UpdateInfoTree; import com.intellij.openapi.vcs.update.UpdatedFiles; import com.intellij.util.containers.ContainerUtil; +import com.intellij.vcs.ViewUpdateInfoNotification; import git4idea.branch.GitBranchUtil; import git4idea.repo.GitRepository; import git4idea.update.GitUpdateResult; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.event.HyperlinkEvent; import java.util.List; import java.util.Map; +import static com.intellij.openapi.vcs.update.ActionInfo.UPDATE; + class GitPushResultNotification extends Notification { - public static final String VIEW_FILES_UPDATED_DURING_THE_PUSH = "View files updated during the push"; + public static final String VIEW_FILES_UPDATED_DURING_THE_PUSH = "View files updated during the push"; public static final String UPDATE_WITH_RESOLVED_CONFLICTS = "push has been cancelled, because there were conflicts during update.
" + "Check that conflicts were resolved correctly, and invoke push again."; @@ -57,9 +56,8 @@ class GitPushResultNotification extends Notification { public GitPushResultNotification(@NotNull String groupDisplayId, @NotNull String title, @NotNull String content, - @NotNull NotificationType type, - @Nullable NotificationListener listener) { - super(groupDisplayId, title, content, type, listener); + @NotNull NotificationType type) { + super(groupDisplayId, title, content, type); } @NotNull @@ -93,19 +91,24 @@ class GitPushResultNotification extends Notification { String description = formDescription(pushResult.getResults(), multiRepoProject); - ViewUpdatedFilesNotificationListener listener = null; - UpdatedFiles updatedFiles = pushResult.getUpdatedFiles(); - if (!updatedFiles.isEmpty()) { - description += "
" + VIEW_FILES_UPDATED_DURING_THE_PUSH; - listener = new ViewUpdatedFilesNotificationListener(project, updatedFiles, - pushResult.getBeforeUpdateLabel(), pushResult.getAfterUpdateLabel()); - } - NotificationGroup group = type == NotificationType.INFORMATION ? - VcsNotifier.NOTIFICATION_GROUP_ID : + VcsNotifier.STANDARD_NOTIFICATION : VcsNotifier.IMPORTANT_ERROR_NOTIFICATION; - return new GitPushResultNotification(group.getDisplayId(), title, description, type, listener); + GitPushResultNotification notification = new GitPushResultNotification(group.getDisplayId(), title, description, type); + + UpdatedFiles updatedFiles = pushResult.getUpdatedFiles(); + if (!updatedFiles.isEmpty()) { + ApplicationManager.getApplication().invokeLater(() -> { + UpdateInfoTree tree = ProjectLevelVcsManagerEx.getInstanceEx(project).showUpdateProjectInfo(updatedFiles, "Update", UPDATE, false); + if (tree != null) { + tree.setBefore(pushResult.getBeforeUpdateLabel()); + tree.setAfter(pushResult.getAfterUpdateLabel()); + notification.addAction(new ViewUpdateInfoNotification(project, tree, VIEW_FILES_UPDATED_DURING_THE_PUSH)); + } + }); + } + return notification; } private static String formDescription(@NotNull Map results, final boolean multiRepoProject) { @@ -210,37 +213,4 @@ class GitPushResultNotification extends Notification { return UPDATE_WITH_ERRORS; } } - - private static class ViewUpdatedFilesNotificationListener implements NotificationListener { - - private final Project myProject; - private final UpdatedFiles myUpdatedFiles; - private final Label myBeforeUpdateLabel; - private final Label myAfterUpdateLabel; - - public ViewUpdatedFilesNotificationListener(@NotNull Project project, @NotNull UpdatedFiles updatedFiles, - @Nullable Label beforeUpdate, @Nullable Label afterUpdate) { - myProject = project; - myUpdatedFiles = updatedFiles; - myBeforeUpdateLabel = beforeUpdate; - myAfterUpdateLabel = afterUpdate; - } - - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { - if (event.getDescription().equals("UpdatedFiles")) { - ProjectLevelVcsManagerEx vcsManager = ProjectLevelVcsManagerEx.getInstanceEx(myProject); - UpdateInfoTree tree = vcsManager.showUpdateProjectInfo(myUpdatedFiles, "Update", ActionInfo.UPDATE, false); - tree.setBefore(myBeforeUpdateLabel); - tree.setAfter(myAfterUpdateLabel); - } - else { - BrowserUtil.browse(event.getDescription()); - } - } - } - } - - } diff --git a/plugins/git4idea/tests/git4idea/push/GitPushResultNotificationTest.java b/plugins/git4idea/tests/git4idea/push/GitPushResultNotificationTest.java index 4221402564e3..7f734a851019 100644 --- a/plugins/git4idea/tests/git4idea/push/GitPushResultNotificationTest.java +++ b/plugins/git4idea/tests/git4idea/push/GitPushResultNotificationTest.java @@ -22,6 +22,7 @@ import com.intellij.openapi.vcs.update.UpdatedFiles; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.testFramework.EdtTestUtil; import com.intellij.util.containers.ContainerUtil; +import com.intellij.vcs.test.UtilsKt; import git4idea.GitLocalBranch; import git4idea.GitRemoteBranch; import git4idea.GitStandardRemoteBranch; @@ -95,10 +96,7 @@ public class GitPushResultNotificationTest extends GitPlatformTest { public void test_success_with_update() { GitPushResultNotification notification = notification(singleResult(SUCCESS, "master", "origin/master", 2, GitUpdateResult.SUCCESS)); - assertNotification(NotificationType.INFORMATION, "Push successful", - "Pushed 2 commits to origin/master
" + - GitPushResultNotification.VIEW_FILES_UPDATED_DURING_THE_PUSH, notification); - + UtilsKt.assertSuccessfulNotification("Push successful", "Pushed 2 commits to origin/master", notification); } public void test_success_and_resolved_conflicts() { @@ -110,8 +108,8 @@ public class GitPushResultNotificationTest extends GitPlatformTest { assertNotification(NotificationType.WARNING, "Push partially rejected", "ultimate: pushed 1 commit to origin/master
" + "community: " + GitPushResultNotification.UPDATE_WITH_RESOLVED_CONFLICTS + "
" + - "contrib: " + GitPushResultNotification.UPDATE_WITH_RESOLVED_CONFLICTS + "
" + - GitPushResultNotification.VIEW_FILES_UPDATED_DURING_THE_PUSH, notification); + "contrib: " + GitPushResultNotification.UPDATE_WITH_RESOLVED_CONFLICTS, + notification); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java index 4adba1b5bdab..99fcccdeff84 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java @@ -33,6 +33,7 @@ import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vcs.update.*; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.ContainerUtil; +import com.intellij.vcs.ViewUpdateInfoNotification; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,6 +51,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import static com.intellij.openapi.vcs.update.ActionInfo.INTEGRATE; + public class SvnIntegrateChangesTask extends Task.Backgroundable { private final ProjectLevelVcsManagerEx myProjectLevelVcsManager; private final SvnVcs myVcs; @@ -237,8 +240,9 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { private void showUpdateTree() { RestoreUpdateTree restoreUpdateTree = RestoreUpdateTree.getInstance(myProject); // action info is actually NOT used - restoreUpdateTree.registerUpdateInformation(myAccumulatedFiles.getUpdatedFiles(), ActionInfo.INTEGRATE); - myProjectLevelVcsManager.showUpdateProjectInfo(myAccumulatedFiles.getUpdatedFiles(), myTitle, ActionInfo.INTEGRATE, false); + restoreUpdateTree.registerUpdateInformation(myAccumulatedFiles.getUpdatedFiles(), INTEGRATE); + UpdateInfoTree tree = myProjectLevelVcsManager.showUpdateProjectInfo(myAccumulatedFiles.getUpdatedFiles(), myTitle, INTEGRATE, false); + if (tree != null) ViewUpdateInfoNotification.focusUpdateInfoTree(myProject, tree); } private void stepToNextChangeList() {