diff options
author | Lakshmi Shanmugam | 2022-02-07 17:44:16 +0000 |
---|---|---|
committer | Lakshmi P Shanmugam | 2022-02-11 10:51:10 +0000 |
commit | 6e854f668de186582a891e7c0071d41a1c9f1e5c (patch) | |
tree | 607c676a00dc9e11bfecccc3a4a7aa798b030202 | |
parent | 8d21781c6b65b49d2f30db28ada54be673b5925c (diff) | |
download | eclipse.platform.swt-6e854f668de186582a891e7c0071d41a1c9f1e5c.tar.gz eclipse.platform.swt-6e854f668de186582a891e7c0071d41a1c9f1e5c.tar.xz eclipse.platform.swt-6e854f668de186582a891e7c0071d41a1c9f1e5c.zip |
Bug 578406 - [MAC] DefaultApp.nib missing on Mac for recent macOS
SWT is not linked with JavaVM anymore. Get JavaVM bundle with path
instead of identifier.
Looks like DefaultApp.nib file in language specific folders is not
available in JavaVM Resources folder since macOS 11. So call
createMainMenu() in that case to create the Main menu with localized
strings.
Latest JDK too doesn't have the Resources/*.lproj folders, removed code
to check there.
Change-Id: I8fb75006902420a041caf4ce47e5427ad661dde9
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/190531
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Lakshmi P Shanmugam <lshanmug@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index d4cfb06e22..67f0ab8326 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -5659,12 +5659,16 @@ void applicationWillFinishLaunching (long id, long sel, long notification) { * /System/Library/..../Resources/en.lproj/DefaultApp.nib. */ NSString path; + boolean createMainMenu = false; NSDictionary dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner")); - NSBundle bundle = NSBundle.bundleWithIdentifier(NSString.stringWith("com.apple.JavaVM")); + NSBundle bundle = NSBundle.bundleWithPath(NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/")); if (bundle != null) { path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, languageDisplayName); if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith(languageISOValue)); - if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib")); + if (path == null) { + createMainMenu = !languageISOValue.equals("en"); + path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib")); + } if (!loaded) loaded = path != null && NSBundle.loadNibFile(path, dict, 0); if (!loaded) { path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith("English")); @@ -5672,11 +5676,10 @@ void applicationWillFinishLaunching (long id, long sel, long notification) { loaded = path != null && NSBundle.loadNibFile(path, dict, 0); } } - if (!loaded) { - path = NSString.stringWith(System.getProperty("java.home") + "/../Resources/English.lproj/DefaultApp.nib"); - loaded = path != null && NSBundle.loadNibFile(path, dict, 0); - } - if (!loaded) { + /* + * Create the main menu ourselves if Default.nib was not loaded or was not found for the specific language + */ + if (!loaded || createMainMenu) { createMainMenu(); } |