@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;
 }
 /**
  * Standard perform action extended by actually activated nodes.
  *
  * @param activatedNodes gives array of actually activated nodes.
  */
 protected void performAction(Node[] activatedNodes) {
   FormLayoutCookie layoutCookie =
       (FormLayoutCookie) activatedNodes[0].getCookie(FormLayoutCookie.class);
   if (layoutCookie != null) {
     org.openide.TopManager.getDefault()
         .getNodeOperation()
         .customize(layoutCookie.getLayoutNode());
   } else {
     RADComponentCookie nodeCookie =
         (RADComponentCookie) activatedNodes[0].getCookie(RADComponentCookie.class);
     if (nodeCookie != null) {
       if (nodeCookie.getRADComponent() instanceof RADVisualContainer) {
         RADVisualContainer container = (RADVisualContainer) nodeCookie.getRADComponent();
         org.openide.TopManager.getDefault()
             .getNodeOperation()
             .customize(container.getLayoutNodeReference());
       }
     }
   }
 }
 /*
  * In this method the enable / disable action logic can be defined.
  *
  * @param activatedNodes gives array of actually activated nodes.
  */
 protected boolean enable(Node[] activatedNodes) {
   if (super.enable(activatedNodes)) {
     FormLayoutCookie layoutCookie =
         (FormLayoutCookie) activatedNodes[0].getCookie(FormLayoutCookie.class);
     if (layoutCookie != null) {
       return layoutCookie.getLayoutNode().hasCustomizer();
     } else {
       RADComponentCookie nodeCookie =
           (RADComponentCookie) activatedNodes[0].getCookie(RADComponentCookie.class);
       if (nodeCookie != null) {
         if (nodeCookie.getRADComponent() instanceof RADVisualContainer) {
           RADVisualContainer container = (RADVisualContainer) nodeCookie.getRADComponent();
           return (container.getLayoutNodeReference() != null)
               && container.getLayoutNodeReference().hasCustomizer();
         }
       }
     }
   }
   return false;
 }