Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF extension mechanisms
EMF extension mechanisms [message #871594] Mon, 14 May 2012 13:42 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hello,

I was wondering if there is a way to extend a meta model. Suppose that I have a meta model in EMF which is used in my application. Now, I would like to leave that meta model open to extensions: similar as what you have in Eclipse with the extension points. So, a separate bundle could extend an EClass in my meta model for instance. Of course, I don't want to generate my full model code once again in the separate plug-in but that my application can "manipulate" those new objects (through a known base class of course).

Is there a way to do something like that ?
If not, what would be a good strategy for such a scenario ? The serialization sould of course take that into account (so, the extensions should also be persisted in the same file).

Thanks
Re: EMF extension mechanisms [message #871600 is a reply to message #871594] Mon, 14 May 2012 13:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<a
href="http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.emf.doc/tutorials/slibmod/slibmod.html">Tutorial:
Generating an Extended EMF Model</a><br>
<a
href="http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html">http://ed-merks.blogspot.com/2008/01/creating-children-you-didnt-know.html</a><br>
<br>
On 14/05/2012 3:42 PM, Cedric Moonen wrote:
<blockquote cite="mid:jor23k$led$1@xxxxxxxxe.org" type="cite">Hello,
<br>
<br>
I was wondering if there is a way to extend a meta model. Suppose
that I have a meta model in EMF which is used in my application.
Now, I would like to leave that meta model open to extensions:
similar as what you have in Eclipse with the extension points. So,
a separate bundle could extend an EClass in my meta model for
instance. Of course, I don't want to generate my full model code
once again in the separate plug-in but that my application can
"manipulate" those new objects (through a known base class of
course).
<br>
<br>
Is there a way to do something like that ?
<br>
If not, what would be a good strategy for such a scenario ? The
serialization sould of course take that into account (so, the
extensions should also be persisted in the same file).
<br>
<br>
Thanks
<br>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF extension mechanisms [message #871605 is a reply to message #871600] Mon, 14 May 2012 14:10 Go to previous messageGo to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hi Ed,

Thanks for the fast reply. I already saw those articles but I don't think they answer my question (or maybe I misunderstood them).

Let me try to explain my problem differently: I designed a meta model which is the "core" of my application (I used EMF for obvious reasons: notifications, serialization support, ...). My application code (which is manually written code) is then manipulating the generated model. I only generated the model code, the edit and editor were not needed for my case.
Now, suppose that in my meta model I have an abstract EClass called Item (with some properties) and some concrete items which inherit from Item: my application is able to manipulate items. I would like additional plug-ins to be able to contribute their own item EClasses, without having to touch my core application. The way that these items can be created is specific to my application. The important part here is that I can now construct a model instance in which some of the items are items contributed by the additional plug-in. When I persist my model, those "custom" items should also be persisted (as if they were in my original meta model).

Does that make sense ?
Re: EMF extension mechanisms [message #871613 is a reply to message #871605] Mon, 14 May 2012 14:21 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Cedric,

Yes, that's what the tutorial shows, i.e., how someone can extend your
base model. Instance can then be contained or referenced anywhere that
a base instance is allowed and it will be serialized properly


On 14/05/2012 4:10 PM, Cedric Moonen wrote:
> Hi Ed,
>
> Thanks for the fast reply. I already saw those articles but I don't
> think they answer my question (or maybe I misunderstood them).
>
> Let me try to explain my problem differently: I designed a meta model
> which is the "core" of my application (I used EMF for obvious reasons:
> notifications, serialization support, ...). My application code (which
> is manually written code) is then manipulating the generated model. I
> only generated the model code, the edit and editor were not needed for
> my case.
> Now, suppose that in my meta model I have an abstract EClass called
> Item (with some properties) and some concrete items which inherit from
> Item: my application is able to manipulate items. I would like
> additional plug-ins to be able to contribute their own item EClasses,
> without having to touch my core application. The way that these items
> can be created is specific to my application. The important part here
> is that I can now construct a model instance in which some of the
> items are items contributed by the additional plug-in. When I persist
> my model, those "custom" items should also be persisted (as if they
> were in my original meta model).
>
> Does that make sense ?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Is there a XML merger exists?
Next Topic:Texo: how to annotate all tables: prefix for tables in db
Goto Forum:
  


Current Time: Thu Apr 25 01:05:26 GMT 2024

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

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

Back to the top