Skip to main content



      Home
Home » Modeling » TMF (Xtext) » dynamic template proposals in xtext revisited
dynamic template proposals in xtext revisited [message #1746493] Mon, 31 October 2016 04:17 Go to next message
Eclipse UserFriend
xtext_2.8.4.v201508050135.version:

I tried the suggestions from https://www.eclipse.org/forums/index.php/mv/msg/297566/870958/#msg_870958, (from 2012), but got an error:

0 [Worker-7] ERROR org.xtext.example.mydsl.ui.internal.MyDslActivator - Failed to create injector for org.xtext.example.mydsl.MyDsl
0 [Worker-7] ERROR org.xtext.example.mydsl.ui.internal.MyDslActivator - Guice creation errors:

1) A binding to org.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider was already configured at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:56).
at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:56)

1 error
com.google.inject.CreationException: Guice creation errors:

1) A binding to org.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider was already configured at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:56).
at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:56)

1 error

Before, I got an error for the @override annotation in the

public class MyDslUiModule extends org.xtext.example.mydsl.ui.AbstractMyDslUiModule {
public MyDslUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
@Override
public Class<? extends ITemplateProposalProvider> bindTemplateProposalProvider() {
return MyTemplateProposalProvider.class;
}
}


So I assume something has changed in the internals of xtext. Perhaps someone can give me a hint what to do to adjust the code; the navigation in the templates is just a too nice feature.

TIA, Uli

[Updated on: Mon, 31 October 2016 04:20] by Moderator

Re: dynamic template proposals in xtext revisited [message #1746494 is a reply to message #1746493] Mon, 31 October 2016 04:22 Go to previous messageGo to next message
Eclipse UserFriend
it is the method name

@Override
public Class<? extends ITemplateProposalProvider> bindITemplateProposalProvider() {
return MyDslTemplateProposalProvider.class;
}
Re: dynamic template proposals in xtext revisited [message #1746495 is a reply to message #1746493] Mon, 31 October 2016 04:28 Go to previous messageGo to next message
Eclipse UserFriend
sorry, I found the typo:
should read bindITemplateProposalProvider()

Hi Dietrich, thank you very much for the fast reply.

So the good news:

we can still (2.8 at least) use dynamic templates with xtext DSL in the ContentAssist.
(I asked on xtextcon 2015, if this is possible, but noone pointed me to that solution).

[Updated on: Mon, 31 October 2016 04:33] by Moderator

Re: dynamic template proposals in xtext revisited [message #1746496 is a reply to message #1746495] Mon, 31 October 2016 04:33 Go to previous messageGo to next message
Eclipse UserFriend
does it work with

@Override
public Class<? extends ITemplateProposalProvider> bindITemplateProposalProvider() {
return MyDslTemplateProposalProvider.class;
}

??
Re: dynamic template proposals in xtext revisited [message #1746497 is a reply to message #1746496] Mon, 31 October 2016 04:36 Go to previous message
Eclipse UserFriend
yes, the basic example works like a charm
Previous Topic:JvmTypesBuilder extension injection does not work in static inner classes
Next Topic:Max line length Formatting
Goto Forum:
  


Current Time: Fri May 16 09:11:47 EDT 2025

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

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

Back to the top