Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Documentation on functions called in xtext editor !!
icon5.gif  Documentation on functions called in xtext editor !! [message #759628] Tue, 29 November 2011 12:05 Go to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
How i can show a tooltip or something like that, when i write a function on the editor thats show me the function documentation. Just like java documentation in java

Some suggestion?, some for read?

Now, after this post, i find this http://www.eclipse.org/forums/index.php/sf/thread/27/1/40/.

[Updated on: Tue, 29 November 2011 12:13]

Report message to a moderator

Re: Documentation on functions called in xtext editor !! [message #759744 is a reply to message #759628] Tue, 29 November 2011 20:05 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 721
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Subclass MultiLineCommentDocumentationProvider and bind it in your UI module class.

~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Documentation on functions called in xtext editor !! [message #760826 is a reply to message #759744] Mon, 05 December 2011 11:49 Go to previous messageGo to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
I trying what you suggest me, but i only get a popup with documentation when i drag the mouse over a function in the editor, what i trying to achieve is something like the next :

http://img716.imageshack.us/img716/2924/doch.jpg

Same way?

Any suggestions will be welcomed. Thanks, in advance.

Sorry for my bad english.
Re: Documentation on functions called in xtext editor !! [message #760831 is a reply to message #760826] Mon, 05 December 2011 11:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13416
Registered: July 2009
Senior Member
call ConfigurableCompletionProposal.setAdditionalProposalInfo at a proper place in the ProposalProvider,
which this is strongly depends on the usecase. you may have to do a downcast.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Documentation on functions called in xtext editor !! [message #760910 is a reply to message #759628] Mon, 05 December 2011 15:11 Go to previous messageGo to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
I not understading at all how this works... but im trying. So i have new question.

I think this may be the proper place to use setAdditionalProposalInfo :

@Override
protected ConfigurableCompletionProvider doCreateProposal(String proposal, StyledString displayString, Image image, int priority, context){

ConfigurationCompletionProvider theProposal = super.doCreateProposal(proposal,
displayString, image, priority, context);

theProposal.setAdditionalProposalInfo("functionDocumentation");

}


I have to get from the context, the function that i want to show the doc?... or there is other more efficient way ?

I trying to base my code in the code i found in this post http://www.eclipse.org/forums/index.php/m/643639/ but function "apply(IEObjectDescription candidate)" doesnt exist any more in this version of xtext, i guess.

Wron way?, right way?, other way?
Re: Documentation on functions called in xtext editor !! [message #760912 is a reply to message #760910] Mon, 05 December 2011 15:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13416
Registered: July 2009
Senior Member
Is the function a crossrefernce? this question is way to general?
org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.DefaultProposalCreator.DefaultProposalCreator(AbstractJavaBasedContentProposalProvider, ContentAssistContext, String, IQualifiedNameConverter) is still there


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 05 December 2011 15:18]

Report message to a moderator

Re: Documentation on functions called in xtext editor !! [message #760943 is a reply to message #759628] Mon, 05 December 2011 16:49 Go to previous messageGo to next message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
The functions what i talking about, are the functions uniques of my dsl. Not a cross reference, if i am understanding.

I was asking if what I'm doing is right

I will give you a example of my dsl


Greeting :
'module' name=ID '{'
innerElements += ModuleInnerElements*
'}'
;

ModuleInnerElements:
      Functions
      | OtherStuff
      | OtherStuff
      | OtherStuff
      | OtherStuff
;

Functions:
     (GuiStart | GuiAddRow | GuiEnd) FunctionImplementation
;

GuiStart:
     'guiStart';
;

GuiAddRow:
     'guiAddRow';
;

GuiEnd:
     'guiEnd';
;



Sorry, english is sometimes a nightmare for me !!

Edit: I was looking the picture i posted before and thats was and example of how i want to show the documentation for my functions (in my dsl) and not for java functions.

[Updated on: Mon, 05 December 2011 16:55]

Report message to a moderator

Re: Documentation on functions called in xtext editor !! [message #760945 is a reply to message #760943] Mon, 05 December 2011 17:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13416
Registered: July 2009
Senior Member
in this case you should hook into complete keyword

	@Override
	public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext,
			ICompletionProposalAcceptor acceptor) {
		ICompletionProposal proposal = createCompletionProposal(keyword.getValue(), getKeywordDisplayString(keyword),
				getImage(keyword), contentAssistContext);
//do a downcast here and add the infos you need
		getPriorityHelper().adjustKeywordPriority(proposal, contentAssistContext.getPrefix());
		acceptor.accept(proposal);
	}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Documentation on functions called in xtext editor !! [message #760974 is a reply to message #759628] Mon, 05 December 2011 18:24 Go to previous message
Federico Sellanes is currently offline Federico SellanesFriend
Messages: 71
Registered: November 2011
Member
Thanks sir. Very Happy
Previous Topic:[Xtend] Comments between ''' '''
Next Topic:Cross-references for multi-word identifiers (cont.)
Goto Forum:
  


Current Time: Tue Mar 31 14:21:58 GMT 2020

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

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

Back to the top