void (@NotNull AnActionEvent e) { final LookupEx lookup; if (myInput instanceof EditorTextField) { lookup = LookupManager.getActiveLookup(((EditorTextField)myInput).getEditor()); } else if (myInput instanceof EditorComponentImpl) { lookup = LookupManager.getActiveLookup(((EditorComponentImpl)myInput).getEditor()); } else { lookup = null; } JComboBox comboBox = UIUtil.findComponentOfType(myInput, JComboBox.class); boolean popupMenuVisible = comboBox != null && comboBox.isPopupVisible(); e.getPresentation().setEnabled(lookup == null && !popupMenuVisible); }