MenuItem createItem = UIFactory.createMenuItem( ActionRegistry.NEW_FOLDER );
createItem.setEnableIfCondition( new MenuItemIfFunction() {
public boolean execute( Canvas target, Menu menu, MenuItem item ) {
IGWTFolder folder = GWTUtil.getGwtFolder( (TreeNode) tree.getSelectedRecord() );
return folder.isCreateSubfolderSupported();
}
} );
MenuItem deleteItem = UIFactory.createMenuItem( ActionRegistry.DELETE_FOLDER );
deleteItem.setEnableIfCondition( new MenuItemIfFunction() {
public boolean execute( Canvas target, Menu menu, MenuItem item ) {
IGWTFolder folder = GWTUtil.getGwtFolder( (TreeNode) tree.getSelectedRecord() );
return folder.isDeleteSupported();
}
} );
MenuItem emptyItem = UIFactory.createMenuItem( ActionRegistry.EMPTY_FOLDER );
emptyItem.setEnableIfCondition( new MenuItemIfFunction() {
public boolean execute( Canvas target, Menu menu, MenuItem item ) {
IGWTFolder folder = GWTUtil.getGwtFolder( (TreeNode) tree.getSelectedRecord() );
return folder.isEmptySupported();
}
} );
contextMenu.setItems( createItem, deleteItem, emptyItem );