Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Initialize Xcore/XTextResourceFactory
Initialize Xcore/XTextResourceFactory [message #1220856] Sat, 14 December 2013 08:51 Go to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi,
I can read XCore files through a Resource/ResourceSet. This works fine when I run the Texo code generation in Eclipse (I
create a ResourceSet and through some auto-magic it creates the correct XcoreResource).

But it does not work when I run the code generation as a plugin-test case (the test has the xcore plugin and its
dependency in the launch config). In that case a XMIResource gets created which fails when reading the xcore file.

Is there some initialization or some specific Xtext/Xcore thing I need to/can do so that my ResourceSet correctly
resolves the xcore uri's?

My current code:

final ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", //$NON-NLS-1$
new EcoreResourceFactoryImpl());
rs.setPackageRegistry(registry);
rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));


--

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: Initialize Xcore/XTextResourceFactory [message #1220864 is a reply to message #1220856] Sat, 14 December 2013 15:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
I made some progress, adding the xcore.ui plugin (and its dependencies) reads the xcore files into a Resource. This
works mostly except for references across xcore files. The files are in the same directory, but the references are not
resolved it seems.

I only read one of the files in a resource (using resourceSet.createResource(..)), I expected the other file to be read
also when the references are resolved.
Should I somehow setup/configure the resourceset?

I attached the xcore files I use for testing.

gr. Martin

On 12/14/2013 02:51 PM, Martin Taal wrote:
> Hi,
> I can read XCore files through a Resource/ResourceSet. This works fine when I run the Texo code generation in Eclipse (I
> create a ResourceSet and through some auto-magic it creates the correct XcoreResource).
>
> But it does not work when I run the code generation as a plugin-test case (the test has the xcore plugin and its
> dependency in the launch config). In that case a XMIResource gets created which fails when reading the xcore file.
>
> Is there some initialization or some specific Xtext/Xcore thing I need to/can do so that my ResourceSet correctly
> resolves the xcore uri's?
>
> My current code:
>
> final ResourceSet rs = new ResourceSetImpl();
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", //$NON-NLS-1$
> new EcoreResourceFactoryImpl());
> rs.setPackageRegistry(registry);
> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>
>


--

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.sport.club

import org.eclipse.emf.texo.test.model.samples.sport.society.Society

class Club extends Society
{
contains Team[] teams
}

class Team
{
String name
refers Member[] members
}

class Member
{
String name
String lastName
int age
Gender gender
}

enum Gender
{
male, female
}
package org.eclipse.emf.texo.test.model.samples.sport.competition

import org.eclipse.emf.texo.test.model.samples.sport.club.Team

class Competition {
String name
refers Team[] teams
}
package org.eclipse.emf.texo.test.model.samples.sport.society

