Skip to main content


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 08:00 Go to next message
Björn Rellesch is currently offline Björn RelleschFriend
Messages: 38
Registered: January 2013
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 08:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access all Resources in Workspace [message #1116529 is a reply to message #1116328] Wed, 25 September 2013 15:10 Go to previous messageGo to next message
Björn Rellesch is currently offline Björn RelleschFriend
Messages: 38
Registered: January 2013
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 15:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access all Resources in Workspace [message #1116546 is a reply to message #1116534] Wed, 25 September 2013 15:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access all Resources in Workspace [message #1117489 is a reply to message #1116546] Thu, 26 September 2013 14:00 Go to previous messageGo to next message
Björn Rellesch is currently offline Björn RelleschFriend
Messages: 38
Registered: January 2013
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 14:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Access all Resources in Workspace [message #1220176 is a reply to message #1117519] Tue, 10 December 2013 08:57 Go to previous message
Björn Rellesch is currently offline Björn RelleschFriend
Messages: 38
Registered: January 2013
Member
Hello,

I fixed my problem. I followed the Code from the link http://kthoms.wordpress.com/2011/07/:

var index = resourceDescriptionsProvider.createResourceDescriptions() as IResourceDescriptions
var resDesc = index.getResourceDescription(resource.getURI()) as IResourceDescription
var visibleContainers = containerManager.getVisibleContainers(resDesc, index) as List<IContainer>
for (IContainer c : visibleContainers) {
for (IResourceDescription rd : c.getResourceDescriptions()) {
context.getResourceSet().getResource(rd.getURI(), true);
}

Greets Björn
Previous Topic:DSL debugger
Next Topic:Error while starting xtext-Editor as RCP
Goto Forum:
  


Current Time: Fri Mar 29 14:33:18 GMT 2024

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

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

Back to the top