@Override protected void performAction(Node[] nodes) { if (nodes != null && nodes.length == 1) { RADComponentCookie radCookie = nodes[0].getCookie(RADComponentCookie.class); RADComponent comp = (radCookie != null) ? radCookie.getRADComponent() : null; if (comp != null) { RADComponent topComp = comp.getFormModel().getTopRADComponent(); if (topComp != comp && EditContainerAction.isEditableComponent(topComp)) { FormDesigner designer = getDesigner(topComp); if (designer != null && topComp != designer.getTopDesignComponent()) { designer.setTopDesignComponent((RADVisualComponent) topComp, true); designer.requestActive(); // NodeAction is quite unreliable in enabling, do it ourselves for sure Node[] n = new Node[] {topComp.getNodeReference()}; if (n[0] != null) { EditContainerAction.reenable(n); DesignParentAction.reenable(n); EditFormAction.reenable(n); } } } } } }
@Override protected boolean enable(Node[] nodes) { boolean ret = false; if (nodes != null && nodes.length == 1) { RADComponentCookie radCookie = nodes[0].getCookie(RADComponentCookie.class); RADComponent comp = (radCookie != null) ? radCookie.getRADComponent() : null; if (comp != null) { RADComponent topComp = comp.getFormModel().getTopRADComponent(); if (comp != topComp && EditContainerAction.isEditableComponent(topComp)) { FormDesigner designer = getDesigner(comp); if (designer != null && comp == designer.getTopDesignComponent()) { ret = true; } } } } return ret; }
private static FormDesigner getDesigner(RADComponent comp) { return FormEditor.getFormDesigner(comp.getFormModel()); }