diff --git a/platform/tasks-platform-impl/src/com/intellij/tasks/context/BranchContextTracker.java b/platform/tasks-platform-impl/src/com/intellij/tasks/context/BranchContextTracker.java index c1ab8ef6f005..234b245a946f 100644 --- a/platform/tasks-platform-impl/src/com/intellij/tasks/context/BranchContextTracker.java +++ b/platform/tasks-platform-impl/src/com/intellij/tasks/context/BranchContextTracker.java @@ -6,6 +6,7 @@ import com.intellij.notification.NotificationType; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.vcs.BranchChangeListener; +import com.intellij.openapi.vcs.VcsConfiguration; import org.jetbrains.annotations.NotNull; import javax.swing.event.HyperlinkEvent; @@ -13,7 +14,7 @@ import javax.swing.event.HyperlinkEvent; public class BranchContextTracker implements BranchChangeListener { public static final NotificationGroup NOTIFICATION = new NotificationGroup( - "Branch Context group", NotificationDisplayType.STICKY_BALLOON, true); + "Branch Context group", NotificationDisplayType.BALLOON, true); private final WorkingContextManager myContextManager; private final Project myProject; @@ -31,19 +32,19 @@ public class BranchContextTracker implements BranchChangeListener { @Override public void branchHasChanged(@NotNull String branchName) { + VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject); + if (!vcsConfiguration.RELOAD_CONTEXT) return; + String contextName = getContextName(branchName); if (!myContextManager.hasContext(contextName)) return; myContextManager.clearContext(); myContextManager.loadContext(contextName); NOTIFICATION.createNotification(null, null, "Branch context has been loaded
" + - "Got it!
" + "Turn off the feature", NotificationType.INFORMATION, (notification, event) -> { if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; - if ("ok".equals(event.getDescription())) { - notification.expire(); - } if ("off".equals(event.getDescription())) { + vcsConfiguration.RELOAD_CONTEXT = false; notification.expire(); } }).notify(myProject); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index e95f479af3dc..be65d1d5c055 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -79,6 +79,7 @@ public final class VcsConfiguration implements PersistentStateComponent - + @@ -186,7 +186,7 @@ - + @@ -212,7 +212,7 @@ - + @@ -244,6 +244,14 @@ + + + + + + + + diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java index 96fff52bb72a..861025db44ed 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java @@ -16,8 +16,6 @@ package com.intellij.openapi.vcs.configurable; import com.intellij.ide.actions.ShowFilePathAction; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.SystemInfo; @@ -27,8 +25,6 @@ import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; import com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl; import com.intellij.openapi.vfs.ReadonlyStatusHandler; import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -65,6 +61,7 @@ public class VcsGeneralConfigurationPanel { private JComboBox myFailedCommitChangelistCombo; private JComboBox myOnPatchCreation; private JCheckBox myClearInitialCommitMessage; + private JCheckBox myReloadContext; private ButtonGroup myEmptyChangelistRemovingGroup; public VcsGeneralConfigurationPanel(final Project project) { @@ -109,6 +106,7 @@ public class VcsGeneralConfigurationPanel { settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT = myCbOfferToMoveChanges.isSelected(); settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS = getSelected(myEmptyChangelistRemovingGroup); settings.MOVE_TO_FAILED_COMMIT_CHANGELIST = getFailedCommitConfirm(); + settings.RELOAD_CONTEXT = myReloadContext.isSelected(); for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) { setting.setValue(myPromptOptions.get(setting).isSelected()); @@ -191,6 +189,7 @@ public class VcsGeneralConfigurationPanel { if (settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS != getSelected(myEmptyChangelistRemovingGroup)){ return true; } + if (settings.RELOAD_CONTEXT != myReloadContext.isSelected()) return true; if (!Comparing.equal(getFailedCommitConfirm(), settings.MOVE_TO_FAILED_COMMIT_CHANGELIST)) { return true; @@ -216,6 +215,7 @@ public class VcsGeneralConfigurationPanel { myForceNonEmptyComment.setSelected(settings.FORCE_NON_EMPTY_COMMENT); myClearInitialCommitMessage.setSelected(settings.CLEAR_INITIAL_COMMIT_MESSAGE); myCbOfferToMoveChanges.setSelected(settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT); + myReloadContext.setSelected(settings.RELOAD_CONTEXT); VcsShowConfirmationOption.Value value = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS; UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, value == VcsShowConfirmationOption.Value.SHOW_CONFIRMATION ? 0