use of com.webobjects.foundation.NSBundle in project wonder-slim by undur.
the class ERXResourceManager method _initFrameworkProjectBundles.
private void _initFrameworkProjectBundles() {
NSBundle aBundle = null;
NSArray aFrameworkBundleList = NSBundle.frameworkBundles();
for (Enumeration aBundleEnumerator = aFrameworkBundleList.objectEnumerator(); aBundleEnumerator.hasMoreElements(); _erxCachedBundleForFrameworkNamed(aBundle.name())) {
aBundle = (NSBundle) aBundleEnumerator.nextElement();
}
}
use of com.webobjects.foundation.NSBundle in project wonder-slim by undur.
the class ERXResourceManager method _locateBundleForFrameworkNamed.
private static WODeployedBundle _locateBundleForFrameworkNamed(String aFrameworkName) {
WODeployedBundle aBundle = null;
aBundle = ERXDeployedBundle.deployedBundleForFrameworkNamed(aFrameworkName);
if (aBundle == null) {
NSBundle nsBundle = NSBundle.bundleForName(aFrameworkName);
if (nsBundle != null) {
aBundle = _bundleWithNSBundle(nsBundle);
}
}
return aBundle;
}
use of com.webobjects.foundation.NSBundle in project wonder-slim by undur.
the class ERXDeployedBundle method deployedBundleForFrameworkNamed.
public static synchronized WODeployedBundle deployedBundleForFrameworkNamed(String aFrameworkName) {
WODeployedBundle aBundle = null;
NSArray bundleArray = TheBundles.allValues();
int baCount = TheBundles.count();
NSBundle nsBundle = NSBundle.bundleForName(aFrameworkName);
if (nsBundle == null)
nsBundle = NSBundle.bundleWithPath(aFrameworkName);
if (nsBundle != null) {
int i = 0;
do {
if (i >= baCount)
break;
WODeployedBundle aFrameworkBundle = (WODeployedBundle) bundleArray.objectAtIndex(i);
if (nsBundle.equals(aFrameworkBundle.nsBundle())) {
aBundle = aFrameworkBundle;
WODeployedBundle dBundle = aBundle.projectBundle();
if (dBundle != null)
aBundle = dBundle;
break;
}
i++;
} while (true);
}
return aBundle;
}
use of com.webobjects.foundation.NSBundle in project wonder-slim by undur.
the class WOExceptionPage method sourceFileContainingError.
/**
* @return The source file where the exception originated (from the last line of the stack trace).
*/
private Path sourceFileContainingError() {
String nameOfThrowingClass = firstLineOfTrace().packageClassPath();
NSBundle bundle = bundleForClassName(nameOfThrowingClass);
if (bundle == null) {
return null;
}
String path = null;
if (NSBundle.mainBundle().getClass().getName().contains("NSMavenProjectBundle")) {
// FIXME: We should probably be referencing the real class once that exists again // Hugi 2021-05-21
path = bundle.bundlePath() + pathModifier + "/src/main/java/" + nameOfThrowingClass.replace(".", "/") + ".java";
} else {
path = bundle.bundlePath() + pathModifier + "/Sources/" + nameOfThrowingClass.replace(".", "/") + ".java";
}
return Paths.get(path);
}
use of com.webobjects.foundation.NSBundle in project wonder-slim by undur.
the class ERXLocalizer method frameworkSearchPath.
public static NSArray<String> frameworkSearchPath() {
if (frameworkSearchPath == null) {
frameworkSearchPath = ERXProperties.arrayForKey("er.extensions.ERXLocalizer.frameworkSearchPath");
if (frameworkSearchPath == null) {
NSMutableArray<String> defaultValue = new NSMutableArray<>();
for (Enumeration<NSBundle> e = NSBundle.frameworkBundles().objectEnumerator(); e.hasMoreElements(); ) {
NSBundle bundle = e.nextElement();
String name = bundle.name();
// Check the Properties and Add it Automatically
String propertyName = "er.extensions." + name + ".hasLocalization";
boolean hasLocalization = ERXProperties.booleanForKeyWithDefault(propertyName, true);
if (name.equals("ERCoreBusinessLogic") || name.equals("ERDirectToWeb") || name.equals("ERExtensions")) {
// || name.startsWith("Java")
// do nothing yet, because will add later
} else if (hasLocalization) {
defaultValue.addObject(name);
}
}
if (NSBundle.bundleForName("ERCoreBusinessLogic") != null)
defaultValue.addObject("ERCoreBusinessLogic");
if (NSBundle.bundleForName("ERDirectToWeb") != null)
defaultValue.addObject("ERDirectToWeb");
if (NSBundle.bundleForName("ERExtensions") != null)
defaultValue.addObject("ERExtensions");
defaultValue.insertObjectAtIndex("app", 0);
frameworkSearchPath = defaultValue;
}
if (log.isDebugEnabled())
log.debug("FrameworkSearchPath: {}", frameworkSearchPath.componentsJoinedByString(" / "));
}
return frameworkSearchPath;
}
Aggregations