class Society
{
String name
}
Re: Initialize Xcore/XTextResourceFactory [message #1220965 is a reply to message #1220864] Mon, 16 December 2013 06:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Martin,

What URI are you using to load the resource? I ask because Xtext's
indexing infrastructure needs to determine which IJavaProject the
resource is in so that it can use the index for that Java project to
resolve cross file references...

On 14/12/2013 9:50 PM, Martin Taal wrote:
> I made some progress, adding the xcore.ui plugin (and its
> dependencies) reads the xcore files into a Resource. This works mostly
> except for references across xcore files. The files are in the same
> directory, but the references are not resolved it seems.
>
> I only read one of the files in a resource (using
> resourceSet.createResource(..)), I expected the other file to be read
> also when the references are resolved.
> Should I somehow setup/configure the resourceset?
>
> I attached the xcore files I use for testing.
>
> gr. Martin
>
> On 12/14/2013 02:51 PM, Martin Taal wrote:
>> Hi,
>> I can read XCore files through a Resource/ResourceSet. This works
>> fine when I run the Texo code generation in Eclipse (I
>> create a ResourceSet and through some auto-magic it creates the
>> correct XcoreResource).
>>
>> But it does not work when I run the code generation as a plugin-test
>> case (the test has the xcore plugin and its
>> dependency in the launch config). In that case a XMIResource gets
>> created which fails when reading the xcore file.
>>
>> Is there some initialization or some specific Xtext/Xcore thing I
>> need to/can do so that my ResourceSet correctly
>> resolves the xcore uri's?
>>
>> My current code:
>>
>> final ResourceSet rs = new ResourceSetImpl();
>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
>> //$NON-NLS-1$
>> new EcoreResourceFactoryImpl());
>> rs.setPackageRegistry(registry);
>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>
>>
>
>
Re: Initialize Xcore/XTextResourceFactory [message #1220970 is a reply to message #1220965] Mon, 16 December 2013 06:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Ed,
Indeed that was the problem, I now make sure that the project is refreshed before I run the headless build. This seems
to help. Also the project has a xtext nature set that helps to.

gr. Martin

On 12/16/2013 12:37 PM, Ed Merks wrote:
> Martin,
>
> What URI are you using to load the resource? I ask because Xtext's indexing infrastructure needs to determine which
> IJavaProject the resource is in so that it can use the index for that Java project to resolve cross file references...
>
> On 14/12/2013 9:50 PM, Martin Taal wrote:
>> I made some progress, adding the xcore.ui plugin (and its dependencies) reads the xcore files into a Resource. This
>> works mostly except for references across xcore files. The files are in the same directory, but the references are not
>> resolved it seems.
>>
>> I only read one of the files in a resource (using resourceSet.createResource(..)), I expected the other file to be
>> read also when the references are resolved.
>> Should I somehow setup/configure the resourceset?
>>
>> I attached the xcore files I use for testing.
>>
>> gr. Martin
>>
>> On 12/14/2013 02:51 PM, Martin Taal wrote:
>>> Hi,
>>> I can read XCore files through a Resource/ResourceSet. This works fine when I run the Texo code generation in Eclipse (I
>>> create a ResourceSet and through some auto-magic it creates the correct XcoreResource).
>>>
>>> But it does not work when I run the code generation as a plugin-test case (the test has the xcore plugin and its
>>> dependency in the launch config). In that case a XMIResource gets created which fails when reading the xcore file.
>>>
>>> Is there some initialization or some specific Xtext/Xcore thing I need to/can do so that my ResourceSet correctly
>>> resolves the xcore uri's?
>>>
>>> My current code:
>>>
>>> final ResourceSet rs = new ResourceSetImpl();
>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", //$NON-NLS-1$
>>> new EcoreResourceFactoryImpl());
>>> rs.setPackageRegistry(registry);
>>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>
>>>
>>
>>
>


--

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: Initialize Xcore/XTextResourceFactory [message #1221259 is a reply to message #1220965] Tue, 17 December 2013 03:45 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Ed,
Still struggling with xtext getting to identify other xcore files in the same project. I have tried different uris to
load the xcore resource (through a resourceset), for example:
/org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-competition.xcore
where the first segment is the project name.

To give some context, I start a launch config which runs headless and then programmatically generates files based on
models read through resources. I can get to the IProject and other things. I also tried refreshing the dev project
programmatically before I load the resource (to hope that xtext would 'fire' on a refresh).

Is there a way that I can 'force' xtext to scan a certain directory/folder/project? Where does xtext store all the
resolved xcores/types?

gr. Martin

On 12/16/2013 12:37 PM, Ed Merks wrote:
> Martin,
>
> What URI are you using to load the resource? I ask because Xtext's indexing infrastructure needs to determine which
> IJavaProject the resource is in so that it can use the index for that Java project to resolve cross file references...
>
> On 14/12/2013 9:50 PM, Martin Taal wrote:
>> I made some progress, adding the xcore.ui plugin (and its dependencies) reads the xcore files into a Resource. This
>> works mostly except for references across xcore files. The files are in the same directory, but the references are not
>> resolved it seems.
>>
>> I only read one of the files in a resource (using resourceSet.createResource(..)), I expected the other file to be
>> read also when the references are resolved.
>> Should I somehow setup/configure the resourceset?
>>
>> I attached the xcore files I use for testing.
>>
>> gr. Martin
>>
>> On 12/14/2013 02:51 PM, Martin Taal wrote:
>>> Hi,
>>> I can read XCore files through a Resource/ResourceSet. This works fine when I run the Texo code generation in Eclipse (I
>>> create a ResourceSet and through some auto-magic it creates the correct XcoreResource).
>>>
>>> But it does not work when I run the code generation as a plugin-test case (the test has the xcore plugin and its
>>> dependency in the launch config). In that case a XMIResource gets created which fails when reading the xcore file.
>>>
>>> Is there some initialization or some specific Xtext/Xcore thing I need to/can do so that my ResourceSet correctly
>>> resolves the xcore uri's?
>>>
>>> My current code:
>>>
>>> final ResourceSet rs = new ResourceSetImpl();
>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", //$NON-NLS-1$
>>> new EcoreResourceFactoryImpl());
>>> rs.setPackageRegistry(registry);
>>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>
>>>
>>
>>
>


