use of org.eclipse.che.ide.api.action.Action in project che by eclipse.
the class KeyBindingManager method runActions.
/**
* Finds and runs an action cancelling original key event
*
* @param actionIds
* list containing action ids
* @param keyEvent
* original key event
*/
private void runActions(List<String> actionIds, Event keyEvent) {
for (String actionId : actionIds) {
Action action = actionManager.getAction(actionId);
if (action == null) {
continue;
}
ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager, perspectiveManager.get());
action.update(e);
if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) {
/** Stop handling the key event */
keyEvent.preventDefault();
keyEvent.stopPropagation();
/** Perform the action */
action.actionPerformed(e);
}
}
}
use of org.eclipse.che.ide.api.action.Action in project che by eclipse.
the class ActionManagerTest method shouldUnregister.
@Test
public void shouldUnregister() {
DefaultActionGroup defaultActionGroup = new DefaultActionGroup(actionManager);
actionManager.registerAction(IdeActions.GROUP_MAIN_MENU, defaultActionGroup);
actionManager.unregisterAction(IdeActions.GROUP_MAIN_MENU);
Action action = actionManager.getAction(IdeActions.GROUP_MAIN_MENU);
assertNull(action);
}
Aggregations