1 /*******************************************************************************
2  * Copyright (c) 2000, 2019 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *    IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15 
16 public class NSBundle extends NSObject {
17 
NSBundle()18 public NSBundle() {
19 	super();
20 }
21 
NSBundle(long id)22 public NSBundle(long id) {
23 	super(id);
24 }
25 
NSBundle(id id)26 public NSBundle(id id) {
27 	super(id);
28 }
29 
loadNibFile(NSString fileName, NSDictionary context, long zone)30 public static boolean loadNibFile(NSString fileName, NSDictionary context, long zone) {
31 	return OS.objc_msgSend_bool(OS.class_NSBundle, OS.sel_loadNibFile_externalNameTable_withZone_, fileName != null ? fileName.id : 0, context != null ? context.id : 0, zone);
32 }
33 
bundleIdentifier()34 public NSString bundleIdentifier() {
35 	long result = OS.objc_msgSend(this.id, OS.sel_bundleIdentifier);
36 	return result != 0 ? new NSString(result) : null;
37 }
38 
bundlePath()39 public NSString bundlePath() {
40 	long result = OS.objc_msgSend(this.id, OS.sel_bundlePath);
41 	return result != 0 ? new NSString(result) : null;
42 }
43 
bundleWithIdentifier(NSString identifier)44 public static NSBundle bundleWithIdentifier(NSString identifier) {
45 	long result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_bundleWithIdentifier_, identifier != null ? identifier.id : 0);
46 	return result != 0 ? new NSBundle(result) : null;
47 }
48 
bundleWithPath(NSString path)49 public static NSBundle bundleWithPath(NSString path) {
50 	long result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_bundleWithPath_, path != null ? path.id : 0);
51 	return result != 0 ? new NSBundle(result) : null;
52 }
53 
infoDictionary()54 public NSDictionary infoDictionary() {
55 	long result = OS.objc_msgSend(this.id, OS.sel_infoDictionary);
56 	return result != 0 ? new NSDictionary(result) : null;
57 }
58 
mainBundle()59 public static NSBundle mainBundle() {
60 	long result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_mainBundle);
61 	return result != 0 ? new NSBundle(result) : null;
62 }
63 
objectForInfoDictionaryKey(NSString key)64 public id objectForInfoDictionaryKey(NSString key) {
65 	long result = OS.objc_msgSend(this.id, OS.sel_objectForInfoDictionaryKey_, key != null ? key.id : 0);
66 	return result != 0 ? new id(result) : null;
67 }
68 
pathForResource(NSString name, NSString ext)69 public NSString pathForResource(NSString name, NSString ext) {
70 	long result = OS.objc_msgSend(this.id, OS.sel_pathForResource_ofType_, name != null ? name.id : 0, ext != null ? ext.id : 0);
71 	return result != 0 ? new NSString(result) : null;
72 }
73 
pathForResource(NSString name, NSString ext, NSString subpath, NSString localizationName)74 public NSString pathForResource(NSString name, NSString ext, NSString subpath, NSString localizationName) {
75 	long result = OS.objc_msgSend(this.id, OS.sel_pathForResource_ofType_inDirectory_forLocalization_, name != null ? name.id : 0, ext != null ? ext.id : 0, subpath != null ? subpath.id : 0, localizationName != null ? localizationName.id : 0);
76 	return result != 0 ? new NSString(result) : null;
77 }
78 
79 }
80