use of org.eclipse.che.ide.api.action.ActionEvent in project che by eclipse.
the class FindActionPresenter method onActionSelected.
@Override
public void onActionSelected(Action action) {
ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager, perspectiveManager.get());
action.update(e);
if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) {
view.hide();
action.actionPerformed(e);
}
}
use of org.eclipse.che.ide.api.action.ActionEvent in project che by eclipse.
the class MainMenuViewImpl method expandActionGroup.
private void expandActionGroup(List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) {
final Action[] children = mainActionGroup.getChildren(null);
for (final Action action : children) {
final Presentation presentation = presentationFactory.getPresentation(action);
final ActionEvent e = new ActionEvent(presentation, actionManager, managerProvider.get());
action.update(e);
if (presentation.isVisible()) {
// add only visible items
newVisibleActions.add(action);
}
if (action2barItem.containsKey(action)) {
action2barItem.get(action).update();
}
}
}
use of org.eclipse.che.ide.api.action.ActionEvent in project che by eclipse.
the class EmptyEditorsPanel method renderAction.
private Node renderAction(String title, final Action action) {
final Presentation presentation = presentationFactory.getPresentation(action);
Element divElement = Elements.createDivElement(style.listElement());
divElement.addEventListener("click", new EventListener() {
@Override
public void handleEvent(Event evt) {
ActionEvent event = new ActionEvent(presentation, actionManager, perspectiveManagerProvider.get());
action.actionPerformed(event);
}
}, true);
divElement.getStyle().setCursor("pointer");
divElement.getStyle().setColor(Style.getOutputLinkColor());
Element label = Elements.createDivElement(style.actionLabel());
label.setInnerText(title);
divElement.appendChild(label);
String hotKey = KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(action)));
if (hotKey == null) {
hotKey = " ";
} else {
hotKey = "<nobr> " + hotKey + " </nobr>";
}
SpanElement hotKeyElement = Elements.createSpanElement(style.hotKey());
hotKeyElement.setInnerHTML(hotKey);
divElement.appendChild(hotKeyElement);
return divElement;
}
use of org.eclipse.che.ide.api.action.ActionEvent in project che by eclipse.
the class StatusPanelGroupViewImpl method expandActionGroup.
private void expandActionGroup(List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) {
final Action[] children = mainActionGroup.getChildren(null);
for (final Action action : children) {
final Presentation presentation = presentationFactory.getPresentation(action);
final ActionEvent e = new ActionEvent(presentation, actionManager, perspectiveManager.get());
action.update(e);
if (presentation.isVisible()) {
// add only visible items
newVisibleActions.add(action);
}
if (action2barItem.containsKey(action)) {
action2barItem.get(action).update();
}
}
}
use of org.eclipse.che.ide.api.action.ActionEvent in project che by eclipse.
the class DebugConfigurationActionTest method shouldBeVisibleOnUpdate.
@Test
public void shouldBeVisibleOnUpdate() {
String confName = "test_conf";
when(debugConfiguration.getName()).thenReturn(confName);
DebugConfiguration configuration = mock(DebugConfiguration.class);
Optional<DebugConfiguration> configurationOptional = mock(Optional.class);
when(configurationOptional.isPresent()).thenReturn(Boolean.TRUE);
when(configurationOptional.get()).thenReturn(configuration);
when(debugConfigurationsManager.getCurrentDebugConfiguration()).thenReturn(configurationOptional);
ActionEvent event = mock(ActionEvent.class);
Presentation presentation = mock(Presentation.class);
when(event.getPresentation()).thenReturn(presentation);
action.updateInPerspective(event);
verify(presentation).setEnabledAndVisible(true);
}
Aggregations