Java Code Examples for com.intellij.openapi.actionSystem.ex.ActionUtil#performActionDumbAware()
The following examples show how to use
com.intellij.openapi.actionSystem.ex.ActionUtil#performActionDumbAware() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Notification.java From consulo with Apache License 2.0 | 6 votes |
public static void fire(@Nonnull final Notification notification, @Nonnull AnAction action, @Nullable DataContext context) { AnActionEvent event = AnActionEvent.createFromAnAction(action, null, ActionPlaces.UNKNOWN, new DataContext() { @Nullable @Override @SuppressWarnings("unchecked") public <T> T getData(@Nonnull Key<T> dataId) { if (KEY == dataId) { return (T)notification; } return context == null ? null : context.getData(dataId); } }); if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) { ActionUtil.performActionDumbAware(action, event); } }
Example 2
Source File: IdeKeyEventDispatcher.java From consulo with Apache License 2.0 | 6 votes |
@Override public void performAction(@Nonnull InputEvent e, @Nonnull AnAction action, @Nonnull AnActionEvent actionEvent) { e.consume(); DataContext ctx = actionEvent.getDataContext(); if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(ctx)) { ActionGroup group = (ActionGroup)action; JBPopupFactory.getInstance().createActionGroupPopup(group.getTemplatePresentation().getText(), group, ctx, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false).showInBestPositionFor(ctx); } else { ActionUtil.performActionDumbAware(action, actionEvent); } if (Registry.is("actionSystem.fixLostTyping")) { IdeEventQueue.getInstance().doWhenReady(() -> IdeEventQueue.getInstance().getKeyEventDispatcher().resetState()); } }
Example 3
Source File: ActionButton.java From consulo with Apache License 2.0 | 6 votes |
private void actionPerformed(final AnActionEvent event) { if (myAction instanceof ActionGroup && !(myAction instanceof CustomComponentAction) && ((ActionGroup)myAction).isPopup() && !((ActionGroup)myAction).canBePerformed(event.getDataContext())) { final ActionManagerImpl am = (ActionManagerImpl)ActionManager.getInstance(); ActionPopupMenuImpl popupMenu = (ActionPopupMenuImpl)am.createActionPopupMenu(event.getPlace(), (ActionGroup)myAction, new MenuItemPresentationFactory() { @Override protected void processPresentation(Presentation presentation) { if (myNoIconsInPopup) { presentation.setIcon(null); presentation.setHoveredIcon(null); } } }); popupMenu.setDataContextProvider(this::getDataContext); if (event.isFromActionToolbar()) { popupMenu.getComponent().show(this, 0, getHeight()); } else { popupMenu.getComponent().show(this, getWidth(), 0); } } else { ActionUtil.performActionDumbAware(myAction, event); } }
Example 4
Source File: ContentTabLabel.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void execute(final MouseEvent e) { Optional<Runnable> first = myAdditionalIcons.stream().filter(icon -> mouseOverIcon(icon)).map(icon -> icon.getAction()).findFirst(); if (first.isPresent()) { first.get().run(); return; } selectContent(); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !myLayout.myDoubleClickActions.isEmpty()) { DataContext dataContext = DataManager.getInstance().getDataContext(ContentTabLabel.this); for (AnAction action : myLayout.myDoubleClickActions) { AnActionEvent event = AnActionEvent.createFromInputEvent(e, ActionPlaces.UNKNOWN, null, dataContext); if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) { ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(action, dataContext, event); ActionUtil.performActionDumbAware(action, event); } } } }
Example 5
Source File: ActionButton.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(final ActionEvent e) { AnActionEvent event = createAnEvent(null, e.getModifiers()); if (event != null && ActionUtil.lastUpdateAndCheckDumb(myAction, event, true)) { ActionUtil.performActionDumbAware(myAction, event); } }