Skip to main content



      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 04:43 Go to next message
Eclipse UserFriend
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 04:45 Go to previous messageGo to next message
Eclipse UserFriend
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)

[Updated on: Thu, 30 May 2019 05:03] by 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 07:04 Go to previous messageGo to next message
Eclipse UserFriend
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 07:08 Go to previous messageGo to next message
Eclipse UserFriend
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
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 07:12 Go to previous message
Eclipse UserFriend
See also https://www.eclipse.org/forums/index.php?t=msg&th=488755&goto=1063652&#msg_1063652
Previous Topic:Deploying an local Xtext Plugin
Next Topic:Code Mining with Embedded Editor
Goto Forum:
  


Current Time: Wed Mar 26 08:13:34 EDT 2025

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

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

Back to the top