Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [SOLVED] Xtext : Personalize Description
[SOLVED] Xtext : Personalize Description [message #1763947] Tue, 23 May 2017 06:16 Go to next message
Eclipse UserFriend
Hello,
I created a new grammar with Xtext 2.11 (it works) and I want to personnalize the autocompletion.

For example, I have two objects in my grammar

 
      Environment:
	'ENV_TYPE' name=ID
	'Description' (Description=STRING)
 
 
      Test
	'TEST_TYPE' name=ID
	'Description' (Description=STRING)
        'Environment' Environment=[Environment]



I would like in eclipse during autocompletion (on Environment attribut in TEST object) retrieving Environment'ID and in the yellow part the environment's description (cf attachment)

index.php/fa/29434/0/

How do you do that ?

Thank you
  • Attachment: auto_dev..jpg
    (Size: 28.71KB, Downloaded 304 times)

[Updated on: Wed, 24 May 2017 04:16] by Moderator

Re: Xtext : Personalize Description [message #1763950 is a reply to message #1763947] Tue, 23 May 2017 06:48 Go to previous messageGo to next message
Eclipse UserFriend
You can have a look at IEObjectDocumentationProvider.
that one is used to calculate the hover tooltip (that is used for proposals as well)
Re: Xtext : Personalize Description [message #1763984 is a reply to message #1763950] Tue, 23 May 2017 11:51 Go to previous messageGo to next message
Eclipse UserFriend
Thansk for your answer but I need help again.
I follow this tutorial https://christiandietrich.wordpress.com/2011/07/16/hover-support-in-xtext-2-0-tutorial/ but it does not work.

Here my code :

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;

import com.google.inject.Inject;


public class SvcIEObjectDocumentationProvider implements IEObjectDocumentationProvider {


	public SvcIEObjectDocumentationProvider() {
		// TODO Auto-generated constructor stub
	}
	
@Override
	public String getDocumentation(EObject o) {
		return "Je mets ce que je veux";
	}

}


 
/*
 * generated by Xtext 2.11.0
 */
import com.google.inject.Inject
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor

/**
 * Use this class to register components to be used within the Eclipse IDE.
 */
@FinalFieldsConstructor
class SvcUiModule extends AbstractSvcUiModule {
	
	@Inject	
   def public Class<? extends SvcIEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
        return SvcIEObjectDocumentationProvider;
    }
	
}


When Eclipse loads, I pass by bindIEObjectDocumentationProvider() but my sentence "Je mets ce que je veux" does not appear.

What have I forgotten

Thank

[Updated on: Wed, 24 May 2017 03:01] by Moderator

Re: Xtext : Personalize Description [message #1763989 is a reply to message #1763984] Tue, 23 May 2017 12:43 Go to previous messageGo to next message
Eclipse UserFriend

@Inject
def public Class<? extends SvcIEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SvcIEObjectDocumentationProvider;
}

makes no sence. this is a binding not a injection

and the type is wrong
class MyDslUiModule extends AbstractMyDslUiModule {
	
    def public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
        return SvcIEObjectDocumentationProvider;
    }
}

Re: Xtext : Personalize Description [message #1764021 is a reply to message #1763989] Wed, 24 May 2017 02:56 Go to previous message
Eclipse UserFriend
Thank you. You save me, it works.
Previous Topic:ScopeProvider and Linker
Next Topic:Xtext : Unicity element
Goto Forum:
  


Current Time: Fri May 16 14:54:09 EDT 2025

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

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

Back to the top