Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Multiple models
Multiple models [message #411210] Wed, 18 July 2007 14:46 Go to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
Hi,

I need to manage multiple XML files in my application. For each XML Schema i
have a model, but there is an additional model that will extend all teh
existing models, and act as a glue between them.

I like to put all the models in one plugin, the models created directly from
XML and the one that extends and binds all of them. I want one plugin that
has all the generated code for different models (which would be in different
packages). Can I extend a model if the Ecore files for both the base and
child are in the same folder?
Re: Multiple models [message #411212 is a reply to message #411210] Wed, 18 July 2007 14:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Waqas,

The import wizards allow you to specify multiple schemas at once and
will yield a single .genmodel that will reference multiple .ecores that
will all be generated into a single plugin. So yes, you can do this.


Waqas Ilyas wrote:
> Hi,
>
> I need to manage multiple XML files in my application. For each XML Schema i
> have a model, but there is an additional model that will extend all teh
> existing models, and act as a glue between them.
>
> I like to put all the models in one plugin, the models created directly from
> XML and the one that extends and binds all of them. I want one plugin that
> has all the generated code for different models (which would be in different
> packages). Can I extend a model if the Ecore files for both the base and
> child are in the same folder?
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple models [message #415807 is a reply to message #411212] Tue, 08 January 2008 09:28 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Waqas,
>
> The import wizards allow you to specify multiple schemas at once and
> will yield a single .genmodel that will reference multiple .ecores that
> will all be generated into a single plugin. So yes, you can do this.
>
I assume the additional model references the other models (e.g. via containment).

I have multiple independent models A,B, etc. Would it be possible to generate one
common editor for them (instead of separate editors)? Currently I'm trying this
with a dummy additional/master model M which only exists in the genmodel (not as an
ecore model) :

M.genmodel
+
\-- A.ecore
\-- B.ecore

The generated code looks ok, except that :
* it assumes the existence of a editor, metapackage, and ItemProviderAdapterFactory for M,
which aren't generated.
* the XyzEditor.java files in editor/Xyz.presentation all reference each other in their
initializeEditingDomain() methods. This probably isn't a big deal, but I somehow would
have expected that these references belong to some file generated for M (since it is the
'master').

Do I need another setup for the genmodel file or change the plugin.xml files for the generated
code?

Thanks,
Rene
>
> Waqas Ilyas wrote:
>> Hi,
>>
>> I need to manage multiple XML files in my application. For each XML
>> Schema i have a model, but there is an additional model that will
>> extend all teh existing models, and act as a glue between them.
>>
>> I like to put all the models in one plugin, the models created
>> directly from XML and the one that extends and binds all of them. I
>> want one plugin that has all the generated code for different models
>> (which would be in different packages). Can I extend a model if the
>> Ecore files for both the base and child are in the same folder?
>>
>>
Re: Multiple models [message #415813 is a reply to message #415807] Tue, 08 January 2008 12:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050900060306090901060601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Rene,

Actually, any one of the editors could potentially do the trick (because
there's almost no difference between editors if you look closely).
There are a few problems though. :-(

Firstly, if is is present

adapterFactory.addAdapterFactory(new
ReflectiveItemProviderAdapterFactory());

then the registered item providers for other packages won't be found.
I'll be looking at addressing that this bugzilla very soon:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857

That one is easy enough to address with a line of code change. The
harder problem is child creation

https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472

The problem here is that the item providers generate support for child
creation based on all the models know at the time of generation.

Maybe your approach is quite a reasonable one and you could simply
change all the properties like model directory and such so that all the
code for the model, edit, and editor are generated into a single project
thereby avoiding plugin dependencies you don't really want. Does that
work? I assume you'll still have child creation issues though... I'm
trying find time for the latter bug too, it is a plan item, but my hack
for it so far was too ugly to post as a patch...


Rene Ladan wrote:
> Ed Merks wrote:
>
>> Waqas,
>>
>> The import wizards allow you to specify multiple schemas at once and
>> will yield a single .genmodel that will reference multiple .ecores that
>> will all be generated into a single plugin. So yes, you can do this.
>>
>>
> I assume the additional model references the other models (e.g. via containment).
>
> I have multiple independent models A,B, etc. Would it be possible to generate one
> common editor for them (instead of separate editors)? Currently I'm trying this
> with a dummy additional/master model M which only exists in the genmodel (not as an
> ecore model) :
>
> M.genmodel
> +
> \-- A.ecore
> \-- B.ecore
>
> The generated code looks ok, except that :
> * it assumes the existence of a editor, metapackage, and ItemProviderAdapterFactory for M,
> which aren't generated.
> * the XyzEditor.java files in editor/Xyz.presentation all reference each other in their
> initializeEditingDomain() methods. This probably isn't a big deal, but I somehow would
> have expected that these references belong to some file generated for M (since it is the
> 'master').
>
> Do I need another setup for the genmodel file or change the plugin.xml files for the generated
> code?
>
> Thanks,
> Rene
>
>> Waqas Ilyas wrote:
>>
>>> Hi,
>>>
>>> I need to manage multiple XML files in my application. For each XML
>>> Schema i have a model, but there is an additional model that will
>>> extend all teh existing models, and act as a glue between them.
>>>
>>> I like to put all the models in one plugin, the models created
>>> directly from XML and the one that extends and binds all of them. I
>>> want one plugin that has all the generated code for different models
>>> (which would be in different packages). Can I extend a model if the
>>> Ecore files for both the base and child are in the same folder?
>>>
>>>
>>>


--------------050900060306090901060601
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Rene,<br>
<br>
Actually, any one of the editors could potentially do the trick
(because there's almost no difference between editors if you look
closely).&nbsp; There are a few problems though.&nbsp; :-(<br>
<br>
Firstly, if is is present<br>
<br>
&nbsp;&nbsp;&nbsp; adapterFactory.addAdapterFactory(new
ReflectiveItemProviderAdapterFactory());<br>
<br>
then the registered item providers for other packages won't be found.&nbsp;
I'll be looking at addressing that this bugzilla very soon:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857">https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857</a><br>
</blockquote>
That one is easy enough to address with a line of code change.&nbsp; The
harder problem is child creation<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472">https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472</a><br>
</blockquote>
The problem here is that the item providers generate support for child
creation based on all the models know at the time of generation.<br>
<br>
Maybe your approach is quite a reasonable one and you could simply
change all the properties like model directory and such so that all the
code for the model, edit, and editor are generated into a single
project thereby avoiding plugin dependencies you don't really want.&nbsp;
Does that work?&nbsp; I assume you'll still have child creation issues
though...&nbsp; I'm trying find time for the latter bug too, it is a plan
item, but my hack for it so far was too ugly to post as a patch...<br>
<br>
<br>
Rene Ladan wrote:
<blockquote cite="mid:flvfoa$bf9$1@build.eclipse.org" type="cite">
<pre wrap="">Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Waqas,

The import wizards allow you to specify multiple schemas at once and
will yield a single .genmodel that will reference multiple .ecores that
will all be generated into a single plugin. So yes, you can do this.

</pre>
</blockquote>
<pre wrap=""><!---->I assume the additional model references the other models (e.g. via containment).

I have multiple independent models A,B, etc. Would it be possible to generate one
common editor for them (instead of separate editors)? Currently I'm trying this
with a dummy additional/master model M which only exists in the genmodel (not as an
ecore model) :

M.genmodel
+
\-- A.ecore
\-- B.ecore

The generated code looks ok, except that :
* it assumes the existence of a editor, metapackage, and ItemProviderAdapterFactory for M,
which aren't generated.
* the XyzEditor.java files in editor/Xyz.presentation all reference each other in their
initializeEditingDomain() methods. This probably isn't a big deal, but I somehow would
have expected that these references belong to some file generated for M (since it is the
'master').

Do I need another setup for the genmodel file or change the plugin.xml files for the generated
code?

Thanks,
Rene
</pre>
<blockquote type="cite">
<pre wrap="">Waqas Ilyas wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,

I need to manage multiple XML files in my application. For each XML
Schema i have a model, but there is an additional model that will
extend all teh existing models, and act as a glue between them.

I like to put all the models in one plugin, the models created
directly from XML and the one that extends and binds all of them. I
want one plugin that has all the generated code for different models
(which would be in different packages). Can I extend a model if the
Ecore files for both the base and child are in the same folder?


</pre>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------050900060306090901060601--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple models [message #415837 is a reply to message #415813] Wed, 09 January 2008 12:23 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Rene,
>
> Actually, any one of the editors could potentially do the trick (because
> there's almost no difference between editors if you look closely).
> There are a few problems though. :-(
>
> Firstly, if is is present
>
> adapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
>
> then the registered item providers for other packages won't be found.
> I'll be looking at addressing that this bugzilla very soon:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857
>
These lines are indeed present in Xyz.presentation.XyzEditor.intializeEditingDomain().
I commented them out, but it doesn't seem to make much difference.

> That one is easy enough to address with a line of code change. The
> harder problem is child creation
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472
>
> The problem here is that the item providers generate support for child
> creation based on all the models know at the time of generation.
>
I don't think this affects me, since all models are known at generation time.

> Maybe your approach is quite a reasonable one and you could simply
> change all the properties like model directory and such so that all the
> code for the model, edit, and editor are generated into a single project
> thereby avoiding plugin dependencies you don't really want. Does that
> work? I assume you'll still have child creation issues though... I'm
> trying find time for the latter bug too, it is a plan item, but my hack
> for it so far was too ugly to post as a patch...
>
I've added a wrapper model called "meta", which contains a single abstract class
containing transient 0..* references to the main element of the other models.

After regenerating the code (I even deleted all java and class files to be sure),
the editor runs but I cannot create a new "meta" model. Upon trying the wizard just
responds with a "Problem opening wizard" window telling "Could not instantiate class
'meta.presentation.MetaModelWizard' and the Finish button is then disabled.

Note that I manually copied and modified the MetaModelWizard and MetaActionBarContributor
class from one of the referenced models, as only the MetaEditorPlugin class is generated.

I think I can put the files online if you want.

Rene

> Rene Ladan wrote:
>> Ed Merks wrote:
>>
>>> Waqas,
>>>
>>> The import wizards allow you to specify multiple schemas at once and
>>> will yield a single .genmodel that will reference multiple .ecores that
>>> will all be generated into a single plugin. So yes, you can do this.
>>>
>>>
>> I assume the additional model references the other models (e.g. via containment).
>>
>> I have multiple independent models A,B, etc. Would it be possible to generate one
>> common editor for them (instead of separate editors)? Currently I'm trying this
>> with a dummy additional/master model M which only exists in the genmodel (not as an
>> ecore model) :
>>
>> M.genmodel
>> +
>> \-- A.ecore
>> \-- B.ecore
>>
>> The generated code looks ok, except that :
>> * it assumes the existence of a editor, metapackage, and ItemProviderAdapterFactory for M,
>> which aren't generated.
>> * the XyzEditor.java files in editor/Xyz.presentation all reference each other in their
>> initializeEditingDomain() methods. This probably isn't a big deal, but I somehow would
>> have expected that these references belong to some file generated for M (since it is the
>> 'master').
>>
>> Do I need another setup for the genmodel file or change the plugin.xml files for the generated
>> code?
>>
>> Thanks,
>> Rene
>>
>>> Waqas Ilyas wrote:
>>>
>>>> Hi,
>>>>
>>>> I need to manage multiple XML files in my application. For each XML
>>>> Schema i have a model, but there is an additional model that will
>>>> extend all teh existing models, and act as a glue between them.
>>>>
>>>> I like to put all the models in one plugin, the models created
>>>> directly from XML and the one that extends and binds all of them. I
>>>> want one plugin that has all the generated code for different models
>>>> (which would be in different packages). Can I extend a model if the
>>>> Ecore files for both the base and child are in the same folder?
>>>>
>>>>
>>>>
>
Re: Multiple models [message #415838 is a reply to message #415837] Wed, 09 January 2008 12:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Rene,

Comments below.


Rene Ladan wrote:
> Ed Merks wrote:
>> Rene,
>>
>> Actually, any one of the editors could potentially do the trick
>> (because there's almost no difference between editors if you look
>> closely). There are a few problems though. :-(
>>
>> Firstly, if is is present
>>
>> adapterFactory.addAdapterFactory(new
>> ReflectiveItemProviderAdapterFactory());
>>
>> then the registered item providers for other packages won't be
>> found. I'll be looking at addressing that this bugzilla very soon:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857
>>
> These lines are indeed present in
> Xyz.presentation.XyzEditor.intializeEditingDomain().
> I commented them out, but it doesn't seem to make much difference.
Do you really have a resource that has instances from all the models.
If you are using purely unspecialized item providers you really won't
notice a significant difference between the reflective ones and the
generated ones because the reflective ones effectively behave just like
the default generated ones.
>
>> That one is easy enough to address with a line of code change. The
>> harder problem is child creation
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472
>>
>> The problem here is that the item providers generate support for
>> child creation based on all the models know at the time of generation.
>>
> I don't think this affects me, since all models are known at
> generation time.
Yes, but are the known to the item provider itself when it's generated.
It sounds like not if the item provider is generated by a separate
GenModel that knows only about that one model.
>
>> Maybe your approach is quite a reasonable one and you could simply
>> change all the properties like model directory and such so that all
>> the code for the model, edit, and editor are generated into a single
>> project thereby avoiding plugin dependencies you don't really want.
>> Does that work? I assume you'll still have child creation issues
>> though... I'm trying find time for the latter bug too, it is a plan
>> item, but my hack for it so far was too ugly to post as a patch...
>>
> I've added a wrapper model called "meta", which contains a single
> abstract class
> containing transient 0..* references to the main element of the other
> models.
>
> After regenerating the code (I even deleted all java and class files
> to be sure),
> the editor runs but I cannot create a new "meta" model.
Because it's abstract you can't create an instance of it.
> Upon trying the wizard just
> responds with a "Problem opening wizard" window telling "Could not
> instantiate class
> 'meta.presentation.MetaModelWizard' and the Finish button is then
> disabled.
The error log will describe what's wrong. I don't think the wizard code
will deal well with the case of a model for which there are no
instantiable classes. Is there some object of one of the models that's
logically the root kind of like how an EPackage is the root of any
reasonable Ecore model? You'd want just a single wizard to create it.
Any of the generated editors should work pretty much the same.
>
> Note that I manually copied and modified the MetaModelWizard and
> MetaActionBarContributor
> class from one of the referenced models, as only the MetaEditorPlugin
> class is generated.
>
> I think I can put the files online if you want.
I can certainly imagine all the issues, but I don't have any hard and
fast solutions. As I've said, any of the generated editors should work
to edit any of the models, but the child creation issues is a hard
problem that I've not solved yet.
>
> Rene
>
>> Rene Ladan wrote:
>>> Ed Merks wrote:
>>>
>>>> Waqas,
>>>>
>>>> The import wizards allow you to specify multiple schemas at once and
>>>> will yield a single .genmodel that will reference multiple .ecores
>>>> that
>>>> will all be generated into a single plugin. So yes, you can do this.
>>>>
>>>>
>>> I assume the additional model references the other models (e.g. via
>>> containment).
>>>
>>> I have multiple independent models A,B, etc. Would it be possible
>>> to generate one
>>> common editor for them (instead of separate editors)? Currently I'm
>>> trying this
>>> with a dummy additional/master model M which only exists in the
>>> genmodel (not as an
>>> ecore model) :
>>>
>>> M.genmodel
>>> +
>>> \-- A.ecore
>>> \-- B.ecore
>>>
>>> The generated code looks ok, except that :
>>> * it assumes the existence of a editor, metapackage, and
>>> ItemProviderAdapterFactory for M,
>>> which aren't generated.
>>> * the XyzEditor.java files in editor/Xyz.presentation all reference
>>> each other in their
>>> initializeEditingDomain() methods. This probably isn't a big
>>> deal, but I somehow would
>>> have expected that these references belong to some file generated
>>> for M (since it is the
>>> 'master').
>>>
>>> Do I need another setup for the genmodel file or change the
>>> plugin.xml files for the generated
>>> code?
>>>
>>> Thanks,
>>> Rene
>>>
>>>> Waqas Ilyas wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I need to manage multiple XML files in my application. For each XML
>>>>> Schema i have a model, but there is an additional model that will
>>>>> extend all teh existing models, and act as a glue between them.
>>>>>
>>>>> I like to put all the models in one plugin, the models created
>>>>> directly from XML and the one that extends and binds all of them. I
>>>>> want one plugin that has all the generated code for different models
>>>>> (which would be in different packages). Can I extend a model if the
>>>>> Ecore files for both the base and child are in the same folder?
>>>>>
>>>>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple models [message #415841 is a reply to message #415838] Wed, 09 January 2008 13:53 Go to previous messageGo to next message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Rene,
>
> Comments below.
>
>
> Rene Ladan wrote:
>> Ed Merks wrote:
>>> Rene,
>>>
>>> Actually, any one of the editors could potentially do the trick
>>> (because there's almost no difference between editors if you look
>>> closely). There are a few problems though. :-(
>>>
>>> Firstly, if is is present
>>>
>>> adapterFactory.addAdapterFactory(new
>>> ReflectiveItemProviderAdapterFactory());
>>>
>>> then the registered item providers for other packages won't be
>>> found. I'll be looking at addressing that this bugzilla very soon:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857
>>>
>> These lines are indeed present in
>> Xyz.presentation.XyzEditor.intializeEditingDomain().
>> I commented them out, but it doesn't seem to make much difference.
> Do you really have a resource that has instances from all the models.
No, it's more the other way around: I have several models m1..m5 and
instances of them which I'm trying to combine into one editor. I could
combine these models into one big model but then the top element of the
models saved with the editor will be that of the combined model instead
of that of the actual model mi. This makes some legacy tools unusable.

The reason to combine the models is that they are independent but
logically complement each other regarding transformation and analysis
purposes.

[...]
>>> That one is easy enough to address with a line of code change. The
>>> harder problem is child creation
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472
>>>
>>> The problem here is that the item providers generate support for
>>> child creation based on all the models know at the time of generation.
>>>
>> I don't think this affects me, since all models are known at
>> generation time.
> Yes, but are the known to the item provider itself when it's generated.
> It sounds like not if the item provider is generated by a separate
> GenModel that knows only about that one model.
I currently have 5 ecore models and one wrapper ecore model, the latter
is the only one with a genmodel.

[..]
>> I've added a wrapper model called "meta", which contains a single
>> abstract class
>> containing transient 0..* references to the main element of the other
>> models.
>>
>> After regenerating the code (I even deleted all java and class files
>> to be sure),
>> the editor runs but I cannot create a new "meta" model.
> Because it's abstract you can't create an instance of it.
But it still won't work after making the class non-abstract, regenerating
the code and adding some (missing?) UI strings to plugin.properties.

[..]
> Is there some object of one of the models that's
> logically the root kind of like how an EPackage is the root of any
> reasonable Ecore model? You'd want just a single wizard to create it.
> Any of the generated editors should work pretty much the same.
Each model mi (not the wrapper model) has a logical root element.

[..]

Rene
>>
>>> Rene Ladan wrote:
>>>> Ed Merks wrote:
>>>>
>>>>> Waqas,
>>>>>
>>>>> The import wizards allow you to specify multiple schemas at once and
>>>>> will yield a single .genmodel that will reference multiple .ecores
>>>>> that
>>>>> will all be generated into a single plugin. So yes, you can do this.
>>>>>
>>>>>
>>>> I assume the additional model references the other models (e.g. via
>>>> containment).
>>>>
>>>> I have multiple independent models A,B, etc. Would it be possible
>>>> to generate one
>>>> common editor for them (instead of separate editors)? Currently I'm
>>>> trying this
>>>> with a dummy additional/master model M which only exists in the
>>>> genmodel (not as an
>>>> ecore model) :
>>>>
>>>> M.genmodel
>>>> +
>>>> \-- A.ecore
>>>> \-- B.ecore
>>>>
>>>> The generated code looks ok, except that :
>>>> * it assumes the existence of a editor, metapackage, and
>>>> ItemProviderAdapterFactory for M,
>>>> which aren't generated.
>>>> * the XyzEditor.java files in editor/Xyz.presentation all reference
>>>> each other in their
>>>> initializeEditingDomain() methods. This probably isn't a big
>>>> deal, but I somehow would
>>>> have expected that these references belong to some file generated
>>>> for M (since it is the
>>>> 'master').
>>>>
>>>> Do I need another setup for the genmodel file or change the
>>>> plugin.xml files for the generated
>>>> code?
>>>>
>>>> Thanks,
>>>> Rene
>>>>
Re: Multiple models [message #415845 is a reply to message #415841] Wed, 09 January 2008 15:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Rene,

Comments below.

Rene Ladan wrote:
> Ed Merks wrote:
>> Rene,
>>
>> Comments below.
>>
>>
>> Rene Ladan wrote:
>>> Ed Merks wrote:
>>>> Rene,
>>>>
>>>> Actually, any one of the editors could potentially do the trick
>>>> (because there's almost no difference between editors if you look
>>>> closely). There are a few problems though. :-(
>>>>
>>>> Firstly, if is is present
>>>>
>>>> adapterFactory.addAdapterFactory(new
>>>> ReflectiveItemProviderAdapterFactory());
>>>>
>>>> then the registered item providers for other packages won't be
>>>> found. I'll be looking at addressing that this bugzilla very soon:
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857
>>>>
>>> These lines are indeed present in
>>> Xyz.presentation.XyzEditor.intializeEditingDomain().
>>> I commented them out, but it doesn't seem to make much difference.
>> Do you really have a resource that has instances from all the models.
> No, it's more the other way around: I have several models m1..m5 and
> instances of them which I'm trying to combine into one editor. I could
> combine these models into one big model but then the top element of the
> models saved with the editor will be that of the combined model instead
> of that of the actual model mi. This makes some legacy tools unusable.
I see. Note that EMF supports this like cross resource containment so
you could make it look like one big model for the editor, but still
serialize each branch in a separate file. Maybe that's what you want.
Otherwise, you can load multiple resources into a single editor using
"Load Resource..." so you might have some other automatic way of loading
them.
>
> The reason to combine the models is that they are independent but
> logically complement each other regarding transformation and analysis
> purposes.
So the trick will be if you need something to tie them together or you
have some way to figure out the others just given one of them...
>
> [...]
>>>> That one is easy enough to address with a line of code change. The
>>>> harder problem is child creation
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=109472
>>>>
>>>> The problem here is that the item providers generate support for
>>>> child creation based on all the models know at the time of generation.
>>>>
>>> I don't think this affects me, since all models are known at
>>> generation time.
>> Yes, but are the known to the item provider itself when it's
>> generated. It sounds like not if the item provider is generated by a
>> separate GenModel that knows only about that one model.
> I currently have 5 ecore models and one wrapper ecore model, the latter
> is the only one with a genmodel.
Okay. That's seems fine. Sorry for misunderstanding.
>
> [..]
>>> I've added a wrapper model called "meta", which contains a single
>>> abstract class
>>> containing transient 0..* references to the main element of the
>>> other models.
>>>
>>> After regenerating the code (I even deleted all java and class files
>>> to be sure),
>>> the editor runs but I cannot create a new "meta" model.
>> Because it's abstract you can't create an instance of it.
> But it still won't work after making the class non-abstract, regenerating
> the code and adding some (missing?) UI strings to plugin.properties.
There shouldn't be anything missing. But keep in mind that plugin.xml
and MANIFEST.MFs aren't regenerated if you make changes to the model
that effect them. What exactly isn't working?
>
> [..]
>> Is there some object of one of the models that's logically the root
>> kind of like how an EPackage is the root of any reasonable Ecore
>> model? You'd want just a single wizard to create it. Any of the
>> generated editors should work pretty much the same.
> Each model mi (not the wrapper model) has a logical root element.
So I still think you could avoid generating any editors for any of the
other models and generate just the editor for the composite model. But
it seems there are problem but there shouldn't be. I'll need to know
the details...
>
> [..]
>
> Rene
>>>
>>>> Rene Ladan wrote:
>>>>> Ed Merks wrote:
>>>>>
>>>>>> Waqas,
>>>>>>
>>>>>> The import wizards allow you to specify multiple schemas at once and
>>>>>> will yield a single .genmodel that will reference multiple
>>>>>> .ecores that
>>>>>> will all be generated into a single plugin. So yes, you can do
>>>>>> this.
>>>>>>
>>>>>>
>>>>> I assume the additional model references the other models (e.g.
>>>>> via containment).
>>>>>
>>>>> I have multiple independent models A,B, etc. Would it be possible
>>>>> to generate one
>>>>> common editor for them (instead of separate editors)? Currently
>>>>> I'm trying this
>>>>> with a dummy additional/master model M which only exists in the
>>>>> genmodel (not as an
>>>>> ecore model) :
>>>>>
>>>>> M.genmodel
>>>>> +
>>>>> \-- A.ecore
>>>>> \-- B.ecore
>>>>>
>>>>> The generated code looks ok, except that :
>>>>> * it assumes the existence of a editor, metapackage, and
>>>>> ItemProviderAdapterFactory for M,
>>>>> which aren't generated.
>>>>> * the XyzEditor.java files in editor/Xyz.presentation all
>>>>> reference each other in their
>>>>> initializeEditingDomain() methods. This probably isn't a big
>>>>> deal, but I somehow would
>>>>> have expected that these references belong to some file
>>>>> generated for M (since it is the
>>>>> 'master').
>>>>>
>>>>> Do I need another setup for the genmodel file or change the
>>>>> plugin.xml files for the generated
>>>>> code?
>>>>>
>>>>> Thanks,
>>>>> Rene
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple models [message #415904 is a reply to message #415845] Thu, 10 January 2008 10:26 Go to previous message
Rene Ladan is currently offline Rene LadanFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Rene,
>
> Comments below.
>
> Rene Ladan wrote:
>> Ed Merks wrote:
>>> Rene,
>>>
>>> Comments below.
>>>
>>>
>>> Rene Ladan wrote:
>>>> Ed Merks wrote:
>>>>> Rene,
>>>>>
>>>>> Actually, any one of the editors could potentially do the trick
>>>>> (because there's almost no difference between editors if you look
>>>>> closely). There are a few problems though. :-(
>>>>>
>>>>> Firstly, if is is present
>>>>>
>>>>> adapterFactory.addAdapterFactory(new
>>>>> ReflectiveItemProviderAdapterFactory());
>>>>>
>>>>> then the registered item providers for other packages won't be
>>>>> found. I'll be looking at addressing that this bugzilla very soon:
>>>>>
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=206857
>>>>>
>>>> These lines are indeed present in
>>>> Xyz.presentation.XyzEditor.intializeEditingDomain().
>>>> I commented them out, but it doesn't seem to make much difference.
>>> Do you really have a resource that has instances from all the models.
>> No, it's more the other way around: I have several models m1..m5 and
>> instances of them which I'm trying to combine into one editor. I could
>> combine these models into one big model but then the top element of the
>> models saved with the editor will be that of the combined model instead
>> of that of the actual model mi. This makes some legacy tools unusable.
> I see. Note that EMF supports this like cross resource containment so
> you could make it look like one big model for the editor, but still
> serialize each branch in a separate file. Maybe that's what you want.
Yes, that is exactly what I needed :) The FAQ at the EMF wiki and the
"Control..." option proved to be helpful.

> Otherwise, you can load multiple resources into a single editor using
> "Load Resource..." so you might have some other automatic way of loading
> them.
Using the "Load Resource..." option, dragging the model into the main model
under the "meta" element and exporting it via "Control..." seems the way to
go right now. Not very user-friendly, but it works.

[..]


Rene
Previous Topic:Using EMF under Apache Felix
Next Topic:EStore getContainer
Goto Forum:
  


Current Time: Thu Apr 25 16:18:34 GMT 2024

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

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

Back to the top