From 1c0269564be102b6fc195452958f9ee8000f1ab7 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 19 Feb 2012 12:09:59 +0100 Subject: [PATCH] a shortcut for revert in line status tracker popup --- .../intellij/openapi/actionSystem/IdeActions.java | 1 + .../vcs/actions/VcsQuickListPopupAction.java | 3 ++- .../openapi/vcs/ex/LineStatusTrackerDrawing.java | 15 +++++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java index 63408e72c920..f366cb5e69b5 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java @@ -254,4 +254,5 @@ public interface IdeActions { String ACTION_UNDO = "$Undo"; String ACTION_REDO = "$Redo"; String GROUP_REFACTOR = "RefactoringMenu"; + String CHANGES_VIEW_ROLLBACK = "ChangesView.Rollback"; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsQuickListPopupAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsQuickListPopupAction.java index 984c5c1397c1..48e9d47b9fd0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsQuickListPopupAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/VcsQuickListPopupAction.java @@ -22,6 +22,7 @@ import java.util.List; * May be customized using com.intellij.openapi.vcs.actions.VcsQuickListContentProvider extension point. */ public class VcsQuickListPopupAction extends QuickSwitchSchemeAction implements DumbAware { + public VcsQuickListPopupAction() { myActionPlace = ActionPlaces.ACTION_PLACE_VCS_QUICK_LIST_POPUP_ACTION; } @@ -98,7 +99,7 @@ public class VcsQuickListPopupAction extends QuickSwitchSchemeAction implements addAction("ChangesView.AddUnversioned", group); addAction("CheckinProject", group); addAction("CheckinFiles", group); - addAction("ChangesView.Rollback", group); + addAction(IdeActions.CHANGES_VIEW_ROLLBACK, group); // history and compare addSeparator(group); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java index d6a019e047a4..449b7144a553 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerDrawing.java @@ -14,10 +14,7 @@ package com.intellij.openapi.vcs.ex; import com.intellij.codeInsight.hint.EditorFragmentComponent; import com.intellij.codeInsight.hint.HintManagerImpl; -import com.intellij.openapi.actionSystem.ActionManager; -import com.intellij.openapi.actionSystem.ActionPlaces; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.DefaultActionGroup; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.diff.DiffColors; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -51,6 +48,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.util.EventObject; +import java.util.List; /** * @author irengrig @@ -159,11 +157,15 @@ public class LineStatusTrackerDrawing { localShowNextAction.copyFrom(globalShowNextAction); localShowPrevAction.copyFrom(globalShowPrevAction); - group.add(new RollbackLineStatusRangeAction(tracker, range, editor)); + final RollbackLineStatusRangeAction rollback = new RollbackLineStatusRangeAction(tracker, range, editor); + EmptyAction.setupAction(rollback, IdeActions.CHANGES_VIEW_ROLLBACK, editorComponent); + group.add(rollback); + group.add(new ShowLineStatusRangeDiffAction(tracker, range, editor)); group.add(new CopyLineStatusRangeAction(tracker, range)); - final java.util.List actionList = (java.util.List)editorComponent.getClientProperty(AnAction.ourClientProperty); + @SuppressWarnings("unchecked") + final List actionList = (List)editorComponent.getClientProperty(AnAction.ourClientProperty); actionList.remove(globalShowPrevAction); actionList.remove(globalShowNextAction); @@ -200,6 +202,7 @@ public class LineStatusTrackerDrawing { final LightweightHint lightweightHint = new LightweightHint(component); lightweightHint.addHintListener(new HintListener() { public void hintHidden(final EventObject event) { + actionList.remove(rollback); actionList.remove(localShowPrevAction); actionList.remove(localShowNextAction); actionList.add(globalShowPrevAction);