/**
* @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
*/
public Object execute( Object thiz, Object[] args ) throws Exception {
MenuItemObject menuItem = (MenuItemObject) args[ 0 ];
if( !( (Boolean) menuItem.getField( MenuItemObject.FIELD_ISSEPARATOR ) ).booleanValue() ) {
// Get the screen that currently owns the BrowserField
MainScreen screen = (MainScreen) MenuExtension.getBrowserField().getScreen();
MenuItem defaultItem = screen.getDefaultMenuItem( Menu.INSTANCE_DEFAULT );
if( defaultItem == null ) {
menuItem.setPriority( Integer.MAX_VALUE );
} else {
menuItem.setPriority( defaultItem.getPriority() - 1 );
}
}
return UNDEFINED;
}