Skip to main content



      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 18:57 Go to next message
Eclipse UserFriend
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 19:42 Go to previous message
Eclipse UserFriend
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: Tue Jul 15 07:37:02 EDT 2025

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

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

Back to the top