Loading EMF models from a resource within some plugin [message #561669] |
Tue, 11 November 2008 17:29 |
Steffen Zschaler Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm trying to use the code below to load a model from an ecore file that
resides in another plugin. This gets me an
StringIndexOutOfBoundsException. What could I be doing wrong?
EmfModel core = new EmfModel();
StringProperties properties = new StringProperties();
properties.put(EmfModel.PROPERTY_NAME, "Core");
properties.put(EmfModel.PROPERTY_IS_METAMODEL_FILE_BASED, "false");
properties.put(EmfModel.PROPERTY_METAMODEL_URI, EcorePackage.eNS_URI);
properties.put(EmfModel.PROPERTY_MODEL_FILE, "bundleentry://678/resources/core.ecore");
properties.put(EmfModel.PROPERTY_READONLOAD, "true");
properties.put(EmfModel.PROPERTY_STOREONDISPOSAL, "false");
core.load(properties, ResourcesPlugin.getWorkspace().getRoot()
.getRawLocation().toPortableString());
module.getContext().getModelRepository().addModel(core);
Note, I have adjusted the URL passed to PROPERTY_MODEL_FILE to the value
it actually has at runtime. In my real code this is being computed using
FileLocator.find. The Exception is thrown in the load() call. The file
does exist and the plugin has set that directory to be part of the
binary build.
What is the correct way of doing this?
Regards,
Steffen
--
Dr. rer. nat. Steffen Zschaler
Senior Research Associate
Lancaster University
Lancaster, United Kingdom
Email szschaler@acm.org
WWW http://www.steffen-zschaler.de/
--
Consider submitting to QoSA 2009, the 5th International Conference on
the Quality of Software-Architectures.
http://qosa.ipd.uka.de/
Consider submitting to MiSE 2009, the 3rd International Workshop on
Models in Software Engineering
http://wikiserver.sse.cs.tu-bs.de/mise09
|
|
|
Powered by
FUDForum. Page generated in 0.03032 seconds