Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java')
-rw-r--r--plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java b/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java
index d88f3f24..21840afb 100644
--- a/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java
+++ b/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATLResourceProvider.java
@@ -12,6 +12,8 @@ package org.eclipse.m2m.atl.common;
import java.net.URL;
+import org.eclipse.m2m.atl.common.internal.BundleUtil;
+
/**
* Provides common .ecore files:
* <ul>
@@ -25,6 +27,8 @@ import java.net.URL;
*/
public final class ATLResourceProvider {
+ private static final String BUNDLE_UTIL_IMPL = "org.eclipse.m2m.atl.common.internal.BundleUtilImpl"; //$NON-NLS-1$
+
private ATLResourceProvider() {
super();
}
@@ -37,7 +41,18 @@ public final class ATLResourceProvider {
* @return the URL of the resource matching the given name.
*/
public static URL getURL(String resourceName) {
- return ATLResourceProvider.class.getResource("resources/" + resourceName); //$NON-NLS-1$
+ try {
+ final BundleUtil bundleUtil = (BundleUtil)Class.forName(BUNDLE_UTIL_IMPL).newInstance();
+ return bundleUtil.getResource(resourceName);
+ } catch (InstantiationException e) {
+ ATLLogger.fine(e.getMessage());
+ } catch (IllegalAccessException e) {
+ ATLLogger.fine(e.getMessage());
+ } catch (ClassNotFoundException e) {
+ ATLLogger.fine(e.getMessage());
+ }
+ ATLLogger.info("Could not access OSGi bundle; falling back to native java resource resolution");
+ return ATLResourceProvider.class.getResource("/../model/" + resourceName); //$NON-NLS-1$
}
}

Back to the top