Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Access all Resources in Workspace
Access all Resources in Workspace [message #1116299] Wed, 25 September 2013 04:00 Go to next message
Björn Rellesch is currently offline Björn Rellesch
Messages: 24
Registered: January 2013
Junior Member
Hello,

I want to access all resources from my DSL files.
If I change a file, the resorces which are passed to the generator are only the recources of the actual file and the dependent file.
But I need all resources in my workspace.
How can I achieve this?

Greets Björn
Re: Access all Resources in Workspace [message #1116328 is a reply to message #1116299] Wed, 25 September 2013 04:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
Hi, what is you use case.

You might inject IResoucesDescriptions (aka the index) as starting
point.

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Access all Resources in Workspace [message #1116529 is a reply to message #1116328] Wed, 25 September 2013 11:10 Go to previous messageGo to next message
Björn Rellesch is currently offline Björn Rellesch
Messages: 24
Registered: January 2013
Junior Member
Hi,

we want to generate one configuration-file.
This file includes several configuration-components.
Every component can be modelled with a DSL.

Use-Cases:
If I generate one component, the configuration-file includes only the data from the specific configuration-component.
Another usecase is to make a change on one component, but I want to generate the complete configuration-file including all unchanged components and the changed component.

The first usecase works out-of-the-box.
The second one is my problem.

Greets Björn
Re: Access all Resources in Workspace [message #1116534 is a reply to message #1116529] Wed, 25 September 2013 11:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
Hmm if guess you have to handle that yourself.
i dont know if http://kthoms.wordpress.com/2011/07/12/xtend-generating-from-multiple-input-models/
covers your usecase if you do NOT do a clean build.
Re: Access all Resources in Workspace [message #1116546 is a reply to message #1116534] Wed, 25 September 2013 11:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
p.s.

but as i said before: the index gives you access to all resourcedescriptions.
and these to resources or objects of a certain type .
i dont know what you need in hands to generate your stuff.
Re: Access all Resources in Workspace [message #1117489 is a reply to message #1116546] Thu, 26 September 2013 10:00 Go to previous messageGo to next message
Björn Rellesch is currently offline Björn Rellesch
Messages: 24
Registered: January 2013
Junior Member
Hello Christian,

I know about the link you mentioned. I tried this several weeks ago. I got a problem, that I wasn't able to export the Xtext Pugins (you sopported me: http://www.eclipse.org/forums/index.php/m/1081490/#msg_1081490). So overriding the BuilderParticipant doesn't work for me. Unfortunately I can't find the reason for my Problem.

If I try to access the Index, I get only the descriptions from the actual resource and all its depending resources. That's not what I want.

I want to access all resources in the complete workspace with a specific type, not only one resouce, from which the generator is called.
I realized, that after the start of the DSL-Editor for all dsl-actefacts the generator is called with the complete set of all resources in the workspace. But this action is only sometimes done (I think, if the Xtext-Builder realizes, that a complete refrsh and build is necessary). But I want to use a comparable funtionality.
Do you have another idea to achieve this?

Greets Björn
Re: Access all Resources in Workspace [message #1117519 is a reply to message #1117489] Thu, 26 September 2013 10:30 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
Hi,

if you inject IResourceDescriptions and ask if for org.eclipse.xtext.resource.IResourceDescriptions.getAllResourceDescriptions()
you should get all resources.

or you call getExportedObjectsByType(EClass) to get all IEObjectDescriptions of a certain type.
Previous Topic:Old vs new serializer
Next Topic:Formatter adds line breaks
Goto Forum:
  


Current Time: Mon Oct 07 10:36:15 EDT 2013

Powered by FUDForum. Page generated in 0.02401 seconds