Java 类org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider 实例源码

项目:CooperateModelingEnvironment    文件:TemplateFragment2.java   
private void registerGuiceBindingsUi() {
    new GuiceModuleAccess.BindingFactory()
            .addTypeToType(typeRef(DefaultTemplateProposalProvider.class),
                    typeRef(CooperateTemplateProposalProvider.class))
            .contributeTo(getLanguage().getEclipsePluginGenModule());
    getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles()
            .add("de.cooperateproject.modeling.textual.xtext.runtime.ui");
}
项目:sadlos2    文件:TemplateQuickAssistProcessor.java   
protected ICompletionProposal createTemplateProposal(
        TemplateIssueResolution res) {
    try {
        TemplateContextSupplier fac = res.getContextFactory();
        IDocument doc = XtextDocumentUtil.get(qaCtx.getSourceViewer());
        Position pos = fac.getPosition(doc, qaCtx);
        String prefix = fac.getPrefix(doc, qaCtx);
        String postfix = fac.getPostfix(doc, qaCtx);
        Map<String, String> vars = fac.getVariables(doc, qaCtx);
        Region r = new Region(pos.getOffset(), pos.getLength());
        ContentAssistContext cactx = builderProvider.get()
                .setOffset(pos.getOffset()).setPrefix(prefix)
                .setViewer(qaCtx.getSourceViewer()).toContext();

        // create a TemplateProposalContext
        Image i = ((DefaultTemplateProposalProvider) templatePP)
                .getImage(res.getTemplate());
        XtextTemplateContextType type = templateCtxTypeProvider.get();
        XtextTemplateContext tplctx = new QuickfixTemplateContext(type,
                doc, pos, cactx, scopeProvider, prefix, postfix);
        for (Map.Entry<String, String> e : vars.entrySet())
            tplctx.setVariable(e.getKey(), e.getValue());

        // create a TemplateProposal
        XtextTemplateProposal proposal = new XtextTemplateProposal(
                res.getTemplate(), tplctx, r, i);
        return proposal;
    } catch (RuntimeException e1) {
        throw e1;
    } catch (Exception e2) {
        throw new WrappedException(e2);
    }
}
项目:bts    文件:DefaultUiModule.java   
public Class<? extends ITemplateProposalProvider> bindITemplateProposalProvider() {
    return DefaultTemplateProposalProvider.class;
}
项目:CooperateModelingEnvironment    文件:AbstractComponentUiModule.java   
public Class<? extends DefaultTemplateProposalProvider> bindDefaultTemplateProposalProvider() {
    return CooperateTemplateProposalProvider.class;
}
项目:CooperateModelingEnvironment    文件:AbstractClsUiModule.java   
public Class<? extends DefaultTemplateProposalProvider> bindDefaultTemplateProposalProvider() {
    return CooperateTemplateProposalProvider.class;
}
项目:CooperateModelingEnvironment    文件:AbstractUsecaseUiModule.java   
public Class<? extends DefaultTemplateProposalProvider> bindDefaultTemplateProposalProvider() {
    return CooperateTemplateProposalProvider.class;
}