|Re: questions about ResourceSetReferencingResourceSet [message #537347 is a reply to message #537326]
||Wed, 02 June 2010 06:39
| Sven Efftinge
Registered: July 2009
Henrik Lindberg schrieb:|
> I want to have a Resource in memory that is shared between all editors
> of my language (to make it easy to use things discovered from the
> environment and handed out via scope providers).
> So far, I have written a Provider<XtextResourceSet> that adds my magic
> resource to the set. This simple setup will however give me one new such
> resource instance per editor.
> If I understand it correctly, a Resource instance is connected to one
> ResourceSet, so I can not simply have my ResourceFactory hand out the
> same Resource instance on different requests. Also, since the contents
> of a Resource knows about its Resource (instance) I can not add the same
> instances to multiple resources.
> I found the ResourceSetReferencingResourceSet interface and
> implementation, and this looks like what I would like to use. Is this
> intended for this sort of thing?
Yes, it was designed to do exactly that.
However, we don't use it as we solve things differently now, but the
implementation is still there, because we found it might be useful.
Maybe Ed should have a look, and check whether it breaks any EMF contracts.
> I noticed that the default set up uses SynchronizedXtextResourceSet,
> while the referencing set extends the non synchronized. Is it important
> to use the synchronized set? If so, should I inject a referencing set
> that refers to a synchronizing set and my special set - or - am I
> confused over how these work?
That SynchonizedResourceSet is there to avaoid concurrency issues when
resolving proxies. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=312501
I think they don't work well together (even if the first would extend
the latter). Maybe if the referenced resource set is considered immutable.
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Powered by FUDForum
. Page generated in 0.01531 seconds