Module (@NotNull AnActionEvent e) { Object selected = e.getData(SELECTED_ITEM); if (selected instanceof Module) { return (Module)selected; } else if (selected instanceof Facet<?>) { return ((Facet<?>)selected).getModule(); } else return null; }