diff: show annotate action in gutter popup
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Wed, 1 Jul 2015 12:23:57 +0000 (15:23 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 3 Sep 2015 16:28:09 +0000 (19:28 +0300)
platform/diff-impl/src/com/intellij/diff/actions/impl/SetEditorSettingsAction.java
platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java
platform/platform-resources/src/idea/PlatformActions.xml
platform/platform-resources/src/idea/VcsActions.xml

index 3f7ae6cf7339ea9a82f662e6d50dfdcb6d93a300..f871c23d6baf9955c6773f124d6496d3d79d5ce3 100644 (file)
@@ -22,9 +22,13 @@ import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
 import com.intellij.openapi.editor.impl.EditorImpl;
 import com.intellij.openapi.project.DumbAware;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 public class SetEditorSettingsAction extends ActionGroup implements DumbAware {
@@ -143,7 +147,11 @@ public class SetEditorSettingsAction extends ActionGroup implements DumbAware {
   @NotNull
   @Override
   public AnAction[] getChildren(@Nullable AnActionEvent e) {
-    return myActions;
+    List<AnAction> result = new ArrayList<AnAction>();
+    ContainerUtil.addAll(result, myActions);
+    result.add(Separator.getInstance());
+    result.add(ActionManager.getInstance().getAction(IdeActions.GROUP_DIFF_EDITOR_GUTTER_POPUP));
+    return ContainerUtil.toArray(result, new AnAction[result.size()]);
   }
 
   private abstract class EditorSettingToggleAction extends ToggleAction implements DumbAware {
index 7f2c50e9e5ce9ccf1754781e4d71a81c0fbd61f1..1e99dade5d6a817d06d8c15965a4a7b158f9a7d8 100644 (file)
@@ -169,6 +169,7 @@ public interface IdeActions {
   @NonNls String GROUP_DIFF_EDITOR_POPUP = "Diff.EditorPopupMenu";
   @NonNls String DIFF_VIEWER_POPUP = "Diff.ViewerPopupMenu";
   @NonNls String DIFF_VIEWER_TOOLBAR = "Diff.ViewerToolbar";
+  @NonNls String GROUP_DIFF_EDITOR_GUTTER_POPUP = "Diff.EditorGutterPopupMenu";
 
   @NonNls String ACTION_EXPAND_ALL = "ExpandAll";
   @NonNls String ACTION_COLLAPSE_ALL = "CollapseAll";
index 5681b192f90ad46e621a1dbd7681ae897b513001..680fa2d971df38c6b93e0a58a7a9be953c242ae6 100644 (file)
@@ -541,7 +541,13 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
   @Nullable
   @Override
   public Object getData(@NonNls String dataId) {
-    return EditorGutter.KEY.is(dataId) ? this : null;
+    if (EditorGutter.KEY.is(dataId)) {
+      return this;
+    }
+    else if (CommonDataKeys.EDITOR.is(dataId)) {
+      return myEditor;
+    }
+    return null;
   }
 
   private interface RangeHighlighterProcessor {
index 0ba0116e1aa7cf4aceed321909f5ffa389bdd049..14a131919f20275094a2910edf02d7b9bb98b9cf 100644 (file)
     <group id="Diff.EditorPopupMenu"/>
     <group id="Diff.ViewerPopupMenu"/>
     <group id="Diff.ViewerToolbar"/>
+    <group id="Diff.EditorGutterPopupMenu"/>
 
     <action id="ScrollTreeToCenter" text="Scroll to Center" class="com.intellij.ide.actions.ScrollTreeToCenterAction" use-shortcut-of="EditorScrollToCenter"/>
 
       </group>
 
       <!-- Tools -->
-      <group id="ToolsMenu" popup="true" compact="true">
+      <group id="ToolsMenu" configurable="true" popup="true" compact="true">
         <action id="PsiViewer" class="com.intellij.internal.psiView.PsiViewerAction"/>
         <action id="PsiViewerForContext" class="com.intellij.internal.psiView.PsiViewerForContextAction"/>
         <separator/>
       <group id="OtherMenu" class="com.intellij.ide.actions.NonEmptyActionGroup"/>
     </group>
 
-    <group id="MainToolBar">
+    <group id="MainToolBar" configurable="true">
       <reference ref="OpenFile"/>
       <reference ref="SaveAll"/>
       <reference ref="Synchronize"/>
 
     <group id="NavBarVcsGroup"/>
 
-    <group id="EditorPopupMenu">
+    <group id="EditorPopupMenu" configurable="true">
       <reference ref="$Cut"/>
       <reference ref="$Copy"/>
       <reference ref="$Paste"/>
       <reference ref="CompareClipboardWithSelection"/>
       <reference ref="ChangeFileEncodingAction"/>
     </group>
-    
-    <group id="BasicEditorPopupMenu">
-      <reference ref="$Cut"/>
-      <reference ref="$Copy"/>
-      <reference ref="$Paste"/>
-    </group>
 
     <group id="ConsoleEditorPopupMenu">
       <reference ref="CutCopyPasteGroup"/>
     <action id="Console.Open" class="com.intellij.openapi.actionSystem.EmptyAction"/>
     <action id="Console.Execute" class="com.intellij.openapi.actionSystem.EmptyAction"/>
     <action id="Console.Execute.Multiline" class="com.intellij.openapi.actionSystem.EmptyAction"/>
-    <action id="Console.SplitLine" class="com.intellij.openapi.actionSystem.EmptyAction" use-shortcut-of="EditorSplitLine"/>
+    <action id="Console.SplitLine" class="com.intellij.openapi.actionSystem.EmptyAction" use-shortcut-of="SplitLine"/>
     <group id="Console.HistoryActions">
       <action id="Console.History.Previous" class="com.intellij.openapi.actionSystem.EmptyAction"/>
       <action id="Console.History.Next" class="com.intellij.openapi.actionSystem.EmptyAction"/>
index eb767a7dde98eca2be7f014aee979578eb6e9f85..8c82cd32f539bf540b08a99e6273e3915e00dcbe 100644 (file)
@@ -13,6 +13,7 @@
     <action id="Annotate" class="com.intellij.openapi.vcs.actions.AnnotateToggleAction"/>
     <action id="AnnotateDiffViewer" class="com.intellij.openapi.vcs.actions.AnnotateDiffViewerAction">
       <add-to-group group-id="Diff.EditorPopupMenu"/>
+      <add-to-group group-id="Diff.EditorGutterPopupMenu"/>
     </action>
     <action id="Show.Current.Revision" class="com.intellij.openapi.vcs.actions.ShowBaseRevisionAction" text="Show Current Revision"/>
     <action id="Compare.SameVersion" class="com.intellij.openapi.vcs.actions.CompareWithTheSameVersionAction" icon="AllIcons.Actions.Diff"/>