Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » dot-path upside down(my 4GL has an optional reference field{.entity}, how can I adopt Code Completion?)
dot-path upside down [message #1091295] Wed, 21 August 2013 09:56 Go to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
my 4GL has an optional reference field{.entity} (field=attribute, entity=class)
So in my code I may type MyField1.MyEntity2.

How can I inform the Content Assistant that I need all fields for Entity "MyEntity2"?

Using the normal way, I would just enter the class and the dot and this will lead me to the attributes of this class. Unfortunately, this is an upside down situation?

Any ideas how I can solve this in an XTEXT grammar?

TIA, Uli
Re: dot-path upside down [message #1091313 is a reply to message #1091295] Wed, 21 August 2013 10:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry i did not get the post, can you share grammar and sample model?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: dot-path upside down [message #1091367 is a reply to message #1091313] Wed, 21 August 2013 12:02 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Christian,
sorry I do not have a grammar / example so far because I'm a bit lost.


************* Just a sketch:

Model:
entities+=Entity*

Entity:
"entity" name=ID fields+=Field*

Field:
"field" name=ID

FieldRef:
'use" name=ID usedField=???


************* The sample:

entity A
field F1
field F2
field F3

entity B
field F1
field F2
field F4
field F5

use ATEST1 F1.B
use ATEST2 F1.A
use ATEST3 F3

*************
If the notation was "normal" like A.F? the Content Assist would not have a problem to deliver F1,F2,F3. But in my 4GL, it is turned around and the entity is an optional part of the qualification.

Hope this gives you an impression what is needed.

TIA, Uli
Re: dot-path upside down [message #1091369 is a reply to message #1091367] Wed, 21 August 2013 12:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

if i understand your problem:

if a Attribute is only in one field then its name is

Simplename else it is Simplename.EntityName?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: dot-path upside down [message #1091412 is a reply to message #1091369] Wed, 21 August 2013 13:17 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
even harder, the entity qualification can be left out in the code even if it is ambiguous now.

Then the entity is calculated at runtime from the "context". If you say "F2" and your application is working with entity "B", it uses F2.B


A vey messed up logic, but I have to base my work on this 1985 laws.


The question is how to convince the Contents assistant to show only attributes of class "B".
Is there some construction where i can
type "*.B",
hit CTRL-Space and get a selection of F1.B, F2.B, F4.B, F5.B
which replaces the "*.B" in my text?

use *.B
- activate Content Assistant and select F2.B and get in my text
use F2.B

Re: dot-path upside down [message #1091453 is a reply to message #1091412] Wed, 21 August 2013 14:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i guess you have to repackage delegateGetScope(ctx, ref) in your scopeprovider according to your rules.
(create new IObjectDescriptions) and put them into org.eclipse.xtext.scoping.impl.SimpleScope.SimpleScope(IScope, Iterable<IEObjectDescription>)
dont know if this will work smooth.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: dot-path upside down [message #1091520 is a reply to message #1091453] Wed, 21 August 2013 16:12 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Christian,

sounds a bit complicate, but I have time enough to collect experiences.
Thanks for giving me a direction where I can have a look.

Uli
Previous Topic:Couldnt resolve reference to JvmMember
Next Topic:Arbitrary Qualifiers
Goto Forum:
  


Current Time: Thu Apr 25 04:34:26 GMT 2024

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

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

Back to the top