diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java index e3c3d0a966a4..92b59d3e25c3 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java @@ -269,13 +269,15 @@ public abstract class AbstractVcs extends S /** * Invoked when a changelist is deleted explicitly by user or implicitly (e.g. after default changelist switch * when the previous one was empty). + * @param list change list that's about to be removed + * @param explicitly whether it's a result of explicit Delete action, or just after switching the active changelist. * @return UNSURE if the VCS has nothing to say about this changelist. * YES or NO if the changelist has to be removed or not, and no further confirmations are needed about this changelist * (in particular, the VCS can show a confirmation to the user by itself) */ @CalledInAwt @NotNull - public ThreeState mayRemoveChangeList(@NotNull LocalChangeList list) { + public ThreeState mayRemoveChangeList(@NotNull LocalChangeList list, boolean explicitly) { return ThreeState.UNSURE; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index 219e3bbfd1d0..25b2779a85e1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -197,7 +197,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec return; } - ChangeListRemoveConfirmation.processLists(myProject, lists, new ChangeListRemoveConfirmation() { + ChangeListRemoveConfirmation.processLists(myProject, false, lists, new ChangeListRemoveConfirmation() { @Override public boolean askIfShouldRemoveChangeLists(@NotNull List toAsk) { return myConfig.REMOVE_EMPTY_INACTIVE_CHANGELISTS != VcsShowConfirmationOption.Value.SHOW_CONFIRMATION || diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeListRemoveConfirmation.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeListRemoveConfirmation.kt index fcad86f3db43..b4d670ceafdf 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeListRemoveConfirmation.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeListRemoveConfirmation.kt @@ -21,21 +21,20 @@ import com.intellij.openapi.vcs.changes.ChangeListManager import com.intellij.openapi.vcs.changes.LocalChangeList import com.intellij.util.ThreeState import com.intellij.util.containers.ContainerUtil -import kotlin.platform.platformStatic abstract class ChangeListRemoveConfirmation() { abstract fun askIfShouldRemoveChangeLists(ask: List): Boolean companion object { - platformStatic - fun processLists(project: Project, allLists: Collection, ask: ChangeListRemoveConfirmation) { + @JvmStatic + fun processLists(project: Project, explicitly: Boolean, allLists: Collection, ask: ChangeListRemoveConfirmation) { val confirmationAsked = ContainerUtil.newIdentityTroveSet() val doNotRemove = ContainerUtil.newIdentityTroveSet() for (list in allLists) { - for (vcs in ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()) { - val permission = vcs.mayRemoveChangeList(list) + for (vcs in ProjectLevelVcsManager.getInstance(project).allActiveVcss) { + val permission = vcs.mayRemoveChangeList(list, explicitly) if (permission != ThreeState.UNSURE) { confirmationAsked.add(list) } @@ -50,7 +49,7 @@ abstract class ChangeListRemoveConfirmation() { if (toAsk.isNotEmpty() && !ask.askIfShouldRemoveChangeLists(toAsk)) { doNotRemove.addAll(toAsk) } - allLists.filter { it !in doNotRemove }.forEach { ChangeListManager.getInstance(project).removeChangeList(it.getName()) } + allLists.filter { it !in doNotRemove }.forEach { ChangeListManager.getInstance(project).removeChangeList(it.name) } } } } \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RemoveChangeListAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RemoveChangeListAction.java index 164d3abecc87..24c88b329450 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RemoveChangeListAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/RemoveChangeListAction.java @@ -71,7 +71,7 @@ public class RemoveChangeListAction extends AnAction implements DumbAware { } //noinspection unchecked - ChangeListRemoveConfirmation.processLists(project, (Collection)Arrays.asList(lists), new ChangeListRemoveConfirmation() { + ChangeListRemoveConfirmation.processLists(project, true, (Collection)Arrays.asList(lists), new ChangeListRemoveConfirmation() { @Override public boolean askIfShouldRemoveChangeLists(@NotNull List lists1) { return RemoveChangeListAction.askIfShouldRemoveChangeLists(lists1, project);