Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » loading a genmodel
loading a genmodel [message #652597] Fri, 04 February 2011 16:15 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

using EcorePlugin.getEPackageNsURIToGenModelLocationMap()

I managed to get the URI of the genmodel of an ecore, and I get this URI
(simplified)

platform:/plugin/org.myproj/org/myproj/My.genmodel

then, I try to load the GenModel as follows:

ResourceSet resourceSet = model.eResource().getResourceSet();
Map<String, Object> extensionToFactoryMap =
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap();

if (!extensionToFactoryMap.containsKey("genmodel")) {
EcoreResourceFactoryImpl ecoreFactory = new EcoreResourceFactoryImpl();
extensionToFactoryMap.put("genmodel", ecoreFactory);
GenModelPackage.eINSTANCE.eClass();
}

Resource resource = resourceSet.getResource(uri, true);

but at this point I get an exception:

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
java.io.FileNotFoundException: /org/myproj/My.genmodel

am I doing something wrong? Or is it not possible to load a GenModel
from a plugin URI?

many thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: loading a genmodel [message #652665 is a reply to message #652597] Sat, 05 February 2011 00:39 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Lorenzo,

Comments below.

Lorenzo Bettini wrote:
> Hi
>
> using EcorePlugin.getEPackageNsURIToGenModelLocationMap()
>
> I managed to get the URI of the genmodel of an ecore, and I get this
> URI (simplified)
>
> platform:/plugin/org.myproj/org/myproj/My.genmodel
>
> then, I try to load the GenModel as follows:
>
> ResourceSet resourceSet = model.eResource().getResourceSet();
> Map<String, Object> extensionToFactoryMap =
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap();
>
> if (!extensionToFactoryMap.containsKey("genmodel")) {
> EcoreResourceFactoryImpl ecoreFactory = new
> EcoreResourceFactoryImpl();
> extensionToFactoryMap.put("genmodel", ecoreFactory);
> GenModelPackage.eINSTANCE.eClass();
> }
Are you doing this loading from an Equinox application or standalone?
You'd not need this normally.
>
> Resource resource = resourceSet.getResource(uri, true);
>
> but at this point I get an exception:
>
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> java.io.FileNotFoundException: /org/myproj/My.genmodel
>
> am I doing something wrong? Or is it not possible to load a GenModel
> from a plugin URI?
If you're doing this stand alone, you'll have to define URI mappings for
all the involved projects.
>
> many thanks in advance
> Lorenzo
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EObject#eSet and autoboxing
Next Topic:EContentAdapter on BPMN EMF model
Goto Forum:
  


Current Time: Thu Apr 25 13:57:07 GMT 2024

Powered by FUDForum. Page generated in 0.04330 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top