IJPL-77608 svn: remove the hack with a different DataKey used in 'actionPerformed'

It no longer works, as all the keys are being pre-cached by PreCachedDataContext.

GitOrigin-RevId: f013d69bfb248b9a0a7001a70ebf1db5c6343fed
This commit is contained in:
Aleksey Pivovarov
2024-06-27 17:12:37 +02:00
committed by intellij-monorepo-bot
parent 1bcb0c10d9
commit 2d5af22db1
6 changed files with 30 additions and 15 deletions

View File

@@ -558,7 +558,6 @@ f:com.intellij.openapi.vcs.VcsConsoleLine
com.intellij.openapi.vcs.VcsDataKeys com.intellij.openapi.vcs.VcsDataKeys
- sf:CHANGES:com.intellij.openapi.actionSystem.DataKey - sf:CHANGES:com.intellij.openapi.actionSystem.DataKey
- sf:CHANGES_SELECTION:com.intellij.openapi.actionSystem.DataKey - sf:CHANGES_SELECTION:com.intellij.openapi.actionSystem.DataKey
- sf:CHANGES_WITH_MOVED_CHILDREN:com.intellij.openapi.actionSystem.DataKey
- sf:CHANGE_LEAD_SELECTION:com.intellij.openapi.actionSystem.DataKey - sf:CHANGE_LEAD_SELECTION:com.intellij.openapi.actionSystem.DataKey
- sf:CHANGE_LISTS:com.intellij.openapi.actionSystem.DataKey - sf:CHANGE_LISTS:com.intellij.openapi.actionSystem.DataKey
- sf:COMMIT_MESSAGE_CONTROL:com.intellij.openapi.actionSystem.DataKey - sf:COMMIT_MESSAGE_CONTROL:com.intellij.openapi.actionSystem.DataKey

View File

@@ -75,11 +75,6 @@ public interface VcsDataKeys {
* This difference might be important when {@link AbstractVcs#areDirectoriesVersionedItems()} is {@code true}. * This difference might be important when {@link AbstractVcs#areDirectoriesVersionedItems()} is {@code true}.
*/ */
DataKey<Change[]> CHANGE_LEAD_SELECTION = DataKey.create("ChangeListView.ChangeLeadSelection"); DataKey<Change[]> CHANGE_LEAD_SELECTION = DataKey.create("ChangeListView.ChangeLeadSelection");
/**
* Can be used to ensure that directory flags for SVN are initialized.
* Is potentially slow and should not be used in {@link com.intellij.openapi.actionSystem.AnAction#update}, use {@link #CHANGES} instead.
*/
DataKey<Change[]> CHANGES_WITH_MOVED_CHILDREN = DataKey.create("ChangeListView.ChangesWithDetails");
DataKey<List<VirtualFile>> MODIFIED_WITHOUT_EDITING_DATA_KEY = DataKey.create("ChangeListView.ModifiedWithoutEditing"); DataKey<List<VirtualFile>> MODIFIED_WITHOUT_EDITING_DATA_KEY = DataKey.create("ChangeListView.ModifiedWithoutEditing");
DataKey<Change> CURRENT_CHANGE = DataKey.create("vcs.CurrentChange"); DataKey<Change> CURRENT_CHANGE = DataKey.create("vcs.CurrentChange");

View File

@@ -3168,12 +3168,15 @@ c:com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser
- com.intellij.openapi.Disposable - com.intellij.openapi.Disposable
- com.intellij.openapi.actionSystem.DataProvider - com.intellij.openapi.actionSystem.DataProvider
- com.intellij.openapi.vcs.changes.committed.DecoratorManager - com.intellij.openapi.vcs.changes.committed.DecoratorManager
- sf:COMMITTED_CHANGES_TREE_DATA_KEY:com.intellij.openapi.actionSystem.DataKey
- sf:ITEMS_RELOADED:com.intellij.util.messages.Topic - sf:ITEMS_RELOADED:com.intellij.util.messages.Topic
- sf:ourHelpId:java.lang.String - sf:ourHelpId:java.lang.String
- <init>(com.intellij.openapi.project.Project,java.util.List):V - <init>(com.intellij.openapi.project.Project,java.util.List):V
- addFilter(com.intellij.openapi.vcs.changes.committed.ChangeListFilteringStrategy):V - addFilter(com.intellij.openapi.vcs.changes.committed.ChangeListFilteringStrategy):V
- append(java.util.List):V - append(java.util.List):V
- s:collectChanges(java.util.List,Z):java.util.List - s:collectChanges(java.util.List,Z):java.util.List
- collectChangesWithMovedChildren():com.intellij.openapi.vcs.changes.Change[]
- collectSelectedChangesWithMovedChildren():com.intellij.openapi.vcs.changes.Change[]
- createGroupFilterToolbar(com.intellij.openapi.project.Project,com.intellij.openapi.actionSystem.ActionGroup,com.intellij.openapi.actionSystem.ActionGroup,java.util.List):com.intellij.openapi.actionSystem.ActionToolbar - createGroupFilterToolbar(com.intellij.openapi.project.Project,com.intellij.openapi.actionSystem.ActionGroup,com.intellij.openapi.actionSystem.ActionGroup,java.util.List):com.intellij.openapi.actionSystem.ActionToolbar
- dispose():V - dispose():V
- getChangesTree():com.intellij.ui.treeStructure.Tree - getChangesTree():com.intellij.ui.treeStructure.Tree

View File

@@ -4,6 +4,7 @@ package com.intellij.openapi.vcs.changes.actions;
import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -19,7 +20,9 @@ public class RevertChangeListAction extends RevertCommittedStuffAbstractAction {
return e.getData(VcsDataKeys.CHANGES); return e.getData(VcsDataKeys.CHANGES);
} }
else { else {
return e.getData(VcsDataKeys.CHANGES_WITH_MOVED_CHILDREN); CommittedChangesTreeBrowser treeBrowser = e.getData(CommittedChangesTreeBrowser.COMMITTED_CHANGES_TREE_DATA_KEY);
if (treeBrowser == null) return null;
return treeBrowser.collectChangesWithMovedChildren();
} }
} }
} }

