// TODO do we really want all these types referenced here?
if (w instanceof SeparatorToolItem) {
menu.add(new SeparatorMenuItem());
} else if (w instanceof SplitButton) {
final SplitButton sb = (SplitButton) w;
MenuItem item = new MenuItem(sb.getText(), sb.getIcon());
item.setEnabled(sb.isEnabled());
item.setItemId(sb.getItemId());
if (sb.getData("gxt-menutext") != null) {
item.setText(sb.getData("gxt-menutext").toString());
}
if (sb.getMenu() != null) {
item.setSubMenu(sb.getMenu());
}
item.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
sb.fireEvent(new SelectEvent());
}
});
menu.add(item);
} else if (w instanceof TextButton) {