FBMenuItem item = event.getMenuItem();
saveMenuItem(event.getGroupName(), item);
if (item instanceof CustomMenuItem) {
CustomMenuItem customItem = (CustomMenuItem) item;
String formItemName = customItem.getOptionName();
FormItemRepresentation formItem = customItem.getRepresentation();
saveFormItem(formItem, formItemName);
}
}
});
//registered to delete the menu items
bus.addHandler(MenuItemRemoveEvent.TYPE, new MenuItemRemoveHandler() {
@Override
public void onEvent(MenuItemRemoveEvent event) {
FBMenuItem item = event.getMenuItem();
deleteMenuItem(event.getGroupName(), item);
if (item instanceof CustomMenuItem) {
CustomMenuItem customItem = (CustomMenuItem) item;
String formItemName = customItem.getOptionName();
FormItemRepresentation formItem = customItem.getRepresentation();
deleteFormItem(formItemName, formItem);
}
}
});
}