final Object element = _displayables.elementAt(i);
if (element instanceof UnifiedSearchDemoEntity) {
final UnifiedSearchDemoEntity item =
(UnifiedSearchDemoEntity) element;
final UiAction action = item.getUiActions(null, null);
if (action != null) {
// Add the appropriate UiAction to the context menu
final MenuItem performActionItem =
new MenuItem(new StringProvider(action
.toString()), 0x230010, 0);
performActionItem.setCommand(new Command(
new CommandHandler() {
/**
* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public
void
execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
action.performAction(item);
}
}));
menu.addItem(performActionItem);
}
}