Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Hover Documentation
Xtext Hover Documentation [message #1822037] Wed, 26 February 2020 09:31 Go to next message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
Member
Hello, i have the following grammar:
	('data-dictionary' '{'
	attributes+=(Attribute)*
	'}')?
	('entity-catalog' '{'
	entities+=Entity*
	'}')?
	'}';
Attribute:
	AttributeSimpleType | AttributeEntityType 
Entity:
	(documentation=ML_DOC_COMMENT)?  
        name=ID funcName=STRING '{'
	features+=(Feature)*
'}';
Feature:
	(documentation=ML_DOC_COMMENT)? 
	(type=FeatureAttributeType | type=FeatureEntityType)
FeatureAttributeType:
	(type=[AttributeSimpleType|ID]|type=[AttributeSimpleType|GENERAL_FQN])
FeatureEntityType:
	'entity' (attribute=[AttributeEntityType|ID]|attribute=[AttributeEntityType|GENERAL_FQN]);

I have implemented the IEObjectDocumentationProvider and DefaultEObjectHoverProvider, but when i hover over a feature instead of giving me the doc. of the feature it gives me the doc of the attribute which is contained in the data-dictionary. The object that is passed to the getDocumentation method is of type Attribute. I have debugged and noticed in the EObjectAtOffsetHelper inside the resolveCrossReferencedElement method, the type of the object passed is Feature, but there is a check for the object's representation in the model instance. Since the selected Feature is present as an Attribute the returned object is the Attribute. Is there a way to get the doc of the feature instead of the attribute without having to override that method and get rid of the check?
Re: Xtext Hover Documentation [message #1822041 is a reply to message #1822037] Wed, 26 February 2020 09:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

which check are you referring to?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Hover Documentation [message #1822042 is a reply to message #1822041] Wed, 26 February 2020 09:40 Go to previous messageGo to next message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
Member
Hello, from the class EObjectAtOffsetHelper line 139:
 
if (!crossReference.isMany()) {
				return (EObject) referenceOwner.eGet(crossReference);

before this check the referenceOwner is of type Feature which is the desired type.
Re: Xtext Hover Documentation [message #1822044 is a reply to message #1822042] Wed, 26 February 2020 09:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes. its intended that we show the documentation of the thing that is referenced at the place you hover. if you dont want this
and show the contained eObjects documentation instead. then you need to customize


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Hover Documentation [message #1822045 is a reply to message #1822042] Wed, 26 February 2020 09:48 Go to previous messageGo to next message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
Member
Is there a specific class which i could costumize?
Re: Xtext Hover Documentation [message #1822049 is a reply to message #1822045] Wed, 26 February 2020 10:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
guess the one that calls EObjectAtOffsetHelper


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext Hover Documentation [message #1822051 is a reply to message #1822049] Wed, 26 February 2020 10:25 Go to previous message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
Member
I started to make the changes , but it got tideous, and i was hoping to avoid that.
Thank you for your replies :)
Previous Topic:Xtext Hover Documentation [Duplicate - https://www.eclipse.org/forums/index.php/m/1822037/#msg_18220
Next Topic:Specify the encoding of attached source files
Goto Forum:
  


Current Time: Tue Apr 23 11:27:37 GMT 2024

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

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

Back to the top