void (ActionEvent e) { // mimic AnAction event invocation to trigger myEverywhereAutoSet=false logic DataContext dataContext = DataManager.getInstance().getDataContext(component); KeyEvent inputEvent = new KeyEvent( component, KeyEvent.KEY_PRESSED, e.getWhen(), MnemonicHelper.getFocusAcceleratorKeyMask(), KeyEvent.getExtendedKeyCodeForChar(TOGGLE), TOGGLE); AnActionEvent event = AnActionEvent.createFromAnAction( ScopeChooserAction.this, inputEvent, ActionPlaces.TOOLBAR, dataContext); ActionUtil.performDumbAwareWithCallbacks(ScopeChooserAction.this, event, ScopeChooserAction.this::onProjectScopeToggled); }