|
|
|
Re: dynamic template proposals in Xtext [message #870958 is a reply to message #870920] |
Thu, 10 May 2012 10:59 |
Michal S Messages: 74 Registered: July 2011 |
Member |
|
|
Hi Gianluca,
let's have a look at following example
String id=helper.getId(ga.getSomeEntity());
if(templateContext.getContextType().getId().equals(id)){
// you can access here the model in the context using context.getCurrentModel()
SomeEntity someEntity = (SomeEntity) context.getCurrentModel();
Template template = new Template("SomeName", "${"+someEntity.getName()+"}", "someId1", someEntity.getName(), true);
//create a proposal
TemplateProposal tp = createProposal(template, templateContext, context, getImage(template), getRelevance(template));
//make it available
acceptor.accept(tp);
}
}
The behaviour can be well adjusted. I use dynamic templates for "best practices" content assist in my DSL...
Regards,
Michal
|
|
|
|
Powered by
FUDForum. Page generated in 0.04056 seconds