use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class ValueHint method createInspectTree.
public static InspectDebuggerTree createInspectTree(final NodeDescriptorImpl descriptor, Project project) {
final InspectDebuggerTree tree = new InspectDebuggerTree(project);
final AnAction setValueAction = ActionManager.getInstance().getAction(DebuggerActions.SET_VALUE);
setValueAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), tree);
Disposer.register(tree, new Disposable() {
@Override
public void dispose() {
setValueAction.unregisterCustomShortcutSet(tree);
}
});
tree.setInspectDescriptor(descriptor);
DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(project).getContext();
tree.rebuild(context);
return tree;
}
use of com.intellij.openapi.actionSystem.AnAction in project ideavim by JetBrains.
the class ActionHandler method execute.
public boolean execute(@NotNull Editor editor, @NotNull final DataContext context, @NotNull ExCommand cmd) throws ExException {
final String actionName = cmd.getArgument().trim();
final AnAction action = ActionManager.getInstance().getAction(actionName);
if (action == null) {
VimPlugin.showMessage("Action not found: " + actionName);
return false;
}
final Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode()) {
executeAction(action, context, actionName);
} else {
UiHelper.runAfterGotFocus(new Runnable() {
@Override
public void run() {
executeAction(action, context, actionName);
}
});
}
return true;
}
use of com.intellij.openapi.actionSystem.AnAction in project ideavim by JetBrains.
the class KeyHandler method executeAction.
/**
* Execute an action by name
*
* @param name The name of the action to execute
* @param context The context to run it in
*/
public static boolean executeAction(@NotNull String name, @NotNull DataContext context) {
ActionManager aMgr = ActionManager.getInstance();
AnAction action = aMgr.getAction(name);
return action != null && executeAction(action, context);
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class QuickChangeCodeStyleSchemeAction method fillActions.
@Override
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
final CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance(project);
if (manager.PER_PROJECT_SETTINGS != null) {
//noinspection HardCodedStringLiteral
group.add(new AnAction("<project>", "", manager.USE_PER_PROJECT_SETTINGS ? ourCurrentAction : ourNotCurrentAction) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
manager.USE_PER_PROJECT_SETTINGS = true;
}
});
}
CodeStyleScheme currentScheme = CodeStyleSchemes.getInstance().getCurrentScheme();
for (CodeStyleScheme scheme : CodeStyleSchemesImpl.getSchemeManager().getAllSchemes()) {
addScheme(group, manager, currentScheme, scheme, false);
}
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class AutoPopupController method setupListeners.
private void setupListeners() {
ActionManagerEx.getInstanceEx().addAnActionListener(new AnActionListener() {
@Override
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
cancelAllRequest();
}
@Override
public void beforeEditorTyping(char c, DataContext dataContext) {
cancelAllRequest();
}
@Override
public void afterActionPerformed(final AnAction action, final DataContext dataContext, AnActionEvent event) {
}
}, this);
IdeEventQueue.getInstance().addActivityListener(() -> cancelAllRequest(), this);
}
Aggregations