< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m

Print this page
rev 51321 : bug fix and test
rev 51323 : warning and test

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -33,14 +33,14 @@
 #import "com_apple_eawt__AppMiscHandlers.h"
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
 #import "CPopupMenu.h"
+#import "CMenuBar.h"
 #import "ThreadUtilities.h"
 #import "NSApplicationAWT.h"
 
-
 #pragma mark App Menu helpers
 
 // The following is a AWT convention?
 #define PREFERENCES_TAG  42
 

@@ -822,5 +822,25 @@
         [ApplicationDelegate sharedDelegate].fDefaultMenuBar = menu;
     }];
 
 JNF_COCOA_EXIT(env);
 }
+
+/*
+ * Class:     com_apple_eawt__AppMenuBarHandler
+ * Method:    nativeActivateDefaultMenuBar
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eawt__1AppMenuBarHandler_nativeActivateDefaultMenuBar
+(JNIEnv *env, jclass clz, jlong cMenuBarPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    CMenuBar *menu = (CMenuBar *)jlong_to_ptr(cMenuBarPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        if (menu) {
+            [CMenuBar activate:menu modallyDisabled:NO];
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
< prev index next >