Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to get all Xtext resources from a Context Menu?
How to get all Xtext resources from a Context Menu? [message #750813] Tue, 25 October 2011 22:57 Go to next message
Lucy Sakhnenko is currently offline Lucy SakhnenkoFriend
Messages: 41
Registered: March 2011
Member
Hi,

I'm trying do load all Xtext resources from a Context Menu. I started with I posted previously here: http://www.eclipse.org/forums/index.php/t/256561/

It worked great.

Now, I changed to action to appear when I right click over the project.

Inside the action, I wrote this code:

if (firstElement instanceof Project) {
				IProject project = (IProject)firstElement;
				
				ResourceSet rs = resourceSetProvider.get(project);
	                        //What to do here?


I have tried several things with the resourceSetProvider and resourceDescriptions injected variables, but all of them return either empty sets or null.


What should I do to get all the Xtext resources or resources by type or file extension from a project's context menu?

Thanks!
Re: How to get all Xtext resources from a Context Menu? [message #750908 is a reply to message #750813] Tue, 25 October 2011 23:42 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Use IProject's API to iterate over all of the contained resources,
filter out the ones you don't want, and produce the URI for others, load
each URI as a resource into a resource set.

Regards
- henrik

On 10/26/11 12:57 AM, Lucy wrote:
> Hi,
>
> I'm trying do load all Xtext resources from a Context Menu. I started
> with I posted previously here:
> http://www.eclipse.org/forums/index.php/t/256561/
>
> It worked great.
>
> Now, I changed to action to appear when I right click over the project.
>
> Inside the action, I wrote this code:
>
>
> if (firstElement instanceof Project) {
> IProject project = (IProject)firstElement;
>
> ResourceSet rs = resourceSetProvider.get(project);
> //What to do here?
>
>
> I have tried several things with the resourceSetProvider and
> resourceDescriptions injected variables, but all of them return either
> empty sets or null.
>
>
> What should I do to get all the Xtext resources or resources by type or
> file extension from a project's context menu?
>
> Thanks!
>
Previous Topic:Trying to migrate to Xtext 2.1 (latest from head)
Next Topic:IMPORT issue
Goto Forum:
  


Current Time: Fri Apr 26 02:47:02 GMT 2024

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

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

Back to the top