void (@NotNull GuiEditor editor, final ArrayList<? extends RadComponent> input, final AnActionEvent e) { List<RadComponent> selection = FormEditingUtil.remapToActionTargets(input); final RadContainer parent = FormEditingUtil.getSelectionParent(selection); e.getPresentation().setEnabled(parent != null && (parent.getLayoutManager().isGrid() || parent.getLayoutManager().isIndexed())); // The action is enabled in any of the following cases: // 1) a single component is selected; // 2) all selected components have rowspan=1 // 3) all selected components have the same row and rowspan if (selection.size() > 1 && parent != null && parent.getLayoutManager().isGrid()) { e.getPresentation().setEnabled(canDuplicate(selection, true) || canDuplicate(selection, false)); } }