PersistableResourceDescriptionsImpl validates the resource [message #632846] |
Thu, 14 October 2010 09:32  |
Eclipse User |
|
|
|
Hi,
if I save my model file, the validations are called twice. At first the editor checks the file to update error markers. Later the resource is updated in the Xtext index, which validates again and updates the markers.
Is the second check necessary for global scope and references outside the file?
I wrote checks to check if an element is referenced somewhere in the Xtext index, but this check was executed after a clean before the ResourceDescriptions are complete.
Benjamin
|
|
|
|
|
|
Re: PersistableResourceDescriptionsImpl validates the resource [message #633118 is a reply to message #633082] |
Fri, 15 October 2010 08:29  |
Eclipse User |
|
|
|
You missed the following :
if (result instanceof IResourceDescriptions.IContextAware) {
((IResourceDescriptions.IContextAware) result).setContext(ctx);
}
Sven
Am 10/15/10 12:17 PM, schrieb Benjamin Schwertfeger:
> Thanks,
> I tried to get the two resource descriptions and use the builder one, if
> the loadOption is set. If I save the file, the
> builderScopeResourceDescriptions are asked for resources and throw a NPE
> because of not set resource descriptions inside the
> ShadowingResourceDescriptions:
>
>
> @Inject
> private IResourceDescriptions resourceDescriptions;
> @Inject
> @Named(AbstractGlobalScopeProvider.NAMED_BUILDER_SCOPE)
> private Provider<IResourceDescriptions>
> builderScopeResourceDescriptionsProvider;
>
> public boolean isReferenced(final EObject object) {
> IResourceDescriptions descriptions = resourceDescriptions;
> Map<Object, Object> loadOptions =
> object.eResource().getResourceSet().getLoadOptions();
> if
> (Boolean.TRUE.equals(loadOptions.get(AbstractGlobalScopeProv ider.NAMED_BUILDER_SCOPE)))
> {
> descriptions =
> builderScopeResourceDescriptionsProvider.get();
> }
> //this throws the exception after save:
> final Iterable<IResourceDescription> allResourceDescriptions =
> descriptions.getAllResourceDescriptions();
>
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.66564 seconds