Sure,
the code should be something like this:
private MenuHandler treeMenuHandler = new MenuHandler.Adapter() {
@Override
public boolean configureContextMenu(Component cmpnt, Menu menu, int
x, int y) {
TreeView tv = (TreeView) cmpnt;
final Tree.Path groupNodePath = tv.getNodeAt(y);
final int treeIndex = tv.getRowIndex(groupNodePath);
// Create the context menu
Menu.Section menuSection1 = new Menu.Section();
Menu.Section menuSection2 = new Menu.Section();
Menu.Item newCollectionMenuItem = new Menu.Item("New
collection");
Menu.Item renameCollectionMenuItem = new Menu.Item("Rename
collection");
Menu.Item removeCollectionMenuItem = new Menu.Item("Remove
collection");
if (treeIndex == 0) {
menuSection1.add(newCollectionMenuItem);
renameCollectionMenuItem.setEnabled(false);
removeCollectionMenuItem.setEnabled(false);
menuSection2.add(renameCollectionMenuItem);
menuSection2.add(removeCollectionMenuItem);
}
menu.getSections().add(menuSection1);
menu.getSections().add(menuSection2);
return false;
}
};
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/Disable-Menu-Item-tp2865710p2865996.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.