mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-145204 Perforce shelve: don't suggest to remove changelist with shelved files on making it non-active
This commit is contained in:
@@ -269,13 +269,15 @@ public abstract class AbstractVcs<ComList extends CommittedChangeList> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<? extends LocalChangeList> toAsk) {
|
||||
return myConfig.REMOVE_EMPTY_INACTIVE_CHANGELISTS != VcsShowConfirmationOption.Value.SHOW_CONFIRMATION ||
|
||||
|
||||
+5
-6
@@ -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<LocalChangeList>): Boolean
|
||||
|
||||
companion object {
|
||||
platformStatic
|
||||
fun processLists(project: Project, allLists: Collection<LocalChangeList>, ask: ChangeListRemoveConfirmation) {
|
||||
@JvmStatic
|
||||
fun processLists(project: Project, explicitly: Boolean, allLists: Collection<LocalChangeList>, ask: ChangeListRemoveConfirmation) {
|
||||
val confirmationAsked = ContainerUtil.newIdentityTroveSet<LocalChangeList>()
|
||||
val doNotRemove = ContainerUtil.newIdentityTroveSet<LocalChangeList>()
|
||||
|
||||
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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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<? extends LocalChangeList> lists1) {
|
||||
return RemoveChangeListAction.askIfShouldRemoveChangeLists(lists1, project);
|
||||
|
||||
Reference in New Issue
Block a user