void (@NotNull AnActionEvent e) { IdeFocusManager focusManager = IdeFocusManager.getInstance(myEditor.getProject()); AnActionEvent delegateEvent = AnActionEvent.createFromAnAction(getDelegate(), e.getInputEvent(), ActionPlaces.EDITOR_INSPECTIONS_TOOLBAR, myEditor.getDataContext()); if (focusManager.getFocusOwner() != myEditor.getContentComponent()) { focusManager.requestFocus(myEditor.getContentComponent(), true). doWhenDone(() -> getDelegate().actionPerformed(delegateEvent)); } else { getDelegate().actionPerformed(delegateEvent); } }