Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » questions about ResourceSetReferencingResourceSet
questions about ResourceSetReferencingResourceSet [message #537326] Wed, 02 June 2010 00:46 Go to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2500
Registered: July 2009
Senior Member
Hi,
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?

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?

Regards
- henrik
Re: questions about ResourceSetReferencingResourceSet [message #537347 is a reply to message #537326] Wed, 02 June 2010 06:39 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Henrik Lindberg schrieb:
> Hi,
> 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.

Sven

--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:Testing the Grammar using the Parser and existing data set
Next Topic:[XText] Use serializer in Standalone mode
Goto Forum:
  


Current Time: Thu Nov 27 17:43:38 GMT 2014

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

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