void (@NotNull AnActionEvent e) { Component component = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); if (component == null || !(SwingUtilities.getWindowAncestor(component) instanceof Frame)) { e.getPresentation().setEnabledAndVisible(false); return; } e.getPresentation().setEnabledAndVisible(true); }