< prev index next >

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

Print this page
rev 54096 : 8259651: [macOS] Replace JNF_COCOA_ENTER/EXIT macros
rev 54098 : 8260616: Removing remaining JNF dependencies in the java.desktop module
8259729: Missed JNFInstanceOf -> IsInstanceOf conversion

*** 21,37 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ - #import <JavaNativeFoundation/JavaNativeFoundation.h> #import <JavaRuntimeSupport/JavaRuntimeSupport.h> #import "CMenu.h" #import "CMenuBar.h" #import "ThreadUtilities.h" #import "sun_lwawt_macosx_CMenu.h" @implementation CMenu --- 21,37 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #import <JavaRuntimeSupport/JavaRuntimeSupport.h> #import "CMenu.h" #import "CMenuBar.h" #import "ThreadUtilities.h" + #import "JNIUtilities.h" #import "sun_lwawt_macosx_CMenu.h" @implementation CMenu
*** 157,176 **** JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CMenu_nativeCreateSubMenu (JNIEnv *env, jobject peer, jlong parentMenu) { CMenu *aCMenu = nil; ! JNF_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); aCMenu = createCMenu (cPeerObjGlobal); // Add it to the parent menu [((CMenu *)jlong_to_ptr(parentMenu)) addJavaSubmenu: aCMenu]; ! JNF_COCOA_EXIT(env); return ptr_to_jlong(aCMenu); } --- 157,176 ---- JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CMenu_nativeCreateSubMenu (JNIEnv *env, jobject peer, jlong parentMenu) { CMenu *aCMenu = nil; ! JNI_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); aCMenu = createCMenu (cPeerObjGlobal); // Add it to the parent menu [((CMenu *)jlong_to_ptr(parentMenu)) addJavaSubmenu: aCMenu]; ! JNI_COCOA_EXIT(env); return ptr_to_jlong(aCMenu); }
*** 185,195 **** (JNIEnv *env, jobject peer, jlong parentMenuBar, jboolean isHelpMenu, jint insertLocation) { CMenu *aCMenu = nil; CMenuBar *parent = (CMenuBar *)jlong_to_ptr(parentMenuBar); ! JNF_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); aCMenu = createCMenu (cPeerObjGlobal); --- 185,195 ---- (JNIEnv *env, jobject peer, jlong parentMenuBar, jboolean isHelpMenu, jint insertLocation) { CMenu *aCMenu = nil; CMenuBar *parent = (CMenuBar *)jlong_to_ptr(parentMenuBar); ! JNI_COCOA_ENTER(env); jobject cPeerObjGlobal = (*env)->NewGlobalRef(env, peer); aCMenu = createCMenu (cPeerObjGlobal);
*** 201,211 **** // setHelpMenu() being called again. if (isHelpMenu == JNI_TRUE) { [parent javaSetHelpMenu: aCMenu]; } ! JNF_COCOA_EXIT(env); return ptr_to_jlong(aCMenu); } /* --- 201,211 ---- // setHelpMenu() being called again. if (isHelpMenu == JNI_TRUE) { [parent javaSetHelpMenu: aCMenu]; } ! JNI_COCOA_EXIT(env); return ptr_to_jlong(aCMenu); } /*
*** 215,228 **** */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeSetMenuTitle (JNIEnv *env, jobject peer, jlong menuObject, jstring label) { ! JNF_COCOA_ENTER(env); // Set the menu's title. ! [((CMenu *)jlong_to_ptr(menuObject)) setJavaMenuTitle:JNFJavaToNSString(env, label)]; ! JNF_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeAddSeparator --- 215,228 ---- */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeSetMenuTitle (JNIEnv *env, jobject peer, jlong menuObject, jstring label) { ! JNI_COCOA_ENTER(env); // Set the menu's title. ! [((CMenu *)jlong_to_ptr(menuObject)) setJavaMenuTitle:JavaStringToNSString(env, label)]; ! JNI_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeAddSeparator
*** 230,243 **** */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeAddSeparator (JNIEnv *env, jobject peer, jlong menuObject) { ! JNF_COCOA_ENTER(env); // Add a separator item. [((CMenu *)jlong_to_ptr(menuObject))addSeparator]; ! JNF_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeDeleteItem --- 230,243 ---- */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeAddSeparator (JNIEnv *env, jobject peer, jlong menuObject) { ! JNI_COCOA_ENTER(env); // Add a separator item. [((CMenu *)jlong_to_ptr(menuObject))addSeparator]; ! JNI_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeDeleteItem
*** 245,258 **** */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeDeleteItem (JNIEnv *env, jobject peer, jlong menuObject, jint index) { ! JNF_COCOA_ENTER(env); // Remove the specified item. [((CMenu *)jlong_to_ptr(menuObject)) deleteJavaItem: index]; ! JNF_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeGetNSMenu --- 245,258 ---- */ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CMenu_nativeDeleteItem (JNIEnv *env, jobject peer, jlong menuObject, jint index) { ! JNI_COCOA_ENTER(env); // Remove the specified item. [((CMenu *)jlong_to_ptr(menuObject)) deleteJavaItem: index]; ! JNI_COCOA_EXIT(env); } /* * Class: sun_lwawt_macosx_CMenu * Method: nativeGetNSMenu
*** 262,273 **** Java_sun_lwawt_macosx_CMenu_nativeGetNSMenu (JNIEnv *env, jobject peer, jlong menuObject) { NSMenu* nsMenu = NULL; ! JNF_COCOA_ENTER(env); // Strong retain this menu; it'll get released in Java_apple_laf_ScreenMenu_addMenuListeners nsMenu = [[((CMenu *)jlong_to_ptr(menuObject)) menu] retain]; ! JNF_COCOA_EXIT(env); return ptr_to_jlong(nsMenu); } --- 262,273 ---- Java_sun_lwawt_macosx_CMenu_nativeGetNSMenu (JNIEnv *env, jobject peer, jlong menuObject) { NSMenu* nsMenu = NULL; ! JNI_COCOA_ENTER(env); // Strong retain this menu; it'll get released in Java_apple_laf_ScreenMenu_addMenuListeners nsMenu = [[((CMenu *)jlong_to_ptr(menuObject)) menu] retain]; ! JNI_COCOA_EXIT(env); return ptr_to_jlong(nsMenu); }
< prev index next >