mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-170049 "Find in path" dialog: find anywhere/in comments/... doesn't have a shortcut
Signed-off-by: Vassiliy.Kudryashov <Vassiliy.Kudryashov@jetbrains.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
find.popup.scope.scope=&Scope
|
||||
find.popup.show.filter.popup=Show Filter Popup
|
||||
Reference in New Issue
Block a user