use of org.eclipse.xtext.ui.editor.contentassist.ITemplateAcceptor in project xtext-eclipse by eclipse.
the class AbstractTemplateProposalProvider method createTemplates.
@Override
public void createTemplates(ContentAssistContext context, ITemplateAcceptor acceptor) {
if (!acceptor.canAcceptMoreTemplates())
return;
TemplateContext[] templateContexts = createTemplateContexts(context);
if (templateContexts == null || templateContexts.length == 0)
return;
ITemplateAcceptor nullSafe = new NullSafeTemplateAcceptor(acceptor);
for (TemplateContext templateContext : templateContexts) {
if (!nullSafe.canAcceptMoreTemplates())
return;
// name of the selection variables {line, word}_selection //$NON-NLS-1$
templateContext.setVariable("selection", context.getSelectedText());
createTemplates(templateContext, context, nullSafe);
}
}
Aggregations