summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsefftinge2008-10-31 08:16:06 (EDT)
committersefftinge2008-10-31 08:16:06 (EDT)
commit04709bba1213c26182995b5e769c4b929a70997e (patch)
tree87b9ee8c46520167cd1695bb247cb32d1b80ffb6
parent711470ef01a61551dae52358c9f44a0d57becce9 (diff)
downloadorg.eclipse.xpand-04709bba1213c26182995b5e769c4b929a70997e.zip
org.eclipse.xpand-04709bba1213c26182995b5e769c4b929a70997e.tar.gz
org.eclipse.xpand-04709bba1213c26182995b5e769c4b929a70997e.tar.bz2
configuration of thread local resource loader add
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java32
2 files changed, 23 insertions, 10 deletions
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
index 077e1e5..48308e1 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
@@ -17,3 +17,4 @@ Export-Package: org.eclipse.xtend.typesystem.emf,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.xtend.typesystem.emf.XtendTypesytemEmfPlugin
+Eclipse-BuddyPolicy: dependent
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
index da6dff0..1862745 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
@@ -30,6 +30,10 @@ import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.mwe.core.issues.Issues;
import org.eclipse.emf.mwe.core.issues.IssuesImpl;
import org.eclipse.emf.mwe.core.issues.MWEDiagnostic;
+import org.eclipse.emf.mwe.core.resources.ResourceLoader;
+import org.eclipse.emf.mwe.core.resources.ResourceLoaderDefaultImpl;
+import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory;
+import org.eclipse.emf.mwe.core.resources.ResourceLoaderImpl;
import org.eclipse.internal.xtend.xtend.ast.ExtensionFile;
import org.eclipse.xtend.check.CheckUtils;
import org.eclipse.xtend.expression.ExecutionContext;
@@ -148,16 +152,24 @@ public class CheckEValidatorAdapter implements EValidator {
private boolean runOawCheck(DiagnosticChain diagnostics, List<?> allElements) {
boolean isValid = true;
- for (CheckFileWithContext checkFile : _checkFiles) {
- Issues issues = new IssuesImpl();
- ResourceManager resourceManager = getResourceManager();
- ExtensionFile parsedCheckFile = (ExtensionFile) resourceManager
- .loadResource(checkFile.getFileName(),
- CheckUtils.FILE_EXTENSION);
- ExecutionContext executionContext = createExecutionContext(checkFile, resourceManager);
- runOawCheck(parsedCheckFile, allElements, diagnostics,
- executionContext);
- isValid &= issues.hasErrors();
+ ResourceLoader current = ResourceLoaderFactory.getCurrentThreadResourceLoader();
+ try {
+ ResourceLoaderFactory.setCurrentThreadResourceLoader(new ResourceLoaderImpl(getClass().getClassLoader()));
+ for (CheckFileWithContext checkFile : _checkFiles) {
+ Issues issues = new IssuesImpl();
+ ResourceManager resourceManager = getResourceManager();
+ ExtensionFile parsedCheckFile = (ExtensionFile) resourceManager
+ .loadResource(checkFile.getFileName(),
+ CheckUtils.FILE_EXTENSION);
+ if (parsedCheckFile==null)
+ throw new IllegalArgumentException("Couldn't find file "+checkFile.getFileName()+"."+CheckUtils.FILE_EXTENSION+". Maybe it has been misspelled or it's not on the classpath?");
+ ExecutionContext executionContext = createExecutionContext(checkFile, resourceManager);
+ runOawCheck(parsedCheckFile, allElements, diagnostics,
+ executionContext);
+ isValid &= issues.hasErrors();
+ }
+ } finally {
+ ResourceLoaderFactory.setCurrentThreadResourceLoader(current);
}
return isValid;
}