Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » RE: Register Metamodel
RE: Register Metamodel [message #417882] Thu, 27 March 2008 20:42 Go to next message
Mark Melia is currently offline Mark MeliaFriend
Messages: 142
Registered: July 2009
Senior Member
Hi all,

Does anyone know whether it is possible to register a metamodel within the
same project. I have 3 ecore models A, B, and C. B and C are
implementations of A. They all are in the same project (an ATL project),
but I cant open the B and C because I get a PackageNotFoundException as
the models B and C cannot find the metamodel's URI.

I used to solve this using AM3's register metamodel functionality, but I
am now using Eclipse 3.4 and AM3 is not working with 3.4.

Anybody have any ideas?
Mark
Re: Register Metamodel [message #417884 is a reply to message #417882] Thu, 27 March 2008 20:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Mark,

EMF normally generates a registration for each package like this:

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "uri://sample221352"
class = "sample221352.Sample221352Package"
genModel = "model/My.genmodel" />

This makes them visible in EPackage.Registry.INSTANCE. You'd need one
for each of your three models...


Mark Melia wrote:
> Hi all,
>
> Does anyone know whether it is possible to register a metamodel within
> the same project. I have 3 ecore models A, B, and C. B and C are
> implementations of A. They all are in the same project (an ATL
> project), but I cant open the B and C because I get a
> PackageNotFoundException as the models B and C cannot find the
> metamodel's URI.
> I used to solve this using AM3's register metamodel functionality, but
> I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>
> Anybody have any ideas?
> Mark
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Register Metamodel [message #417900 is a reply to message #417884] Fri, 28 March 2008 11:17 Go to previous messageGo to next message
Mark Melia is currently offline Mark MeliaFriend
Messages: 142
Registered: July 2009
Senior Member
Hi Ed,

Is there anyway to get this working not in a plugin environment (i.e. I
dont want to run this as an Eclipse Application). Both Ecore metamodel
file and model file are in the same project, as I plan to use them in ATL
transformations.

BTW, what does the class attribute refer to below?

Thanks for your help,
Mark

Ed Merks wrote:

> Mark,

> EMF normally generates a registration for each package like this:

> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri = "uri://sample221352"
> class = "sample221352.Sample221352Package"
> genModel = "model/My.genmodel" />

> This makes them visible in EPackage.Registry.INSTANCE. You'd need one
> for each of your three models...


> Mark Melia wrote:
>> Hi all,
>>
>> Does anyone know whether it is possible to register a metamodel within
>> the same project. I have 3 ecore models A, B, and C. B and C are
>> implementations of A. They all are in the same project (an ATL
>> project), but I cant open the B and C because I get a
>> PackageNotFoundException as the models B and C cannot find the
>> metamodel's URI.
>> I used to solve this using AM3's register metamodel functionality, but
>> I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>>
>> Anybody have any ideas?
>> Mark
>>
Re: Register Metamodel [message #417905 is a reply to message #417900] Fri, 28 March 2008 12:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Mark,

The class attribute refers to the XyzPackage interface containing the
eINSTANCE field. In stand alone mode, calling
XyzPackage.eINSTANCE.eClass() will as a side effect result in the
package being registered in the EPackage.Registry.INSTANCE.


Mark Melia wrote:
> Hi Ed,
>
> Is there anyway to get this working not in a plugin environment (i.e.
> I dont want to run this as an Eclipse Application). Both Ecore
> metamodel file and model file are in the same project, as I plan to
> use them in ATL transformations.
> BTW, what does the class attribute refer to below?
>
> Thanks for your help,
> Mark
>
> Ed Merks wrote:
>
>> Mark,
>
>> EMF normally generates a registration for each package like this:
>
>> <extension point="org.eclipse.emf.ecore.generated_package">
>> <package
>> uri = "uri://sample221352"
>> class = "sample221352.Sample221352Package"
>> genModel = "model/My.genmodel" />
>
>> This makes them visible in EPackage.Registry.INSTANCE. You'd need
>> one for each of your three models...
>
>
>> Mark Melia wrote:
>>> Hi all,
>>>
>>> Does anyone know whether it is possible to register a metamodel
>>> within the same project. I have 3 ecore models A, B, and C. B and C
>>> are implementations of A. They all are in the same project (an ATL
>>> project), but I cant open the B and C because I get a
>>> PackageNotFoundException as the models B and C cannot find the
>>> metamodel's URI.
>>> I used to solve this using AM3's register metamodel functionality,
>>> but I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>>>
>>> Anybody have any ideas?
>>> Mark
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Register Metamodel [message #417911 is a reply to message #417882] Fri, 28 March 2008 14:43 Go to previous messageGo to next message
Didier Vojtisek is currently offline Didier VojtisekFriend
Messages: 31
Registered: July 2009
Member
Hi
in the ecore tools project a feature equivalent to the AM3's "register
metamodel" has been proposed. (GUI and API + a registry view for the
metamodel developers)
It's in eclipse CVS, however, I don't know exactly when it will be
officially available.

Cheers
Didier


Mark Melia a écrit :
> Hi all,
>
> Does anyone know whether it is possible to register a metamodel within
> the same project. I have 3 ecore models A, B, and C. B and C are
> implementations of A. They all are in the same project (an ATL project),
> but I cant open the B and C because I get a PackageNotFoundException as
> the models B and C cannot find the metamodel's URI.
> I used to solve this using AM3's register metamodel functionality, but I
> am now using Eclipse 3.4 and AM3 is not working with 3.4.
>
> Anybody have any ideas?
> Mark
>
Re: Register Metamodel [message #417913 is a reply to message #417911] Fri, 28 March 2008 14:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Didier,

I'm also hoping to find time to work on
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220218 since I think this
generalizes the diverging solutions I've seen from several different
sources, including Ecore Tools, UMLX and QVT. As we talked about a
while back, I think using EPackage.Registry.INSTANCE for anything other
than static models needed by the IDE itself is asking for trouble...


Didier Vojtisek wrote:
> Hi
> in the ecore tools project a feature equivalent to the AM3's "register
> metamodel" has been proposed. (GUI and API + a registry view for the
> metamodel developers)
> It's in eclipse CVS, however, I don't know exactly when it will be
> officially available.
>
> Cheers
> Didier
>
>
> Mark Melia a écrit :
>> Hi all,
>>
>> Does anyone know whether it is possible to register a metamodel
>> within the same project. I have 3 ecore models A, B, and C. B and C
>> are implementations of A. They all are in the same project (an ATL
>> project), but I cant open the B and C because I get a
>> PackageNotFoundException as the models B and C cannot find the
>> metamodel's URI.
>> I used to solve this using AM3's register metamodel functionality,
>> but I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>>
>> Anybody have any ideas?
>> Mark
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Where to start with your own templates [message #417920 is a reply to message #417911] Fri, 28 March 2008 17:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nima.mazloumi.gmx.de

Hi,

I am thinking of extending emf to generate further classes and was wondering where to get started.
One area is to generate GEF editparts for some classes defined and se parameters. I assume that
I could use annotations for this purpose. But where and how do I register a template to be used
when ever a special annotation is found - for instance to generate the source file for the editpart class?

Thanks,
Nima
Re: Where to start with your own templates [message #417922 is a reply to message #417920] Fri, 28 March 2008 17:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Nima,

The org.eclipse.emf.examples.generator.validator shows a working example
to get you started. It's part of our separate examples download.


Nima Mazloumi wrote:
> Hi,
>
> I am thinking of extending emf to generate further classes and was
> wondering where to get started.
> One area is to generate GEF editparts for some classes defined and se
> parameters. I assume that
> I could use annotations for this purpose. But where and how do I
> register a template to be used
> when ever a special annotation is found - for instance to generate the
> source file for the editpart class?
>
> Thanks,
> Nima


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Where to start with your own templates [message #417934 is a reply to message #417922] Sat, 29 March 2008 12:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nima.mazloumi.gmx.de

Thank you.

Ed Merks schrieb:
> Nima,
>
> The org.eclipse.emf.examples.generator.validator shows a working example
> to get you started. It's part of our separate examples download.
>
>
> Nima Mazloumi wrote:
>> Hi,
>>
>> I am thinking of extending emf to generate further classes and was
>> wondering where to get started.
>> One area is to generate GEF editparts for some classes defined and se
>> parameters. I assume that
>> I could use annotations for this purpose. But where and how do I
>> register a template to be used
>> when ever a special annotation is found - for instance to generate the
>> source file for the editpart class?
>>
>> Thanks,
>> Nima
Re: Register Metamodel [message #417941 is a reply to message #417913] Mon, 31 March 2008 08:41 Go to previous messageGo to next message
Didier Vojtisek is currently offline Didier VojtisekFriend
Messages: 31
Registered: July 2009
Member
Ed,

I agree

should I CC myself to the issue you mentioned in order to provide some
help if possible ?
Kermeta relies on the same mechanisms (that why we proposed that simple
contribution to ecoretools) any improvement there will benefit to many.

About the document ModelRegistry.pdf I think that providing URI
translation mapping at the project level is good but not enough. (May be
the existing implementation in UMLx already does that, if so, just
ignore my comment ;-) )
For ex, while I develop a transformation I'll use the nominal URI. the
project settings will correctly translate it to the correct ecore
(typically using a platform:/resource) but when I'll deploy the
tranformation in a plugin as a tool for the end user. This plugin must
have it own translation map (typically using platform:/plugin) no matter
in which project the user run the transformation.

Didier

Ed Merks a écrit :
> Didier,
>
> I'm also hoping to find time to work on
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=220218 since I think this
> generalizes the diverging solutions I've seen from several different
> sources, including Ecore Tools, UMLX and QVT. As we talked about a
> while back, I think using EPackage.Registry.INSTANCE for anything other
> than static models needed by the IDE itself is asking for trouble...
>
>
> Didier Vojtisek wrote:
>> Hi
>> in the ecore tools project a feature equivalent to the AM3's "register
>> metamodel" has been proposed. (GUI and API + a registry view for the
>> metamodel developers)
>> It's in eclipse CVS, however, I don't know exactly when it will be
>> officially available.
>>
>> Cheers
>> Didier
>>
>>
>> Mark Melia a écrit :
>>> Hi all,
>>>
>>> Does anyone know whether it is possible to register a metamodel
>>> within the same project. I have 3 ecore models A, B, and C. B and C
>>> are implementations of A. They all are in the same project (an ATL
>>> project), but I cant open the B and C because I get a
>>> PackageNotFoundException as the models B and C cannot find the
>>> metamodel's URI.
>>> I used to solve this using AM3's register metamodel functionality,
>>> but I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>>>
>>> Anybody have any ideas?
>>> Mark
>>>
Re: Register Metamodel [message #417947 is a reply to message #417941] Mon, 31 March 2008 11:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Didier,

I have yet to begin work on it, and it seems my week is typically sucked
dry of time without much chance to develop code. :-(

The idea would be that I know the namespaces of all the .ecore resources
in the workspace and in the target platform would be able to find their
physical location given only their nsURI. I should also be able to
redirect platform:/plugin URIs to the workspace or the target platform
if a plugin with a matching ID is available there. And I should be able
to redirect platform:/resource URIs for projects not actually in the
workspace to their resolution in the target platform. (A crude version
of these latter two is used by the GenModelEditor already.)


Didier Vojtisek wrote:
> Ed,
>
> I agree
>
> should I CC myself to the issue you mentioned in order to provide some
> help if possible ?
> Kermeta relies on the same mechanisms (that why we proposed that
> simple contribution to ecoretools) any improvement there will benefit
> to many.
>
> About the document ModelRegistry.pdf I think that providing URI
> translation mapping at the project level is good but not enough. (May
> be the existing implementation in UMLx already does that, if so, just
> ignore my comment ;-) )
> For ex, while I develop a transformation I'll use the nominal URI. the
> project settings will correctly translate it to the correct ecore
> (typically using a platform:/resource) but when I'll deploy the
> tranformation in a plugin as a tool for the end user. This plugin must
> have it own translation map (typically using platform:/plugin) no
> matter in which project the user run the transformation.
>
> Didier
>
> Ed Merks a écrit :
>> Didier,
>>
>> I'm also hoping to find time to work on
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=220218 since I think
>> this generalizes the diverging solutions I've seen from several
>> different sources, including Ecore Tools, UMLX and QVT. As we talked
>> about a while back, I think using EPackage.Registry.INSTANCE for
>> anything other than static models needed by the IDE itself is asking
>> for trouble...
>>
>>
>> Didier Vojtisek wrote:
>>> Hi
>>> in the ecore tools project a feature equivalent to the AM3's
>>> "register metamodel" has been proposed. (GUI and API + a registry
>>> view for the metamodel developers)
>>> It's in eclipse CVS, however, I don't know exactly when it will be
>>> officially available.
>>>
>>> Cheers
>>> Didier
>>>
>>>
>>> Mark Melia a écrit :
>>>> Hi all,
>>>>
>>>> Does anyone know whether it is possible to register a metamodel
>>>> within the same project. I have 3 ecore models A, B, and C. B and C
>>>> are implementations of A. They all are in the same project (an ATL
>>>> project), but I cant open the B and C because I get a
>>>> PackageNotFoundException as the models B and C cannot find the
>>>> metamodel's URI.
>>>> I used to solve this using AM3's register metamodel functionality,
>>>> but I am now using Eclipse 3.4 and AM3 is not working with 3.4.
>>>>
>>>> Anybody have any ideas?
>>>> Mark
>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:New EMF Project is not java nature
Next Topic:Emf serialization with id attribute
Goto Forum:
  


Current Time: Fri Apr 26 02:40:02 GMT 2024

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

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

Back to the top