org.eclipse.che.ide.api.action.ActionEvent.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.eclipse.che.ide.api.action.ActionEvent.<init>()方法的一些代码示例,展示了ActionEvent.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionEvent.<init>()方法的具体详情如下:
包路径:org.eclipse.che.ide.api.action.ActionEvent
类名称:ActionEvent
方法名:<init>

ActionEvent.<init>介绍

[英]Create new action event.
[中]创建新的操作事件。

代码示例

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
 public void handleEvent(Event evt) {
  ActionEvent event = new ActionEvent(presentation, actionManager);
  action.actionPerformed(event);
 }
},

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

/** @return true when at list one item from list of menu items has selected state. */
private boolean hasCheckedItems() {
 return list.stream()
   .filter(action -> action instanceof ToggleAction)
   .map(action -> (ToggleAction) action)
   .anyMatch(
     action ->
       action.isSelected(
         new ActionEvent(presentationFactory.getPresentation(action), actionManager)));
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

/** Mouse Click handler. */
@Override
public void onClick(ClickEvent event) {
 if (!enabled) {
  return;
 }
 // todo handle popup group
 ActionEvent e = new ActionEvent(presentation, actionManager);
 if (action instanceof ActionGroup
   && !(action instanceof CustomComponentAction)
   && ((ActionGroup) action).isPopup()) {
 } else {
  action.actionPerformed(e);
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

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);
  action.update(e);
  if (presentation.isVisible()) { // add only visible items
   newVisibleActions.add(action);
  }
  if (action2barItem.containsKey(action)) {
   action2barItem.get(action).update();
  }
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

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);
  action.update(e);
  if (presentation.isVisible()) { // add only visible items
   newVisibleActions.add(action);
  }
  if (action2barItem.containsKey(action)) {
   action2barItem.get(action).update();
  }
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void performAction(String actionId, Map<String, String> parameters) {
 final Action action;
 if (actionId != null && (action = getAction(actionId)) != null) {
  final Presentation presentation = presentationFactory.getPresentation(action);
  final ActionEvent actionEvent = new ActionEvent(presentation, this, parameters);
  action.update(actionEvent);
  if (presentation.isEnabled() && presentation.isVisible()) {
   action.actionPerformed(actionEvent);
  }
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

ActionManager actionManager) {
Presentation presentation = presentationFactory.getPresentation(group);
ActionEvent event = new ActionEvent(presentation, actionManager);
 child.update(new ActionEvent(presentation, actionManager));

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

/** Handle Mouse Click */
private void onRowClicked(Element tr) {
 if (isRowDisabled(tr) || tr == subPopupAnchor) {
  return;
 }
 int itemIndex = Integer.parseInt(tr.getAttribute("item-index"));
 Action menuItem = list.get(itemIndex);
 if (menuItem instanceof ActionGroup
   && (!((ActionGroup) menuItem).canBePerformed()
     && Utils.hasVisibleChildren(
       (ActionGroup) menuItem, presentationFactory, actionManager))) {
  openSubPopup(tr);
 } else {
  if (actionSelectedHandler != null) {
   actionSelectedHandler.onActionSelected(menuItem);
  }
  ActionEvent e = new ActionEvent(presentationFactory.getPresentation(menuItem), actionManager);
  menuItem.actionPerformed(e);
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void onItemClicked(@NotNull EditorPaneMenuItem<Action> item) {
 editorPaneMenu.hide();
 final Action action = item.getData();
 final Presentation presentation = presentationFactory.getPresentation(action);
 presentation.putClientProperty(CURRENT_PANE_PROP, EditorPartStackPresenter.this);
 final PartPresenter activePart = getActivePart();
 final TabItem tab = getTabByPart(activePart);
 if (tab != null) {
  final VirtualFile virtualFile = ((EditorTab) tab).getFile();
  // pass into action file property and editor tab
  presentation.putClientProperty(CURRENT_TAB_PROP, tab);
  presentation.putClientProperty(CURRENT_FILE_PROP, virtualFile);
 }
 action.actionPerformed(new ActionEvent(presentation, actionManager, null));
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void onActionSelected(Action action) {
 ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager);
 action.update(e);
 if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) {
  view.hide();
  action.actionPerformed(e);
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

ActionEvent event = new ActionEvent(factory.getPresentation(group), actionManager);
for (Action anAction : group.getChildren(event)) {
 if (anAction == null) {
 anAction.update(new ActionEvent(presentation, actionManager));
 if (anAction instanceof ActionGroup) {
  ActionGroup childGroup = (ActionGroup) anAction;

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

/**
 * 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);
  action.update(e);
  if (e.getPresentation().isEnabled()) {
   /** Stop handling the key event */
   keyEvent.preventDefault();
   keyEvent.stopPropagation();
   /** Perform the action */
   action.actionPerformed(e);
  }
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-client

private void handleKey(NativeEvent event) {
  SignalEvent signalEvent = SignalEventUtils.create((Event) event, false);
  CharCodeWithModifiers keyBinding =
    keyBindingAgent.getKeyBinding(JavaExtension.JAVA_CLASS_STRUCTURE);
  if (signalEvent == null || keyBinding == null) {
   return;
  }
  int digest = CharCodeWithModifiers.computeKeyDigest(signalEvent);
  if (digest == keyBinding.getKeyDigest()) {
   Action action = actionManager.getAction(JavaExtension.JAVA_CLASS_STRUCTURE);
   if (action != null) {
    ActionEvent e = new ActionEvent(presentationFactor.getPresentation(action), actionManager);
    action.update(e);

    if (e.getPresentation().isEnabled()) {
     event.preventDefault();
     event.stopPropagation();
     action.actionPerformed(e);
    }
   }
  }
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

ToggleAction toggleAction = (ToggleAction) menuItem;
ActionEvent e =
  new ActionEvent(presentationFactory.getPresentation(toggleAction), actionManager);

相关文章

微信公众号

最新文章

更多