How to get all Xtext resources from a Context Menu? [message #750813] |
Tue, 25 October 2011 18:57  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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!
>
|
|
|
Powered by
FUDForum. Page generated in 0.04281 seconds