Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XCore: refering from xmi/instance file to xcore file
XCore: refering from xmi/instance file to xcore file [message #1220656] Thu, 12 December 2013 17:19 Go to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi,
I am trying to integrate Xcore with Texo. I make nice progress, but also encounter 2 issues for which I would need some
advice:
- when I let Texo generate code from an epackage I first let Texo validate this epackage. The validation fails for an
epackage read from an xcore file. When I validate the xcore file directly (using the right-click option) it works fine.
Where is the code that implements this right click? Then I can maybe copy part of the approach there to validate models
from xcore files.


- in Texo it is possible to define a so-called annotations model. This is an instance file which refers to the original
model (in the xcore file in this case). When I try to open the annotations model in the standard generated editor it
gives an error on a missing genmodel or something. The annotations model references seem to correctly refer to the xcore
file next to it.

I attached some screenshots and the xcore and the annotation model file.

Thanks for any pointers on this!

gr. Martin

--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org

package org.eclipse.emf.texo.test.model.samples.travel

class Journey
{
String name
contains Trip[] trips
}

class Trip
{
String name
refers City destination
}

class City
{
String name
}
Re: XCore: refering from xmi/instance file to xcore file [message #1220687 is a reply to message #1220656] Fri, 13 December 2013 00:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
Martin,

Probably more interesting is to see why the reflective editor is able to
open a *.xcore file. Have a look at
org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(). From what
you describe, this is the most significant thing to consider first:

resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));



On 12/12/2013 11:19 PM, Martin Taal wrote:
> Hi,
> I am trying to integrate Xcore with Texo. I make nice progress, but
> also encounter 2 issues for which I would need some advice:
> - when I let Texo generate code from an epackage I first let Texo
> validate this epackage. The validation fails for an epackage read from
> an xcore file. When I validate the xcore file directly (using the
> right-click option) it works fine. Where is the code that implements
> this right click? Then I can maybe copy part of the approach there to
> validate models from xcore files.
>
>
> - in Texo it is possible to define a so-called annotations model. This
> is an instance file which refers to the original model (in the xcore
> file in this case). When I try to open the annotations model in the
> standard generated editor it gives an error on a missing genmodel or
> something. The annotations model references seem to correctly refer to
> the xcore file next to it.
>
> I attached some screenshots and the xcore and the annotation model file.
>
> Thanks for any pointers on this!
>
> gr. Martin
>
Re: XCore: refering from xmi/instance file to xcore file [message #1220715 is a reply to message #1220687] Fri, 13 December 2013 04:14 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi Ed,
Thanks, yes for specific code where I load xcore to generate other things (like an epackage) it works. I still need to
get the validation to work, but that's something for later. (if I disable the validation I can generate texo code
directly from an xcore file, really nice!)

For the annotationsmodel issue.

When I use the sample ecore model editor to open a standard ecore file it works, I can refer from an ecore file to a
xcore file and open it correctly, also the genmodel/ecore.ecore model are opened (see the attached screenshot).

For my annotations model editor: I only have a generated edit plugin, but no editor plugin. Also I noticed that in my
model file I have a reference like this:
platform:/resource/org.eclipse.emf.texo.web.example/model/travel.xcore#/EPackage/Journey
while the library.ecore file (using the standard EMF editor) has this:
ecore:EClass travel.xcore#/EPackage/Journey

So it seems that that the sample model editor opens the xcore/references in a different way than I do (as it works). But
on my side I only have edit plugins (all generated a year ago btw). So it uses the standard editor plugins isn't then?

Maybe I should generate also an editor plugin? (to add the line you show below)?

gr. Martin

