|
|
|
Re: How to refresh a model cache when an external resource changes? [message #905428 is a reply to message #904820] |
Thu, 30 August 2012 11:13 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Aaron,
please make sure that IResourceDescription.Manager returns true on the
#isAffected query as soon as the dependent resource changes
significantly for your caching mechanism.
If that does not work for you for some reason, you'll most likely have
to implement that in your ValidationCache. Btw: Which sort of
information do you store in that cache. Is that something that should be
user data in the resource description itself?
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 29.08.12 10:03, schrieb Aaron Digulla:
> I keep a cache of expensive values in my code which is attached to the
> model:
>
>
> public static ValidationCache getValidationCache( EObject obj ) {
> final XtextResource res = (XtextResource) obj.eResource();
> final I18nDomainModel model = getModel( obj );
> return res.getCache().get( ValidationCache.class.getName(), res,
> new Provider<ValidationCache>() {
> @Override
> public ValidationCache get() {
> // log.debug( "New cache for " + res );
> return new ValidationCache( model );
> }
> } );
> }
>
>
> This works pretty well. Now I have an external resource with some
> options. For the sake of the question, let's say I have this:
>
>
> model.i18n <-- Xtext resource
> model.config <-- Additional resource
>
>
> I need to flush the cache when model.config is updated. How can I do that?
>
> Regards,
>
> A. Digulla
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02258 seconds