use of com.intellij.openapi.actionSystem.impl.ActionManagerImpl in project intellij-community by JetBrains.
the class ToolWindowContentUi method showContextMenu.
public void showContextMenu(Component comp, int x, int y, ActionGroup toolWindowGroup, @Nullable Content selectedContent) {
if (selectedContent == null && toolWindowGroup == null) {
return;
}
DefaultActionGroup group = new DefaultActionGroup();
if (selectedContent != null) {
initActionGroup(group, selectedContent);
}
if (toolWindowGroup != null) {
group.addAll(toolWindowGroup);
}
final ActionPopupMenu popupMenu = ((ActionManagerImpl) ActionManager.getInstance()).createActionPopupMenu(POPUP_PLACE, group, new MenuItemPresentationFactory(true));
popupMenu.getComponent().show(comp, x, y);
}
use of com.intellij.openapi.actionSystem.impl.ActionManagerImpl in project intellij-community by JetBrains.
the class GotoActionItemProvider method processActions.
private boolean processActions(String pattern, boolean everywhere, Processor<MatchedValue> consumer, DataContext dataContext) {
JBIterable<AnAction> actions;
if (everywhere) {
Set<String> ids = ((ActionManagerImpl) myActionManager).getActionIds();
actions = JBIterable.from(ids).transform(myActionManager::getAction).filter(Condition.NOT_NULL);
} else {
actions = JBIterable.from(myModel.myActionGroups.keySet());
}
MinusculeMatcher matcher = NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
JBIterable<ActionWrapper> actionWrappers = actions.transform(action -> {
MatchMode mode = myModel.actionMatches(pattern, matcher, action);
if (mode == MatchMode.NONE)
return null;
return new ActionWrapper(action, myModel.myActionGroups.get(action), mode, dataContext);
}).filter(Condition.NOT_NULL);
return processItems(pattern, actionWrappers, consumer);
}
use of com.intellij.openapi.actionSystem.impl.ActionManagerImpl in project intellij-community by JetBrains.
the class LightToolWindow method showGearPopup.
private void showGearPopup(Component component, int x, int y) {
ActionPopupMenu popupMenu = ((ActionManagerImpl) ActionManager.getInstance()).createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
popupMenu.getComponent().show(component, x, y);
}
use of com.intellij.openapi.actionSystem.impl.ActionManagerImpl in project intellij-community by JetBrains.
the class TraverseUIStarter method processKeymap.
private static void processKeymap(Element configurableElement) {
final ActionManager actionManager = ActionManager.getInstance();
final String componentName = actionManager.getComponentName();
final SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
final Set<String> ids = ((ActionManagerImpl) actionManager).getActionIds();
final TreeSet<OptionDescription> options = new TreeSet<>();
for (String id : ids) {
final AnAction anAction = actionManager.getAction(id);
final String text = anAction.getTemplatePresentation().getText();
if (text != null) {
collectOptions(searchableOptionsRegistrar, options, text, componentName);
}
final String description = anAction.getTemplatePresentation().getDescription();
if (description != null) {
collectOptions(searchableOptionsRegistrar, options, description, componentName);
}
}
writeOptions(configurableElement, options);
}
use of com.intellij.openapi.actionSystem.impl.ActionManagerImpl in project intellij-community by JetBrains.
the class ActionsWithoutUpdateMethodTest method testActionsWithShortcuts.
public void testActionsWithShortcuts() throws Exception {
Set<String> ids = new HashSet<>();
for (String id : ((ActionManagerImpl) ActionManager.getInstance()).getActionIds()) {
for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
if (keymap.getShortcuts(id).length > 0 && !PLATFORM_WIDE_ACTIONS.contains(id)) {
ids.add(id);
}
}
}
ActionManager mgr = ActionManager.getInstance();
ArrayList<AnAction> failed = new ArrayList<>();
for (String id : ids) {
AnAction action = mgr.getAction(id);
if (action == null) {
System.out.println("Can't find action: " + id);
continue;
}
Method updateMethod = action.getClass().getMethod("update", AnActionEvent.class);
if (updateMethod.getDeclaringClass() == AnAction.class) {
failed.add(action);
}
}
for (AnAction action : failed) {
System.out.println(action + " ID: " + mgr.getId(action) + " Class: " + action.getClass());
}
assertEmpty("The following actions have shortcuts, but don't have update() method redefined", failed);
}
Aggregations