IDEA-75002 merge: allow to assign shortcuts to actions
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Wed, 4 May 2016 10:28:18 +0000 (13:28 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Wed, 4 May 2016 11:24:01 +0000 (14:24 +0300)
* fix action titles - capitalisation, wording

platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java
platform/diff-impl/src/com/intellij/diff/tools/util/side/ThreesideDiffViewer.java
platform/diff-impl/tests/com/intellij/diff/merge/MergeTest.kt
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/ApplyNonConflicts.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/OpenPartialDiffAction.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/DiffBundle.properties
platform/platform-resources/src/idea/PlatformActions.xml

index 70399b13db5856737ffdf2c26730bc6943bac663..24cba76fcf2e931eea519e93fce2a09c4c350c98 100644 (file)
@@ -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;
       }
 
index 44e1319252e607559ca20cef51a859b792f1bc99..7353ab54fdafa4b1bac2724f9045a9a0866c115c 100644 (file)
@@ -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
index 36e35fd8d8625568bc4b8585cf5054a600d0305c..47ea9c20fd62084f81d2287399867c2d37f7d4f3 100644 (file)
@@ -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" +
index 57b2eddf19aaacc35ef8396430d4a1b770da2973..6f43f9375e5a96a115ba60668a38d78246a6d008 100644 (file)
@@ -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;
   }
 
index 3193b0972d4978cb521cfdb795efa975ecf59ac8..3950424c61ce318afea2b0690fe9feee56fb7890 100644 (file)
@@ -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
index 52e8e9c195cb0350f65415084218b2257706e33e..686ab725b0d6457c5e5c8838c5dc3bee91e45b77 100644 (file)
@@ -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
index 2e0e43b4d3508821ef9fc41fecb1b2517d597bf1..e16b96a9fdebe080aac0a0801d037f831f3b996f 100644 (file)
@@ -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
index 9b9e0b8cc56dd978f80609b061c40a5a0de5ca9a..1886ef2e9dba8645814ea222cf24470eda576041 100644 (file)
       <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/>