NativityControl nativityControl,
ContextMenuControlCallback contextMenuControlCallback) {
super(nativityControl, contextMenuControlCallback);
MessageListener getContextMenuItemsMessageListener =
new MessageListener(Constants.GET_CONTEXT_MENU_ITEMS) {
@Override
public NativityMessage onMessage(NativityMessage message) {
@SuppressWarnings("unchecked")
List<String> args = (List<String>)message.getValue();
List<ContextMenuItem> contextMenuItems = getContextMenuItems(
args.toArray(new String[args.size()]));
return new NativityMessage(
Constants.GET_CONTEXT_MENU_ITEMS, contextMenuItems);
}
};
nativityControl.registerMessageListener(
getContextMenuItemsMessageListener);
MessageListener fireContextMenuActionMessageListener =
new MessageListener(Constants.FIRE_CONTEXT_MENU_ACTION) {
public NativityMessage onMessage(NativityMessage message) {
@SuppressWarnings("unchecked")
Map<String, Object> map =
(Map<String, Object>)message.getValue();