Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how to check the condition for instance of class had been created in xtext editor
how to check the condition for instance of class had been created in xtext editor [message #1807441] Thu, 30 May 2019 08:43 Go to next message
Nagashree KN is currently offline Nagashree KNFriend
Messages: 32
Registered: September 2018
Member
Hi,
I have created xtext projects using existing ecore model. There i have one condition like instance of class should be only one.
In Xtext editor on doing contrl+space it will list down the class names to be created. In my editor i want to create class instance only once, means again on doing control+space it should not show the created class name in the list only.
i am attaching images for better understanding.
Any one can please help me how i can do this kind of validations in editor.

Thanks!
Re: how to check the condition for instance of class had been created in xtext editor [message #1807442 is a reply to message #1807441] Thu, 30 May 2019 08:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
simply filter the proposals.
have a look what xtext generates in the abstractyourdslproposal provider and customize it to your needs
alternatively you could do the filtering inside the scopeprovider too. (might need use of nodemodelutils)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 30 May 2019 09:03]

Report message to a moderator

Re: how to check the condition for instance of class had been created in xtext editor [message #1807503 is a reply to message #1807442] Fri, 31 May 2019 11:04 Go to previous messageGo to next message
Nagashree KN is currently offline Nagashree KNFriend
Messages: 32
Registered: September 2018
Member
Thanks for quick replay. i had a look at proposalprovider class.
i am not able achieve one thing here that is, first time on doing ctrl+space in editor it will show the list . from that list i will select one thing. now what i want is again on doing ctrl+space the one which i have created it should not shown in the list . i tried by overriding the method complete[elementname]_[Featurename]() but still it is not working.
How i can achieve this?
Re: how to check the condition for instance of class had been created in xtext editor [message #1807505 is a reply to message #1807503] Fri, 31 May 2019 11:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
There is a complete xxxx method for your reference
Override it. Have a look at what the super impl does
It calls lookupCrossReference
There are variants that have a filter
Call it with a filter you implement yourself
Instead of the always true filter

The method also has a filter method that gives you access to the current model


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: how to check the condition for instance of class had been created in xtext editor [message #1807507 is a reply to message #1807505] Fri, 31 May 2019 11:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
See also https://www.eclipse.org/forums/index.php?t=msg&th=488755&goto=1063652&#msg_1063652

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Deploying an local Xtext Plugin
Next Topic:Code Mining with Embedded Editor
Goto Forum:
  


Current Time: Wed Apr 24 16:04:02 GMT 2024

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

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

Back to the top