|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Reference Enum Literals of an Ecore model [message #1851376 is a reply to message #1851340] |
Mon, 04 April 2022 11:57 |
John Henbergs Messages: 239 Registered: October 2020 |
Senior Member |
|
|
HI Christian,
I implemented scoping. I have only one issue now. For the moment I return all EEnumLiterals of all Enums in the metamodel. However, I want to check the type of EEnum defined in "main", to then only return the enumliterals of that enum. However, I cannot seem to get the EEnum, I only get EObject.
For the following example:
main=[ecore::EObject|QualifiedName]( '.' literal=[ecore::EEnumLiteral])?
When I do
MyDslPackage.Literals.ROOT__MAIN.getEReferenceType()
I get EObject. I understand I get EObject because even in main I say reference EObjects, but is there a name to at least get the name? For example if in the textual model in "main" have a.b, can I at least get "b"?
Or is there any way I can check if it is an ENum? because if I do, I can then in literals only return the literals of that Enum.
[Updated on: Mon, 04 April 2022 12:11] Report message to a moderator
|
|
|
|
|
Re: Reference Enum Literals of an Ecore model [message #1851415 is a reply to message #1851403] |
Tue, 05 April 2022 10:04 |
John Henbergs Messages: 239 Registered: October 2020 |
Senior Member |
|
|
Hi,
Thank you both for your answers. I was finally able to fix it based on Christian's suggestions.
Sorry if I take more of your time with some additional questions :)
1. Is using two references the only possible solution in this case? As it somehow feels more as a trick than a solution and I was wondering if it is the most appropriate one, and why there is a need to do it like this? What did you mean by not indexed and do you have any information what is the reason for that?
2. Being that the rule is like this:
(main=[ecore::EObject|QualifiedName]( '.' literal=[ecore::EEnumLiteral])?)?
...
QualifiedName:
ID ('.' ID)*
;
I cannot actually generate Xtext Artefacts because after the dot there could either be an EEnumLiteral or another EObject. Thus, the only solution that came to my mind was to something something else instead of the dot such as:
(main=[ecore::EObject|QualifiedName]( '!' literal=[ecore::EEnumLiteral])?)?
However, is there a way, to tell xtext that if the Object in main is an EEnum then, after the dot there will be an EEnumLiteral in literal? So that I can still use the dot?
3. If I reference an object using the qualified name, lets say (a.b.c), if I just write c, then I do not get any suggestions, like I do in the tree editor. In the textual editor I have to write a.b first to then get suggestions about c. Is there anything I can do that the moment that I write c in the textual editor, I get all the qualified names leading to that?
Many thanks for all your help!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06618 seconds