Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Filter resources from IResouceDescriptions in AbstractGlobalScope
Filter resources from IResouceDescriptions in AbstractGlobalScope [message #1714119] Tue, 10 November 2015 06:13 Go to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
Hi,
I need to filter different resources from the default IResourceDescriptions in the AbstractGlobalScopeProvider that is used in getVisibleContainers(Resource),

I want to filter the IResourceDesriptions that is passed to the containerManager.getVisibleContainers.

I tried to override getResourceDescriptions to be as the following:
---Create a ResourceSet
---loop on the resources in the super.getIResourceDescriptions(Resource)
-------Add resources to the resourceSet according to my criteria
---create an IResourceDescriptions by ResourceDescriptionsProvider.get(myResourceSet)

Actually this solved my problem but I noticed that ON THE FLY is no longer working across files!!!! do I need to add a special listener or what?!

I tried to create a predicate filter to filter the IEObjectDescriptions coming from these resources I wanted to filter, I did it like this:
---Create a predicate filter and in the apply method I did the below:
------get the EObject of the IEObjectDescriptions
------get the eResource.getURI() of the EObject
------if the URI is needed to be filtered out, then return false, otherwise return true.
---I passed this predicate filter to createContainerScopeWithContext

This didn't work at all, it always gave a null pointer exception at the EObject of the received IEObjectDescription in the filter!!!

Any Suggestions!


[Updated on: Tue, 10 November 2015 06:36]

Report message to a moderator

Re: Filter resources from IResouceDescriptions in AbstractGlobalScope [message #1714124 is a reply to message #1714119] Tue, 10 November 2015 07:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

what Kind of filtering do you actually want to do. can you be more specific on your usecase?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Filter resources from IResouceDescriptions in AbstractGlobalScope [message #1714126 is a reply to message #1714124] Tue, 10 November 2015 07:30 Go to previous messageGo to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
There are some resources that are done in the IProject that I want to filter out if they contain a special thing in the URI
Re: Filter resources from IResouceDescriptions in AbstractGlobalScope [message #1714128 is a reply to message #1714126] Tue, 10 November 2015 07:36 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Sound more like a usecase for org.eclipse.xtext.ui.resource.IResourceUIServiceProvider.canHandle(URI, IStorage)
or org.eclipse.xtext.resource.IResourceServiceProvider.canHandle(URI)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Performance issue parsing enclosed expression
Next Topic:DSL file dependency
Goto Forum:
  


Current Time: Thu Apr 25 07:25:57 GMT 2024

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

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

Back to the top