diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index dfeab1cf393a..e263d67e6d89 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -313,28 +313,10 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider { scheduleResultsUpdate(); } }); - DefaultActionGroup switchContextGroup = new DefaultActionGroup(); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.ANY)); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.IN_COMMENTS)); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.IN_STRING_LITERALS)); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_COMMENTS)); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_STRING_LITERALS)); - switchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS)); - switchContextGroup.setPopup(true); - Presentation filterPresentation = new Presentation(); - filterPresentation.setIcon(AllIcons.General.Filter); - AnAction myShowFilterPopupAction = new AnAction() { - @Override - public void actionPerformed(AnActionEvent e) { - if (PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext()) == null) return; - - ListPopup listPopup = - JBPopupFactory.getInstance().createActionGroupPopup(null, switchContextGroup, e.getDataContext(), false, null, 10); - listPopup.showUnderneathOf(myFilterContextButton); - } - }; + AnAction myShowFilterPopupAction = new MyShowFilterPopupAction(); myFilterContextButton = - new ActionButton(myShowFilterPopupAction, filterPresentation, ActionPlaces.UNKNOWN, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE) { + new ActionButton(myShowFilterPopupAction, myShowFilterPopupAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, + ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE) { @Override public int getPopState() { int state = super.getPopState(); @@ -344,6 +326,7 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider { : ActionButtonComponent.PUSHED; } }; + myShowFilterPopupAction.registerCustomShortcutSet(myShowFilterPopupAction.getShortcutSet(), this); myFilterContextButton.setFocusable(true); DefaultActionGroup tabResultsContextGroup = new DefaultActionGroup(); @@ -1085,4 +1068,33 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider { } } } + + private class MyShowFilterPopupAction extends AnAction { + + private final DefaultActionGroup mySwitchContextGroup; + + public MyShowFilterPopupAction() { + super(FindBundle.message("find.popup.show.filter.popup"), null, AllIcons.General.Filter); + setShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F, SystemInfo.isMac + ? InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK + : InputEvent.ALT_DOWN_MASK))); + mySwitchContextGroup = new DefaultActionGroup(); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.ANY)); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.IN_COMMENTS)); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.IN_STRING_LITERALS)); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_COMMENTS)); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_STRING_LITERALS)); + mySwitchContextGroup.add(new MySwitchContextToggleAction(FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS)); + mySwitchContextGroup.setPopup(true); + } + + @Override + public void actionPerformed(AnActionEvent e) { + if (PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext()) == null) return; + + ListPopup listPopup = + JBPopupFactory.getInstance().createActionGroupPopup(null, mySwitchContextGroup, e.getDataContext(), false, null, 10); + listPopup.showUnderneathOf(myFilterContextButton); + } + } } diff --git a/platform/platform-resources-en/src/messages/FindBundle.properties b/platform/platform-resources-en/src/messages/FindBundle.properties index e57e68d21c9d..341d047cc743 100644 --- a/platform/platform-resources-en/src/messages/FindBundle.properties +++ b/platform/platform-resources-en/src/messages/FindBundle.properties @@ -147,4 +147,5 @@ find.popup.filemask=File m&ask: find.popup.scope.project=In &Project find.popup.scope.module=&Module find.popup.scope.directory=&Directory -find.popup.scope.scope=&Scope \ No newline at end of file +find.popup.scope.scope=&Scope +find.popup.show.filter.popup=Show Filter Popup \ No newline at end of file