mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-186651 diff: shortcut for "Move to Another Changelist" should not affect whole file
* do not use same shortcut for "Move <File> to Another Changelist" and "Move Lines to Another Changelist"
This commit is contained in:
@@ -1171,9 +1171,9 @@ action.Vcs.ShowDiffAction.text=Show Changes
|
||||
action.Vcs.ShowDiffAction.description=Show changes
|
||||
action.Vcs.RollbackChanges.text=Rollback Changes
|
||||
action.Vcs.RollbackChanges.description=Rollback changes
|
||||
action.Vcs.MoveChangedLinesToChangelist.text=Move to Another Changelist...
|
||||
action.Vcs.MoveChangedLinesToChangelist.description=Move selected changes to another changelist
|
||||
action.Vcs.RollbackChangedLines.text=Rollback
|
||||
action.Vcs.MoveChangedLinesToChangelist.text=Move Lines to Another Changelist...
|
||||
action.Vcs.MoveChangedLinesToChangelist.description=Move changes in selected lines to another changelist
|
||||
action.Vcs.RollbackChangedLines.text=Rollback Lines
|
||||
action.Vcs.RollbackChangedLines.description=Rollback changes in selected lines
|
||||
action.Vcs.EditSourceAction.text=Edit Source
|
||||
action.Vcs.EditSourceAction.description=Edit source
|
||||
|
||||
@@ -312,8 +312,7 @@
|
||||
</action>
|
||||
|
||||
<action id="Vcs.RollbackChangedLines" class="com.intellij.openapi.vcs.ex.RollbackLineStatusAction" icon="AllIcons.Actions.Rollback"/>
|
||||
<action id="Vcs.MoveChangedLinesToChangelist" class="com.intellij.openapi.vcs.ex.MoveChangesLineStatusAction" icon="AllIcons.Actions.MoveToAnotherChangelist"
|
||||
use-shortcut-of="ChangesView.Move"/>
|
||||
<action id="Vcs.MoveChangedLinesToChangelist" class="com.intellij.openapi.vcs.ex.MoveChangesLineStatusAction" icon="AllIcons.Actions.MoveToAnotherChangelist"/>
|
||||
|
||||
<action id="WelcomeScreen.GetFromVcs" class="com.intellij.openapi.wm.impl.welcomeScreen.GetFromVcsAction"
|
||||
icon="AllIcons.Welcome.FromVCS">
|
||||
@@ -370,6 +369,8 @@
|
||||
<reference ref="VcsShowNextChangeMarker"/>
|
||||
<reference ref="VcsShowPrevChangeMarker"/>
|
||||
<reference ref="VcsShowCurrentChangeMarker"/>
|
||||
<reference ref="Vcs.RollbackChangedLines"/>
|
||||
<reference ref="Vcs.MoveChangedLinesToChangelist"/>
|
||||
<separator/>
|
||||
<reference ref="Start.Use.Vcs"/>
|
||||
<reference ref="Vcs.QuickListPopupAction"/>
|
||||
@@ -413,7 +414,6 @@
|
||||
<separator/>
|
||||
<reference ref="Vcs.ShowMessageHistory"/>
|
||||
<reference ref="CloseAllUnmodifiedEditors"/>
|
||||
<reference ref="Vcs.RollbackChangedLines"/>
|
||||
<reference ref="WelcomeScreen.GetFromVcs"/>
|
||||
<reference ref="Vcs.CopyRevisionNumberAction"/>
|
||||
<separator/>
|
||||
|
||||
+18
-4
@@ -12,6 +12,7 @@ import com.intellij.diff.util.Range;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
@@ -36,7 +37,6 @@ import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.util.ObjectUtils.assertNotNull;
|
||||
import static com.intellij.util.ObjectUtils.notNull;
|
||||
|
||||
public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
@@ -53,7 +53,7 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
|
||||
myTracker.addListener(new MyTrackerListener(), this);
|
||||
|
||||
DiffUtil.registerAction(new MoveSelectedChangesToAnotherChangelistAction(), myPanel);
|
||||
DiffUtil.registerAction(new MoveSelectedChangesToAnotherChangelistAction(true), myPanel);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -68,7 +68,7 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
protected List<AnAction> createEditorPopupActions() {
|
||||
List<AnAction> group = new ArrayList<>(super.createEditorPopupActions());
|
||||
|
||||
group.add(new MoveSelectedChangesToAnotherChangelistAction());
|
||||
group.add(new MoveSelectedChangesToAnotherChangelistAction(false));
|
||||
|
||||
return group;
|
||||
}
|
||||
@@ -185,8 +185,20 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
}
|
||||
|
||||
private class MoveSelectedChangesToAnotherChangelistAction extends DumbAwareAction {
|
||||
private final boolean myShortcut;
|
||||
|
||||
public MoveSelectedChangesToAnotherChangelistAction(boolean shortcut) {
|
||||
myShortcut = shortcut;
|
||||
copyShortcutFrom(ActionManager.getInstance().getAction("Vcs.MoveChangedLinesToChangelist"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
if (myShortcut) {
|
||||
e.getPresentation().setEnabledAndVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
Side side = Side.fromValue(getEditors(), editor);
|
||||
if (side == null) {
|
||||
@@ -215,7 +227,9 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
Side side = assertNotNull(Side.fromValue(getEditors(), editor));
|
||||
Side side = Side.fromValue(getEditors(), editor);
|
||||
if (editor == null || side == null) return;
|
||||
|
||||
List<SimpleDiffChange> selectedChanges = getSelectedChanges(side);
|
||||
if (selectedChanges.isEmpty()) return;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MoveChangesLineStatusAction extends LineStatusActionBase {
|
||||
ChangeListChooser chooser = new ChangeListChooser(project,
|
||||
suggestedLists,
|
||||
defaultSelection,
|
||||
ActionsBundle.message("action.ChangesView.Move.text"),
|
||||
ActionsBundle.message("action.Vcs.MoveChangedLinesToChangelist.text"),
|
||||
null);
|
||||
chooser.show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user