--

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: Initialize Xcore/XTextResourceFactory [message #1222156 is a reply to message #1221259] Thu, 19 December 2013 14:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Martin,

Comments below.

On 17/12/2013 9:45 AM, Martin Taal wrote:
> Hi Ed,
> Still struggling with xtext getting to identify other xcore files in
> the same project. I have tried different uris to load the xcore
> resource (through a resourceset), for example:
> /org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-competition.xcore
>
It should use platform:/resource/<project-name>/<path-in-project>
> where the first segment is the project name.
>
> To give some context, I start a launch config which runs headless and
> then programmatically generates files based on models read through
> resources. I can get to the IProject and other things. I also tried
> refreshing the dev project programmatically before I load the resource
> (to hope that xtext would 'fire' on a refresh).
>
> Is there a way that I can 'force' xtext to scan a certain
> directory/folder/project?
It generally does that for any project with an Xtext nature.
> Where does xtext store all the resolved xcores/types?
Good question. I'm not sure. Somewhere in the workspace's .metadata...
>
> gr. Martin
>
> On 12/16/2013 12:37 PM, Ed Merks wrote:
>> Martin,
>>
>> What URI are you using to load the resource? I ask because Xtext's
>> indexing infrastructure needs to determine which
>> IJavaProject the resource is in so that it can use the index for that
>> Java project to resolve cross file references...
>>
>> On 14/12/2013 9:50 PM, Martin Taal wrote:
>>> I made some progress, adding the xcore.ui plugin (and its
>>> dependencies) reads the xcore files into a Resource. This
>>> works mostly except for references across xcore files. The files are
>>> in the same directory, but the references are not
>>> resolved it seems.
>>>
>>> I only read one of the files in a resource (using
>>> resourceSet.createResource(..)), I expected the other file to be
>>> read also when the references are resolved.
>>> Should I somehow setup/configure the resourceset?
>>>
>>> I attached the xcore files I use for testing.
>>>
>>> gr. Martin
>>>
>>> On 12/14/2013 02:51 PM, Martin Taal wrote:
>>>> Hi,
>>>> I can read XCore files through a Resource/ResourceSet. This works
>>>> fine when I run the Texo code generation in Eclipse (I
>>>> create a ResourceSet and through some auto-magic it creates the
>>>> correct XcoreResource).
>>>>
>>>> But it does not work when I run the code generation as a
>>>> plugin-test case (the test has the xcore plugin and its
>>>> dependency in the launch config). In that case a XMIResource gets
>>>> created which fails when reading the xcore file.
>>>>
>>>> Is there some initialization or some specific Xtext/Xcore thing I
>>>> need to/can do so that my ResourceSet correctly
>>>> resolves the xcore uri's?
>>>>
>>>> My current code:
>>>>
>>>> final ResourceSet rs = new ResourceSetImpl();
>>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
>>>> //$NON-NLS-1$
>>>> new EcoreResourceFactoryImpl());
>>>> rs.setPackageRegistry(registry);
>>>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
Re: Initialize Xcore/XTextResourceFactory [message #1230712 is a reply to message #1222156] Sun, 12 January 2014 17:09 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Ed,
Thanks, I am still struggling with that references between xcore files are not resolved when I read the xcore files in a
ResourceSetImpl. I even make sure that the xcore files are all read in the same resourceset. Also the xcore resource
contains contents with an XPackage and EPackage etc. Only the references between xcore files are not resolved.

I use platform uri's and I see that the resourceset has a resource with a uri like this:
platform:/resource/org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-society.xcore

This seems to be all fine, but the resourceset also has a resource with this uri:
platform:/resource/org.eclipse.emf.ecore/model/Ecore.xcore'

and this resource has an error:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException:
/model/Ecore.xcore

The error in the xcore file is this:
XtextLinkingDiagnostic: null:5 Couldn't resolve reference to GenBase 'Society'.

This although the XClass Society is present in a XCoreresource in the same ResourceSet.

So I must still be doing something wrong but have no clue...



On 12/19/2013 08:46 PM, Ed Merks wrote:
> Martin,
>
> Comments below.
>
> On 17/12/2013 9:45 AM, Martin Taal wrote:
>> Hi Ed,
>> Still struggling with xtext getting to identify other xcore files in the same project. I have tried different uris to
>> load the xcore resource (through a resourceset), for example:
>> /org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-competition.xcore
>>
> It should use platform:/resource/<project-name>/<path-in-project>
>> where the first segment is the project name.
>>
>> To give some context, I start a launch config which runs headless and then programmatically generates files based on
>> models read through resources. I can get to the IProject and other things. I also tried refreshing the dev project
>> programmatically before I load the resource (to hope that xtext would 'fire' on a refresh).
>>
>> Is there a way that I can 'force' xtext to scan a certain directory/folder/project?
> It generally does that for any project with an Xtext nature.
>> Where does xtext store all the resolved xcores/types?
> Good question. I'm not sure. Somewhere in the workspace's .metadata...
>>
>> gr. Martin
>>
>> On 12/16/2013 12:37 PM, Ed Merks wrote:
>>> Martin,
>>>
>>> What URI are you using to load the resource? I ask because Xtext's indexing infrastructure needs to determine which
>>> IJavaProject the resource is in so that it can use the index for that Java project to resolve cross file references...
>>>
>>> On 14/12/2013 9:50 PM, Martin Taal wrote:
>>>> I made some progress, adding the xcore.ui plugin (and its dependencies) reads the xcore files into a Resource. This
>>>> works mostly except for references across xcore files. The files are in the same directory, but the references are not
>>>> resolved it seems.
>>>>
>>>> I only read one of the files in a resource (using resourceSet.createResource(..)), I expected the other file to be
>>>> read also when the references are resolved.
>>>> Should I somehow setup/configure the resourceset?
>>>>
>>>> I attached the xcore files I use for testing.
>>>>
>>>> gr. Martin
>>>>
>>>> On 12/14/2013 02:51 PM, Martin Taal wrote:
>>>>> Hi,
>>>>> I can read XCore files through a Resource/ResourceSet. This works fine when I run the Texo code generation in
>>>>> Eclipse (I
>>>>> create a ResourceSet and through some auto-magic it creates the correct XcoreResource).
>>>>>
>>>>> But it does not work when I run the code generation as a plugin-test case (the test has the xcore plugin and its
>>>>> dependency in the launch config). In that case a XMIResource gets created which fails when reading the xcore file.
>>>>>
>>>>> Is there some initialization or some specific Xtext/Xcore thing I need to/can do so that my ResourceSet correctly
>>>>> resolves the xcore uri's?
>>>>>
>>>>> My current code:
>>>>>
>>>>> final ResourceSet rs = new ResourceSetImpl();
>>>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", //$NON-NLS-1$
>>>>> new EcoreResourceFactoryImpl());
>>>>> rs.setPackageRegistry(registry);
>>>>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


