use of com.intellij.openapi.actionSystem.ActionManager in project intellij-community by JetBrains.
the class AntToolwindowRegistrar method projectOpened.
@Override
public void projectOpened() {
final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
final String prefix = AntConfiguration.getActionIdPrefix(myProject);
final ActionManager actionManager = ActionManager.getInstance();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
for (String id : keymap.getActionIdList()) {
if (id.startsWith(prefix) && actionManager.getAction(id) == null) {
actionManager.registerAction(id, new TargetActionStub(id, myProject));
}
}
}
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
compilerManager.addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
final AntConfiguration config = AntConfiguration.getInstance(myProject);
((AntConfigurationBase) config).ensureInitialized();
return config.executeTargetBeforeCompile(createDataContext(context));
}
});
compilerManager.addAfterTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
final AntConfigurationBase config = (AntConfigurationBase) AntConfiguration.getInstance(myProject);
config.ensureInitialized();
if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
final AntBuildTarget target = config.getTargetForEvent(ExecuteAfterCompilationEvent.getInstance());
if (target != null) {
context.addMessage(CompilerMessageCategory.INFORMATION, "Skipping ant target \"" + target.getDisplayName() + "\" because of compilation errors", null, -1, -1);
}
return true;
}
return config.executeTargetAfterCompile(createDataContext(context));
}
});
}
use of com.intellij.openapi.actionSystem.ActionManager in project intellij-community by JetBrains.
the class AddMultipleFilesOptionsDialog method createToolbar.
private JComponent createToolbar() {
ActionManager actionManager = ActionManager.getInstance();
DefaultActionGroup group = new DefaultActionGroup();
group.add(new SelectAllAction());
group.add(new UnselectAllAction());
return actionManager.createActionToolbar(CvsActionPlaces.ADD_FILES_TOOLBAR, group, true).getComponent();
}
use of com.intellij.openapi.actionSystem.ActionManager in project intellij-community by JetBrains.
the class MacGestureAdapter method swipedLeft.
@Override
public void swipedLeft(SwipeEvent event) {
ActionManager actionManager = ActionManager.getInstance();
AnAction forward = actionManager.getAction("Forward");
if (forward == null)
return;
actionManager.tryToExecute(forward, createMouseEventWrapper(myFrame), null, null, false);
}
use of com.intellij.openapi.actionSystem.ActionManager 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.ActionManager 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