On 12/13/2013 06:13 AM, Ed Merks wrote:
> Martin,
>
> Probably more interesting is to see why the reflective editor is able to open a *.xcore file. Have a look at
> org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(). From what you describe, this is the most significant
> thing to consider first:
>
> resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>
>
>
> On 12/12/2013 11:19 PM, Martin Taal wrote:
>> Hi,
>> I am trying to integrate Xcore with Texo. I make nice progress, but also encounter 2 issues for which I would need
>> some advice:
>> - when I let Texo generate code from an epackage I first let Texo validate this epackage. The validation fails for an
>> epackage read from an xcore file. When I validate the xcore file directly (using the right-click option) it works
>> fine. Where is the code that implements this right click? Then I can maybe copy part of the approach there to validate
>> models from xcore files.
>>
>>
>> - in Texo it is possible to define a so-called annotations model. This is an instance file which refers to the
>> original model (in the xcore file in this case). When I try to open the annotations model in the standard generated
>> editor it gives an error on a missing genmodel or something. The annotations model references seem to correctly refer
>> to the xcore file next to it.
>>
>> I attached some screenshots and the xcore and the annotation model file.
>>
>> Thanks for any pointers on this!
>>
>> gr. Martin
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: XCore: refering from xmi/instance file to xcore file [message #1220741 is a reply to message #1220715] Fri, 13 December 2013 05:56 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
To add some info: I generate the annotations model file, when I generate the annotations model file it refers to the
xcore file. I load the xcore file using a resourceset (with the additional line you mention in the beginning). So my
'problem' with opening the annotations model file can be in 2 things:
- the uri's I use in the annotations model file are wrong
- I need to change the editor code which opens the annotations model file, so generate an editor plugin and customize it
I guess

What do you think is the main issue/problem and solution approach?

Thanks Ed!

gr. Martin

On 12/13/2013 10:14 AM, Martin Taal wrote:
> Hi Ed,
> Thanks, yes for specific code where I load xcore to generate other things (like an epackage) it works. I still need to
> get the validation to work, but that's something for later. (if I disable the validation I can generate texo code
> directly from an xcore file, really nice!)
>
> For the annotationsmodel issue.
>
> When I use the sample ecore model editor to open a standard ecore file it works, I can refer from an ecore file to a
> xcore file and open it correctly, also the genmodel/ecore.ecore model are opened (see the attached screenshot).
>
> For my annotations model editor: I only have a generated edit plugin, but no editor plugin. Also I noticed that in my
> model file I have a reference like this:
> platform:/resource/org.eclipse.emf.texo.web.example/model/travel.xcore#/EPackage/Journey
> while the library.ecore file (using the standard EMF editor) has this:
> ecore:EClass travel.xcore#/EPackage/Journey
>
> So it seems that that the sample model editor opens the xcore/references in a different way than I do (as it works). But
> on my side I only have edit plugins (all generated a year ago btw). So it uses the standard editor plugins isn't then?
>
> Maybe I should generate also an editor plugin? (to add the line you show below)?
>
> gr. Martin
>
> On 12/13/2013 06:13 AM, Ed Merks wrote:
>> Martin,
>>
>> Probably more interesting is to see why the reflective editor is able to open a *.xcore file. Have a look at
>> org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(). From what you describe, this is the most significant
>> thing to consider first:
>>
>> resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>
>>
>>
>> On 12/12/2013 11:19 PM, Martin Taal wrote:
>>> Hi,
>>> I am trying to integrate Xcore with Texo. I make nice progress, but also encounter 2 issues for which I would need
>>> some advice:
>>> - when I let Texo generate code from an epackage I first let Texo validate this epackage. The validation fails for an
>>> epackage read from an xcore file. When I validate the xcore file directly (using the right-click option) it works
>>> fine. Where is the code that implements this right click? Then I can maybe copy part of the approach there to validate
>>> models from xcore files.
>>>
>>>
>>> - in Texo it is possible to define a so-called annotations model. This is an instance file which refers to the
>>> original model (in the xcore file in this case). When I try to open the annotations model in the standard generated
>>> editor it gives an error on a missing genmodel or something. The annotations model references seem to correctly refer
>>> to the xcore file next to it.
>>>
>>> I attached some screenshots and the xcore and the annotation model file.
>>>
>>> Thanks for any pointers on this!
>>>
>>> gr. Martin
>>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: XCore: refering from xmi/instance file to xcore file [message #1220804 is a reply to message #1220741] Fri, 13 December 2013 12:39 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Okay found it, I had a generated editor plugin ofcourse..
Indeed needed to the line of code mentioned by you below Ed. The code generation also works (I needed to read the XCore
package and genmodel package in the packageregistry I am using for code generation).

So all good now!

gr. Martin

On 12/13/2013 11:56 AM, Martin Taal wrote:
> To add some info: I generate the annotations model file, when I generate the annotations model file it refers to the
> xcore file. I load the xcore file using a resourceset (with the additional line you mention in the beginning). So my
> 'problem' with opening the annotations model file can be in 2 things:
> - the uri's I use in the annotations model file are wrong
> - I need to change the editor code which opens the annotations model file, so generate an editor plugin and customize it
> I guess
>
> What do you think is the main issue/problem and solution approach?
>
> Thanks Ed!
>
> gr. Martin
>
> On 12/13/2013 10:14 AM, Martin Taal wrote:
>> Hi Ed,
>> Thanks, yes for specific code where I load xcore to generate other things (like an epackage) it works. I still need to
>> get the validation to work, but that's something for later. (if I disable the validation I can generate texo code
>> directly from an xcore file, really nice!)
>>
>> For the annotationsmodel issue.
>>
>> When I use the sample ecore model editor to open a standard ecore file it works, I can refer from an ecore file to a
>> xcore file and open it correctly, also the genmodel/ecore.ecore model are opened (see the attached screenshot).
>>
>> For my annotations model editor: I only have a generated edit plugin, but no editor plugin. Also I noticed that in my
>> model file I have a reference like this:
>> platform:/resource/org.eclipse.emf.texo.web.example/model/travel.xcore#/EPackage/Journey
>> while the library.ecore file (using the standard EMF editor) has this:
>> ecore:EClass travel.xcore#/EPackage/Journey
>>
>> So it seems that that the sample model editor opens the xcore/references in a different way than I do (as it works). But
>> on my side I only have edit plugins (all generated a year ago btw). So it uses the standard editor plugins isn't then?
>>
>> Maybe I should generate also an editor plugin? (to add the line you show below)?
>>
>> gr. Martin
>>
>> On 12/13/2013 06:13 AM, Ed Merks wrote:
>>> Martin,
>>>
>>> Probably more interesting is to see why the reflective editor is able to open a *.xcore file. Have a look at
>>> org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(). From what you describe, this is the most significant
>>> thing to consider first:
>>>
>>> resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>
>>>
>>>
>>> On 12/12/2013 11:19 PM, Martin Taal wrote:
>>>> Hi,
>>>> I am trying to integrate Xcore with Texo. I make nice progress, but also encounter 2 issues for which I would need
>>>> some advice:
>>>> - when I let Texo generate code from an epackage I first let Texo validate this epackage. The validation fails for an
>>>> epackage read from an xcore file. When I validate the xcore file directly (using the right-click option) it works
>>>> fine. Where is the code that implements this right click? Then I can maybe copy part of the approach there to validate
>>>> models from xcore files.
>>>>
>>>>
>>>> - in Texo it is possible to define a so-called annotations model. This is an instance file which refers to the
>>>> original model (in the xcore file in this case). When I try to open the annotations model in the standard generated
>>>> editor it gives an error on a missing genmodel or something. The annotations model references seem to correctly refer
>>>> to the xcore file next to it.
>>>>
>>>> I attached some screenshots and the xcore and the annotation model file.
>>>>
>>>> Thanks for any pointers on this!
>>>>
>>>> gr. Martin
>>>>
>>>
>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:EMF model with multiple resources
Next Topic:OSGI Configuration (Newbie)
Goto Forum:
  


Current Time: Sat Aug 30 16:28:01 EDT 2014

Powered by FUDForum. Page generated in 0.03902 seconds