mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-75002 merge: allow to assign shortcuts to actions
* fix action titles - capitalisation, wording
This commit is contained in:
@@ -1237,10 +1237,6 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
}
|
||||
|
||||
public abstract class ApplyNonConflictsActionBase extends DumbAwareAction {
|
||||
public ApplyNonConflictsActionBase(@Nullable String text, @Nullable String description, @Nullable Icon icon) {
|
||||
super(text, description, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
executeMergeCommand("Apply Non Conflicted Changes", true, null, () -> {
|
||||
@@ -1257,7 +1253,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
|
||||
public class ApplyNonConflictsAction extends ApplyNonConflictsActionBase {
|
||||
public ApplyNonConflictsAction() {
|
||||
super(DiffBundle.message("merge.dialog.apply.all.non.conflicting.changes.action.name"), null, AllIcons.Diff.ApplyNotConflicts);
|
||||
ActionUtil.copyFrom(this, "Diff.ApplyNonConflicts");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1281,10 +1277,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@NotNull private final Side mySide;
|
||||
|
||||
public ApplySideNonConflictsAction(@NotNull Side side) {
|
||||
super(side.select(DiffBundle.message("merge.dialog.apply.left.non.conflicting.changes.action.name"),
|
||||
DiffBundle.message("merge.dialog.apply.right.non.conflicting.changes.action.name")),
|
||||
null,
|
||||
side.select(AllIcons.Diff.ApplyNotConflictsLeft, AllIcons.Diff.ApplyNotConflictsRight));
|
||||
ActionUtil.copyFrom(this, side.select("Diff.ApplyNonConflicts.Left", "Diff.ApplyNonConflicts.Right"));
|
||||
mySide = side;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,9 @@ import com.intellij.diff.tools.util.SimpleDiffPanel;
|
||||
import com.intellij.diff.tools.util.base.ListenerDiffViewerBase;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.diff.util.ThreeSide;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -201,32 +200,27 @@ public abstract class ThreesideDiffViewer<T extends EditorHolder> extends Listen
|
||||
@NotNull protected final ThreeSide mySide2;
|
||||
|
||||
public ShowPartialDiffAction(@NotNull PartialDiffMode mode) {
|
||||
String text;
|
||||
Icon icon;
|
||||
String id;
|
||||
switch (mode) {
|
||||
case LEFT_BASE:
|
||||
mySide1 = ThreeSide.LEFT;
|
||||
mySide2 = ThreeSide.BASE;
|
||||
text = DiffBundle.message("merge.partial.diff.action.name.0.1");
|
||||
icon = AllIcons.Diff.LeftDiff;
|
||||
id = "Diff.ComparePartial.Base.Left";
|
||||
break;
|
||||
case BASE_RIGHT:
|
||||
mySide1 = ThreeSide.BASE;
|
||||
mySide2 = ThreeSide.RIGHT;
|
||||
text = DiffBundle.message("merge.partial.diff.action.name.1.2");
|
||||
icon = AllIcons.Diff.RightDiff;
|
||||
id = "Diff.ComparePartial.Base.Right";
|
||||
break;
|
||||
case LEFT_RIGHT:
|
||||
mySide1 = ThreeSide.LEFT;
|
||||
mySide2 = ThreeSide.RIGHT;
|
||||
text = DiffBundle.message("merge.partial.diff.action.name");
|
||||
icon = AllIcons.Diff.BranchDiff;
|
||||
id = "Diff.ComparePartial.Left.Right";
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
getTemplatePresentation().setText(text);
|
||||
getTemplatePresentation().setIcon(icon);
|
||||
ActionUtil.copyFrom(this, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.intellij.diff.merge
|
||||
import com.intellij.diff.merge.MergeTestBase.SidesState.*
|
||||
import com.intellij.diff.util.Side
|
||||
import com.intellij.diff.util.TextDiffType.*
|
||||
import com.intellij.openapi.diff.DiffBundle
|
||||
import com.intellij.idea.ActionsBundle
|
||||
|
||||
class MergeTest : MergeTestBase() {
|
||||
fun testChangeTypes() {
|
||||
@@ -500,9 +500,9 @@ class MergeTest : MergeTestBase() {
|
||||
}
|
||||
|
||||
fun testNonConflictsActions() {
|
||||
val applyAllTitle = DiffBundle.message("merge.dialog.apply.all.non.conflicting.changes.action.name")
|
||||
val applyLeftTitle = DiffBundle.message("merge.dialog.apply.left.non.conflicting.changes.action.name")
|
||||
val applyRightTitle = DiffBundle.message("merge.dialog.apply.right.non.conflicting.changes.action.name")
|
||||
val applyAllTitle = ActionsBundle.actionText("Diff.ApplyNonConflicts")
|
||||
val applyLeftTitle = ActionsBundle.actionText("Diff.ApplyNonConflicts.Left")
|
||||
val applyRightTitle = ActionsBundle.actionText("Diff.ApplyNonConflicts.Right")
|
||||
|
||||
val text1 =
|
||||
"1 ======\n" +
|
||||
|
||||
+2
-2
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.intellij.openapi.diff.impl.incrementalMerge.ui;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
@@ -38,7 +38,7 @@ public class ApplyNonConflicts extends AnAction implements DumbAware {
|
||||
@Nullable private final DiffPanelOuterComponent myDiffPanel;
|
||||
|
||||
public ApplyNonConflicts(@Nullable DiffPanelOuterComponent diffPanel) {
|
||||
super(DiffBundle.message("merge.dialog.apply.all.non.conflicting.changes.action.name"), null, AllIcons.Diff.ApplyNotConflicts);
|
||||
ActionUtil.copyFrom(this, "Diff.ApplyNonConflicts");
|
||||
myDiffPanel = diffPanel;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.openapi.diff.impl.incrementalMerge.ui;
|
||||
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.diff.DocumentContent;
|
||||
@@ -77,13 +79,13 @@ class OpenPartialDiffAction extends AnAction implements DumbAware {
|
||||
|
||||
private String composeName() {
|
||||
if (myLeftIndex == 0 && myRightIndex == 1) {
|
||||
return DiffBundle.message("merge.partial.diff.action.name.0.1");
|
||||
return ActionsBundle.actionText("Diff.ComparePartial.Base.Left");
|
||||
}
|
||||
if (myLeftIndex == 1 && myRightIndex == 2) {
|
||||
return DiffBundle.message("merge.partial.diff.action.name.1.2");
|
||||
return ActionsBundle.actionText("Diff.ComparePartial.Base.Right");
|
||||
}
|
||||
|
||||
return DiffBundle.message("merge.partial.diff.action.name");
|
||||
return ActionsBundle.actionText("Diff.ComparePartial.Left.Right");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1279,6 +1279,12 @@ action.Diff.AppendLeftSide.text=Append Left Side
|
||||
action.Diff.AppendRightSide.text=Append Right Side
|
||||
action.Diff.IgnoreLeftSide.text=Ignore Left Side
|
||||
action.Diff.IgnoreRightSide.text=Ignore Right Side
|
||||
action.Diff.ApplyNonConflicts.text=Apply All Non-Conflicting Changes
|
||||
action.Diff.ApplyNonConflicts.Left.text=Apply Non-Conflicting Changes from the Left Side
|
||||
action.Diff.ApplyNonConflicts.Right.text=Apply Non-Conflicting Changes from the Right Side
|
||||
action.Diff.ComparePartial.Base.Left.text=Compare Left and Middle Contents
|
||||
action.Diff.ComparePartial.Base.Right.text=Compare Middle and Right Contents
|
||||
action.Diff.ComparePartial.Left.Right.text=Compare Left and Right Contents
|
||||
|
||||
action.FileChooser.ShowHiddens.text=Show Hidden Files and Directories
|
||||
action.FileChooser.ShowHiddens.description=Show hidden files and directories
|
||||
|
||||
@@ -65,15 +65,9 @@ no.differences.dialog.title=No Differences
|
||||
merge.dialog.apply.change.action.name=Accept
|
||||
merge.dialog.append.change.action.name=Apply selected change side
|
||||
merge.dialog.ignore.change.action.name=Ignore
|
||||
merge.dialog.apply.all.non.conflicting.changes.action.name=Apply all non-conflicting changes
|
||||
merge.dialog.apply.left.non.conflicting.changes.action.name=Apply non-conflicting changes from left side
|
||||
merge.dialog.apply.right.non.conflicting.changes.action.name=Apply non-conflicting changes from right side
|
||||
merge.dialog.all.conflicts.resolved.message.text=All conflicts resolved
|
||||
#0 - changes count, 1 - conflicts count
|
||||
merge.statistics.message={0, choice, 0#No changes|1#One change|2#{0, number} changes}. {1, choice, 0#No conflicts|1#One conflict|2#{0, number} conflicts}
|
||||
merge.partial.diff.action.name=Compare left and right panel contents
|
||||
merge.partial.diff.action.name.0.1=Compare left and middle panel contents
|
||||
merge.partial.diff.action.name.1.2=Compare middle and right panel contents
|
||||
merge.dialog.exit.without.applying.changes.confirmation.message=Are you sure you want to exit without applying changes?
|
||||
cancel.visual.merge.dialog.title=Cancel Visual Merge
|
||||
apply.somehow.status.message.already.applied={0, number} {0, choice, 1#hunk is|2#hunks are} already applied
|
||||
|
||||
@@ -202,6 +202,15 @@
|
||||
<action id="Diff.IgnoreRightSide" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.Remove"/>
|
||||
<separator/>
|
||||
|
||||
<action id="Diff.ApplyNonConflicts" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.ApplyNotConflicts"/>
|
||||
<action id="Diff.ApplyNonConflicts.Left" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.ApplyNotConflictsLeft"/>
|
||||
<action id="Diff.ApplyNonConflicts.Right" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.ApplyNotConflictsRight"/>
|
||||
|
||||
<action id="Diff.ComparePartial.Base.Left" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.LeftDiff"/>
|
||||
<action id="Diff.ComparePartial.Base.Right" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.RightDiff"/>
|
||||
<action id="Diff.ComparePartial.Left.Right" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Diff.BranchDiff"/>
|
||||
<separator/>
|
||||
|
||||
<action id="CompareDirs" class="com.intellij.diff.actions.CompareFilesAction" text="Compare Directories" use-shortcut-of="CompareTwoFiles"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
Reference in New Issue
Block a user