use of org.pentaho.ui.xul.components.XulMenuseparator in project pentaho-kettle by pentaho.
the class Spoon method removeMenuItem.
public void removeMenuItem(String itemid, boolean removeTrailingSeparators) {
XulMenuitem item = (XulMenuitem) mainSpoonContainer.getDocumentRoot().getElementById(itemid);
if (item != null) {
XulComponent menu = item.getParent();
item.getParent().removeChild(item);
if (removeTrailingSeparators) {
List<XulComponent> children = menu.getChildNodes();
if (children.size() > 0) {
XulComponent lastMenuItem = children.get(children.size() - 1);
if (lastMenuItem instanceof XulMenuseparator) {
menu.removeChild(lastMenuItem);
// the menu separators seem to not be modeled as individual objects in XUL
try {
Menu swtm = (Menu) menu.getManagedObject();
swtm.getItems()[swtm.getItemCount() - 1].dispose();
} catch (Throwable t) {
LogChannel.GENERAL.logError("Error removing XUL menu item", t);
}
}
}
}
} else {
log.logError("Could not find menu item with id " + itemid + " to remove from Spoon menu");
}
}
Aggregations