|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: XText Syntax [message #1741537 is a reply to message #1741524] |
Thu, 25 August 2016 13:03   |
Eclipse User |
|
|
|
well that should be easy
import javax.inject.Inject
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider
import org.xtext.example.mydsl2.services.MyDslGrammarAccess
class MyDslIdeContentProposalProvider extends IdeContentProposalProvider {
@Inject extension MyDslGrammarAccess
override dispatch createProposals(RuleCall rc, ContentAssistContext context,
IIdeContentProposalAcceptor acceptor) {
if (VALUERule === rc.rule) {
//TODO check context.prefix
val e1 = proposalCreator.createProposal("1",context)
acceptor.accept(e1, proposalPriorities.getDefaultPriority(e1))
val e2 = proposalCreator.createProposal("*",context)
acceptor.accept(e2, proposalPriorities.getDefaultPriority(e2))
val e3 = proposalCreator.createProposal("ID",context)
acceptor.accept(e1, proposalPriorities.getDefaultPriority(e3))
} else {
super._createProposals(rc, context, acceptor)
}
}
} class MyDslWebModule extends AbstractMyDslWebModule {
def void configureIPreferenceValuesProvider(Binder binder) {
binder.bind(IPreferenceValuesProvider).annotatedWith(FormatterPreferences).to(FormatterPreferenceValuesProvider)
}
def Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
MyDslIdeContentProposalProvider
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.06951 seconds