--

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: Initialize Xcore/XTextResourceFactory [message #1231224 is a reply to message #1230712] Tue, 14 January 2014 00:16 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Martin,

Comments below.

On 12/01/2014 11:09 PM, Martin Taal wrote:
> Hi Ed,
> Thanks, I am still struggling with that references between xcore files
> are not resolved when I read the xcore files in a ResourceSetImpl. I
> even make sure that the xcore files are all read in the same
> resourceset. Also the xcore resource contains contents with an
> XPackage and EPackage etc. Only the references between xcore files are
> not resolved.
>
> I use platform uri's and I see that the resourceset has a resource
> with a uri like this:
> platform:/resource/org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-society.xcore
>
It always seems problematic to keep them in a src folder because the
generator generates references to them in the plugin.xml and that src
folder won't exist in the binary plugin...
>
> This seems to be all fine, but the resourceset also has a resource
> with this uri:
> platform:/resource/org.eclipse.emf.ecore/model/Ecore.xcore'
That's a synthetic resource created on the fly. It doesn't really
physically exist...
>
> and this resource has an error:
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
> java.io.FileNotFoundException: /model/Ecore.xcore
>
> The error in the xcore file is this:
> XtextLinkingDiagnostic: null:5 Couldn't resolve reference to GenBase
> 'Society'.
>
> This although the XClass Society is present in a XCoreresource in the
> same ResourceSet.
When you're running the tests, is there really a workspace with those
resources in it?
>
> So I must still be doing something wrong but have no clue...
Maybe it's good to have a look at the Xcore unit tests and how/why they
work...

You might want to use our setup tool to setup the Xcore environment for
that purpose: https://wiki.eclipse.org/Setup-Eclipse
>
>
>
> On 12/19/2013 08:46 PM, Ed Merks wrote:
>> Martin,
>>
>> Comments below.
>>
>> On 17/12/2013 9:45 AM, Martin Taal wrote:
>>> Hi Ed,
>>> Still struggling with xtext getting to identify other xcore files in
>>> the same project. I have tried different uris to
>>> load the xcore resource (through a resourceset), for example:
>>> /org.eclipse.emf.texo.modelgenerator.test/src/org/eclipse/emf/texo/modelgenerator/test/models/samples/sport-competition.xcore
>>>
>>>
>> It should use platform:/resource/<project-name>/<path-in-project>
>>> where the first segment is the project name.
>>>
>>> To give some context, I start a launch config which runs headless
>>> and then programmatically generates files based on
>>> models read through resources. I can get to the IProject and other
>>> things. I also tried refreshing the dev project
>>> programmatically before I load the resource (to hope that xtext
>>> would 'fire' on a refresh).
>>>
>>> Is there a way that I can 'force' xtext to scan a certain
>>> directory/folder/project?
>> It generally does that for any project with an Xtext nature.
>>> Where does xtext store all the resolved xcores/types?
>> Good question. I'm not sure. Somewhere in the workspace's .metadata...
>>>
>>> gr. Martin
>>>
>>> On 12/16/2013 12:37 PM, Ed Merks wrote:
>>>> Martin,
>>>>
>>>> What URI are you using to load the resource? I ask because Xtext's
>>>> indexing infrastructure needs to determine which
>>>> IJavaProject the resource is in so that it can use the index for
>>>> that Java project to resolve cross file references...
>>>>
>>>> On 14/12/2013 9:50 PM, Martin Taal wrote:
>>>>> I made some progress, adding the xcore.ui plugin (and its
>>>>> dependencies) reads the xcore files into a Resource. This
>>>>> works mostly except for references across xcore files. The files
>>>>> are in the same directory, but the references are not
>>>>> resolved it seems.
>>>>>
>>>>> I only read one of the files in a resource (using
>>>>> resourceSet.createResource(..)), I expected the other file to be
>>>>> read also when the references are resolved.
>>>>> Should I somehow setup/configure the resourceset?
>>>>>
>>>>> I attached the xcore files I use for testing.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> On 12/14/2013 02:51 PM, Martin Taal wrote:
>>>>>> Hi,
>>>>>> I can read XCore files through a Resource/ResourceSet. This works
>>>>>> fine when I run the Texo code generation in
>>>>>> Eclipse (I
>>>>>> create a ResourceSet and through some auto-magic it creates the
>>>>>> correct XcoreResource).
>>>>>>
>>>>>> But it does not work when I run the code generation as a
>>>>>> plugin-test case (the test has the xcore plugin and its
>>>>>> dependency in the launch config). In that case a XMIResource gets
>>>>>> created which fails when reading the xcore file.
>>>>>>
>>>>>> Is there some initialization or some specific Xtext/Xcore thing I
>>>>>> need to/can do so that my ResourceSet correctly
>>>>>> resolves the xcore uri's?
>>>>>>
>>>>>> My current code:
>>>>>>
>>>>>> final ResourceSet rs = new ResourceSetImpl();
>>>>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
>>>>>> //$NON-NLS-1$
>>>>>> new EcoreResourceFactoryImpl());
>>>>>> rs.setPackageRegistry(registry);
>>>>>> rs.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
Previous Topic:Why its happening? "Internal error occurred during Validation Job. Property is invalid."
Next Topic:How to obtain Resource URI's in-project relative path (for use in Xtext IGenerator IFileSystemAccess
Goto Forum:
  


Current Time: Fri Apr 18 10:14:07 EDT 2014

Powered by FUDForum. Page generated in 0.02469 seconds