View File

@@ -19,6 +19,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList; import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -62,11 +63,13 @@ public abstract class RevertSelectedChangesAction extends RevertCommittedStuffAb
@Override @Override
protected Change @Nullable [] getChanges(@NotNull AnActionEvent e, boolean isFromUpdate) { protected Change @Nullable [] getChanges(@NotNull AnActionEvent e, boolean isFromUpdate) {
if (!isFromUpdate) { if (isFromUpdate) {
// to ensure directory flags for SVN are initialized return e.getData(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS);
e.getData(VcsDataKeys.CHANGES_WITH_MOVED_CHILDREN); }
else {
CommittedChangesTreeBrowser treeBrowser = e.getData(CommittedChangesTreeBrowser.COMMITTED_CHANGES_TREE_DATA_KEY);
if (treeBrowser == null) return null;
return treeBrowser.collectSelectedChangesWithMovedChildren();
} }
return e.getData(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS);
} }
} }

View File

@@ -93,6 +93,8 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
private final MessageBusConnection myConnection; private final MessageBusConnection myConnection;
private TreeState myState; private TreeState myState;
public static final DataKey<CommittedChangesTreeBrowser> COMMITTED_CHANGES_TREE_DATA_KEY = DataKey.create("CommittedChangesTreeBrowser");
public CommittedChangesTreeBrowser(final Project project, final List<? extends CommittedChangeList> changeLists) { public CommittedChangesTreeBrowser(final Project project, final List<? extends CommittedChangeList> changeLists) {
super(new BorderLayout()); super(new BorderLayout());
@@ -422,12 +424,12 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
@Nullable @Nullable
@Override @Override
public Object getData(@NotNull String dataId) { public Object getData(@NotNull String dataId) {
if (COMMITTED_CHANGES_TREE_DATA_KEY.is(dataId)) {
return this;
}
if (VcsDataKeys.CHANGES.is(dataId)) { if (VcsDataKeys.CHANGES.is(dataId)) {
return collectChanges(getSelectedChangeLists(), false).toArray(Change.EMPTY_CHANGE_ARRAY); return collectChanges(getSelectedChangeLists(), false).toArray(Change.EMPTY_CHANGE_ARRAY);
} }
if (VcsDataKeys.CHANGES_WITH_MOVED_CHILDREN.is(dataId)) {
return collectChanges(getSelectedChangeLists(), true).toArray(Change.EMPTY_CHANGE_ARRAY);
}
if (VcsDataKeys.CHANGE_LISTS.is(dataId)) { if (VcsDataKeys.CHANGE_LISTS.is(dataId)) {
List<CommittedChangeList> changeLists = getSelectedChangeLists(); List<CommittedChangeList> changeLists = getSelectedChangeLists();
return !changeLists.isEmpty() ? changeLists.toArray(new CommittedChangeList[0]) : null; return !changeLists.isEmpty() ? changeLists.toArray(new CommittedChangeList[0]) : null;
@@ -445,6 +447,16 @@ public class CommittedChangesTreeBrowser extends JPanel implements DataProvider,
return null; return null;
} }
public Change @NotNull [] collectChangesWithMovedChildren() {
return collectChanges(getSelectedChangeLists(), true).toArray(Change.EMPTY_CHANGE_ARRAY);
}
public Change @NotNull [] collectSelectedChangesWithMovedChildren() {
// to ensure directory flags for SVN are initialized
collectChanges(getSelectedChangeLists(), true);
return myDetailsView.getSelectedChanges().toArray(Change.EMPTY_CHANGE_ARRAY);
}
public TreeExpander getTreeExpander() { public TreeExpander getTreeExpander() {
return myTreeExpander; return myTreeExpander;
} }