当前位置: 首页>>代码示例>>Java>>正文


Java XsltTemplateInvocation类代码示例

本文整理汇总了Java中org.intellij.lang.xpath.xslt.psi.XsltTemplateInvocation的典型用法代码示例。如果您正苦于以下问题:Java XsltTemplateInvocation类的具体用法?Java XsltTemplateInvocation怎么用?Java XsltTemplateInvocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XsltTemplateInvocation类属于org.intellij.lang.xpath.xslt.psi包,在下文中一共展示了XsltTemplateInvocation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkTemplateInvocation

import org.intellij.lang.xpath.xslt.psi.XsltTemplateInvocation; //导入依赖的package包/类
private static void checkTemplateInvocation(XsltTemplateInvocation call, ProblemsHolder holder, boolean onTheFly) {
    final XsltWithParam[] arguments = call.getArguments();

    final Map<String, XsltWithParam> argNames = new HashMap<String, XsltWithParam>();
    for (XsltWithParam arg : arguments) {
        final XmlAttribute attr = arg.getNameAttribute();
        if (attr != null) {
            final String name = attr.getValue();
            if (argNames.containsKey(name)) {
                final PsiElement token = arg.getNameIdentifier();
                assert token != null;
                holder.registerProblem(token, "Duplicate Argument '" + name + "'");
            }
            argNames.put(name, arg);
        }
    }

    if (call instanceof XsltCallTemplate) {
        final XsltCallTemplate ct = ((XsltCallTemplate)call);
        final PsiElement nameToken = ct.getNameIdentifier();
        final XsltTemplate template = ct.getTemplate();

        if (template != null) {
            if (nameToken != null) {
                final XsltParameter[] parameters = template.getParameters();
                for (XsltParameter parameter : parameters) {
                    if (!argNames.containsKey(parameter.getName()) && !parameter.hasDefault()) {

                        final LocalQuickFix fix = new AddWithParamFix(parameter, call.getTag()).createQuickFix(onTheFly);
                        holder.registerProblem(nameToken, "Missing template parameter: " + parameter.getName(),
                                AbstractFix.createFixes(fix));
                    }
                }
            }
            for (String s : argNames.keySet()) {
                final XmlAttribute argAttribute = argNames.get(s).getNameAttribute();
                assert argAttribute != null;

                final XmlAttributeValue valueElement = argAttribute.getValueElement();
                final PsiElement valueToken = XsltSupport.getAttValueToken(argAttribute);
                if (valueToken != null && s.trim().length() > 0) {
                    if (template.getParameter(s) == null) {
                        final LocalQuickFix fix1 = new AddParameterFix(s, template).createQuickFix(onTheFly);
                        final LocalQuickFix fix2 = new RemoveParamFix(argNames.get(s).getTag(), s).createQuickFix(onTheFly);
                        holder.registerProblem(valueToken, "Undeclared template parameter: " + s,
                                ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, AbstractFix.createFixes(fix1, fix2));
                    }
                } else if (valueElement != null) {
                    holder.registerProblem(valueElement, "Parameter name expected");
                }
            }
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:TemplateInvocationInspection.java

示例2: ArgumentMatcher

import org.intellij.lang.xpath.xslt.psi.XsltTemplateInvocation; //导入依赖的package包/类
public ArgumentMatcher(@NotNull XsltTemplateInvocation call) {
    myCall = call;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ArgumentMatcher.java


注:本文中的org.intellij.lang.xpath.xslt.psi.XsltTemplateInvocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。