public static NSBundle bundleWithPath(NSString path) { long /*int*/ result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_bundleWithPath_, path != null ? path.id : 0); return result != 0 ? new NSBundle(result) : null; }
boolean isBundled () { NSBundle mainBundle = NSBundle.mainBundle(); if (mainBundle != null) { NSDictionary info = mainBundle.infoDictionary(); if (info != null) { return NSString.stringWith("APPL").isEqual(info.objectForKey(NSString.stringWith("CFBundlePackageType"))); //$NON-NLS-1$ $NON-NLS-2$ } } return false; }
NSBundle bundle = NSBundle.bundleWithIdentifier(NSString.stringWith("com.apple.JavaVM")); NSDictionary dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner")); NSString 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 (!loaded) loaded = path != null && NSBundle.loadNibFile(path, dict, 0); if (!loaded) { NSString resourcePath = bundle.resourcePath(); path = resourcePath != null ? resourcePath.stringByAppendingString(NSString.stringWith("/English.lproj/DefaultApp.nib")) : null; loaded = path != null && NSBundle.loadNibFile(path, dict, 0); loaded = path != null && NSBundle.loadNibFile(path, dict, 0);
static Program getProgram(NSBundle bundle) { NSString CFBundleName = NSString.stringWith("CFBundleName"); NSString CFBundleDisplayName = NSString.stringWith("CFBundleDisplayName"); NSString fullPath = bundle.bundlePath(); NSString identifier = bundle.bundleIdentifier(); id bundleName = bundle.objectForInfoDictionaryKey(CFBundleDisplayName); if (bundleName == null) { bundleName = bundle.objectForInfoDictionaryKey(CFBundleName); } if (bundleName == null) { if (fullPath == null) return null; bundleName = fullPath.lastPathComponent().stringByDeletingPathExtension(); } NSString name = new NSString(bundleName.id); Program program = new Program(); program.name = name.getString(); if (fullPath != null) program.fullPath = fullPath.getString(); program.identifier = identifier != null ? identifier.getString() : ""; return program; }
static NSString getApplicationName() { NSString name = null; int pid = OS.getpid (); long /*int*/ ptr = OS.getenv (ascii ("APP_NAME_" + pid)); if (ptr != 0) name = NSString.stringWithUTF8String(ptr); if (name == null && APP_NAME != null) name = NSString.stringWith(APP_NAME); if (name == null) { id value = NSBundle.mainBundle().objectForInfoDictionaryKey(NSString.stringWith("CFBundleName")); if (value != null) { name = new NSString(value); } } if (name == null) { String macAppName = System.getProperty("com.apple.mrj.application.apple.menu.about.name"); if (macAppName != null) name = NSString.stringWith(macAppName); } if (name == null) name = NSString.stringWith("SWT"); return name; }
NSString fullPath = path.stringByAppendingPathComponent(filePath); if (workspace.isFilePackageAtPath(fullPath)) { NSBundle bundle = NSBundle.bundleWithPath(fullPath); id = bundle != null ? bundle.infoDictionary().objectForKey(CFBundleDocumentTypes) : null; if (id != null) { NSDictionary documentTypes = new NSDictionary(id.id);
if (url != 0) { NSString bundlePath = new NSURL(url).path(); NSBundle bundle = NSBundle.bundleWithPath(bundlePath); if (bundle != null) program = getProgram(bundle); OS.CFRelease(url);
NSString fullPath = path.stringByAppendingPathComponent(new NSString(id.id)); if (workspace.isFilePackageAtPath(fullPath)) { NSBundle bundle = NSBundle.bundleWithPath(fullPath); if (bundle != null) { Program program = getProgram(bundle);
public static NSBundle bundleWithIdentifier(NSString identifier) { long /*int*/ result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_bundleWithIdentifier_, identifier != null ? identifier.id : 0); return result != 0 ? new NSBundle(result) : null; }
public static NSBundle mainBundle() { long /*int*/ result = OS.objc_msgSend(OS.class_NSBundle, OS.sel_mainBundle); return result != 0 ? new NSBundle(result) : null; }