Skip to content
Snippets Groups Projects
Commit 78254333 authored by Nikolaus Huber's avatar Nikolaus Huber
Browse files

improved model instance loading

git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@12014 9e42b895-fcda-4063-8a3b-11be15eb1bbd
parent 7b483225
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ public abstract class AbstractEcoreModelLoader {
private static Logger logger = Logger.getLogger(AbstractEcoreModelLoader.class);
private ResourceSet resourceSet = null;
private URI currentUri = null;
private EObject loadedModel;
protected ResourceSet getResourceSet() {
if (resourceSet == null)
......@@ -46,9 +47,13 @@ public abstract class AbstractEcoreModelLoader {
* @throws IOException
*/
public EObject load(URI uri) {
if (null == uri) {
if (null == uri)
throw new IllegalArgumentException("Missing file URI.");
}
if (uri.equals(currentUri) && loadedModel != null)
return loadedModel;
// Resource resource = resourceSet.createResource(fileURI);
Resource resource = resourceSet.getResource(uri, true);
try {
......@@ -60,6 +65,7 @@ public abstract class AbstractEcoreModelLoader {
}
currentUri = uri;
EcoreUtil.resolveAll(resourceSet);
loadedModel = resource.getContents().get(0);
return resource.getContents().get(0);
}
......@@ -115,5 +121,4 @@ public abstract class AbstractEcoreModelLoader {
public URI getCurrentModelUri() {
return currentUri;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment