Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextEditor with external context(Enriching Content Assist with information from an external source)
XtextEditor with external context [message #900707] Wed, 08 August 2012 08:55 Go to next message
Philipp M. Fischer is currently offline Philipp M. FischerFriend
Messages: 67
Registered: November 2010
Location: Germany
Member
Hi There,

I am using an embedded XtextEditor starting it with an in memory representation of the instantiated dsl model. It is saved as string to an object that carries some extra information in its members. Within the content assist of the editor i want to be able to access these members but the conext just gives me access to either the dsl model or the xtextdocument. I cant find a convienent way to get access to my object with the extra data i need. I was wondering if i can hand over my object to the xtextdocument when i am creating my editor. Does anyone have a good idea of how to maintain the context to my user object? Confused

Cheers

Phil
Re: XtextEditor with external context [message #900860 is a reply to message #900707] Wed, 08 August 2012 18:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

just an untested fast and stupid guess:
what about subclassing the XtextResource, store the information there (IEditedResourceProvider)
and then downcast the Context Objects Resource in the ProposalProvider and take the information out again?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XtextEditor with external context [message #900881 is a reply to message #900860] Wed, 08 August 2012 19:31 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-08-08 20:06, Christian Dietrich wrote:
> Hi,
>
> just an untested fast and stupid guess:
> what about subclassing the XtextResource, store the information there
> (IEditedResourceProvider)
> and then downcast the Context Objects Resource in the ProposalProvider
> and take the information out again?
>
> ~Christian
I use a ResourceAdapter for similar things, have one that sets various
properties.

https://github.com/cloudsmith/geppetto/blob/master/org.cloudsmith.geppetto.pp.dsl/src/org/cloudsmith/geppetto/pp/dsl/adapters/ResourcePropertiesAdapter.java


and its Factory in the same package

Hope that helps. Then just adapt the resource when needed. Works well in
my use cases.

Regards
- henrik
Previous Topic:How to resolve ambiguity with label syntax
Next Topic:Problems with Java 7 in validation package
Goto Forum:
  


Current Time: Fri Apr 19 22:15:52 GMT 2024

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

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

Back to the top