public void execute(Event<UIGadgetManagement> event) throws Exception
{
UIGadgetManagement uiManagement = event.getSource();
WebuiRequestContext ctx = event.getRequestContext();
String name = ctx.getRequestParameter(OBJECTID);
GadgetRegistryService service = uiManagement.getApplicationComponent(GadgetRegistryService.class);
if (service.getGadget(name) == null)
{
uiManagement.reload();
ctx.addUIComponentToUpdateByAjax(uiManagement);
return;
}
UIGadgetEditor uiEditor = uiManagement.getChild(UIGadgetEditor.class);
if (uiEditor != null)
{
Source source = uiEditor.getSource();
if (source != null && name.equals(uiEditor.getSourceName()))
{
UIApplication uiApp = ctx.getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIGadgetManagement.msg.deleteGadgetInUse", null));
return;
}
}
service.removeGadget(name);
WebAppController webController = uiManagement.getApplicationComponent(WebAppController.class);
webController.removeApplication(GadgetApplication.EXO_GADGET_GROUP + "/" + name);
Gadget gadget = uiManagement.getGadget(name);
if (gadget.isLocal())
{