Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content assist context
Content assist context [message #59987] Fri, 17 July 2009 10:21 Go to next message
Sebastian Benz is currently offline Sebastian BenzFriend
Messages: 24
Registered: July 2009
Junior Member
Hello,

I have a question regarding the content assist context. In the generated
myDsl example, when I invoke the code completion after attr, the context
object is an instance of "Model" and not an instance of "Class" as I would
have expected.

class Name {
attr ...

}


public void completeAssignment(Assignment assignment, ContentAssistContext
contentAssistContext, ICompletionProposalAcceptor acceptor) {

//contentAssistContext.getCurrentModel() -> instanceof Model

}


However, I want to restrict the possible values based on the enclosing
class. My question is, how can I retrieve the instance of the enclosing
class?

Regards,

Sebastian
Re: Content assist context [message #60039 is a reply to message #59987] Fri, 17 July 2009 12:05 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Sebastian,

this is a bug. Please file a ticket.

Sorry for inconvenience,
Sebastian

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


Am 17.07.2009 12:21 Uhr, schrieb Sebastian Benz:
> Hello,
>
> I have a question regarding the content assist context. In the generated
> myDsl example, when I invoke the code completion after attr, the context
> object is an instance of "Model" and not an instance of "Class" as I
> would have expected.
> class Name {
> attr ...
>
> }
>
>
> public void completeAssignment(Assignment assignment,
> ContentAssistContext contentAssistContext, ICompletionProposalAcceptor
> acceptor) {
> //contentAssistContext.getCurrentModel() -> instanceof Model
>
> }
>
>
> However, I want to restrict the possible values based on the enclosing
> class. My question is, how can I retrieve the instance of the enclosing
> class?
>
> Regards,
>
> Sebastian
>
>
>
>
>
Re: Content assist context [message #60064 is a reply to message #60039] Fri, 17 July 2009 14:36 Go to previous message
Sebastian Benz is currently offline Sebastian BenzFriend
Messages: 24
Registered: July 2009
Junior Member
I filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=283857

A workaround is to create a dummy rule for the attribute:

Attribute:
'attr' name=Name ':' type=[DataType] ';'?;

Name returns ecore::EString :
ID
;

Sebastian
Previous Topic:[Xtext] Update highlighting after document change
Next Topic:[Announce] TMF XTEXT 0.7.1 is available
Goto Forum:
  


Current Time: Sat Dec 21 12:12:21 GMT 2024

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

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

Back to the top