void (@NotNull AnActionEvent e) { Component originalComponent = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); Project project = e.getProject(); InputEvent inputEvent = e.getInputEvent(); Component component; if (inputEvent instanceof MouseEvent) { Component c = inputEvent.getComponent(); component = Objects.requireNonNullElse( UIUtil.getDeepestComponentAt(c, ((MouseEvent)inputEvent).getX(), ((MouseEvent)inputEvent).getY()), c); } else { component = originalComponent; } if (project == null || component == null) return; updateAllActions(project, component); }