changeset 6852:aae9bf983254

RT-25570: [Menus, Mac] Mac OS : Menu.disable property is ignored when menu items are first initialized in the menu.onMenuValidation method Summary: Force the initialization of NSMenu instances for submenus Reviewed-by: pchelko, snorthov
author Anthony Petrov <anthony.petrov@oracle.com>
date Tue, 22 Apr 2014 21:35:04 +0400
parents 812c4260e98c
children ae1408a0cf50
files modules/graphics/src/main/native-glass/mac/GlassMenu.m
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/native-glass/mac/GlassMenu.m	Tue Apr 22 09:36:36 2014 -0700
+++ b/modules/graphics/src/main/native-glass/mac/GlassMenu.m	Tue Apr 22 21:35:04 2014 +0400
@@ -88,6 +88,9 @@
                                                                    keyEquivalent:@""];
         [self->item setEnabled:(BOOL)jenabled];
         [self->item setTarget:self];
+
+        self->menu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:[self->item title]];
+        [self->menu setDelegate: self];
     }
     return self;
 }
@@ -162,7 +165,7 @@
 }
 
 
-- (void)menuWillOpen: (NSMenu *)menu
+- (void)menuNeedsUpdate: (NSMenu *)menu
 {
     GET_MAIN_JENV;
     if (env != NULL)
@@ -194,7 +197,7 @@
         (*env)->CallVoidMethod(env, self->jCallback, jMenuValidateMethod, NULL);
 
         return ([glassTargetItem->item isEnabled]);
-    } 
+    }
     return YES;
 }
 
@@ -432,11 +435,6 @@
     GLASS_POOL_ENTER;
     {
         GlassMenu *menu = (GlassMenu *)jlong_to_ptr(jMenuPtr);
-        if (menu->menu == nil)
-        {
-            menu->menu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:[menu->item title]];
-            [menu->menu setDelegate: menu];
-        }
 
         if (jSubmenuPtr != 0)
         {