• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XmlDocumentImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getXmlRouteNameTarget

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
@Nullable
public static PsiElement getXmlRouteNameTarget(@NotNull XmlFile psiFile,@NotNull String routeName) {

    XmlDocumentImpl document = PsiTreeUtil.getChildOfType(psiFile, XmlDocumentImpl.class);
    if(document == null) {
        return null;
    }

    for(XmlTag xmlTag: PsiTreeUtil.getChildrenOfTypeAsList(psiFile.getFirstChild(), XmlTag.class)) {
        if(xmlTag.getName().equals("routes")) {
            for(XmlTag routeTag: xmlTag.getSubTags()) {
                if(routeTag.getName().equals("route")) {
                    XmlAttribute xmlAttribute = routeTag.getAttribute("id");
                    if(xmlAttribute != null) {
                        String attrValue = xmlAttribute.getValue();
                        if(routeName.equals(attrValue)) {
                            return xmlAttribute;
                        }
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:27,代码来源:RouteHelper.java


示例2: moveTags

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
private static boolean moveTags(MoveInfo info, XmlTag moved, XmlTag target, boolean down) {
  if (target.getParent() == moved) {
    // we are going to jump into our own children
    // this can mean that target computed incorrectly
    XmlTag next = down ? PsiTreeUtil.getNextSiblingOfType(moved, XmlTag.class) :
                         PsiTreeUtil.getPrevSiblingOfType(moved, XmlTag.class);
    if (next == null) return info.prohibitMove();
    info.toMove = new LineRange(moved);
    info.toMove2 = new LineRange(next);
    return true;
  }
  else if (moved.getParent() == target) {
    return false;
  }

  LineRange targetRange = new LineRange(target);
  if (targetRange.contains(info.toMove2)) {
    // we are going to jump into sibling tag
    XmlElementDescriptor descriptor = moved.getDescriptor();
    if (descriptor == null) return false;
    XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor();
    if (nsDescriptor == null) return false;
    XmlFile descriptorFile = nsDescriptor.getDescriptorFile();
    if (descriptorFile == null || XmlDocumentImpl.isAutoGeneratedSchema(descriptorFile)) return false;
    if (!TagNameVariantCollector.couldContain(target, moved)) {
      info.toMove = new LineRange(moved);
      info.toMove2 = targetRange;
      return true;
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:XmlMover.java


示例3: getLocalParameterName

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
@Nullable
public static PsiElement getLocalParameterName(PsiFile psiFile, String serviceName) {

    if(!(psiFile.getFirstChild() instanceof XmlDocumentImpl)) {
        return null;
    }

    XmlTag xmlTags[] = PsiTreeUtil.getChildrenOfType(psiFile.getFirstChild(), XmlTag.class);
    if(xmlTags == null) {
        return null;
    }

    for(XmlTag xmlTag: xmlTags) {
        if(xmlTag.getName().equals("container")) {
            for(XmlTag servicesTag: xmlTag.getSubTags()) {
                if(servicesTag.getName().equals("parameters")) {
                    for(XmlTag serviceTag: servicesTag.getSubTags()) {
                        XmlAttribute attrValue = serviceTag.getAttribute("key");
                        if(attrValue != null) {
                            String serviceNameId = attrValue.getValue();
                            if(serviceNameId != null && serviceNameId.equals(serviceName)) {
                                return serviceTag;
                            }
                        }
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:33,代码来源:XmlHelper.java


示例4: moveTags

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
private static boolean moveTags(MoveInfo info, XmlTag moved, XmlTag target, boolean down) {
  if (target.getParent() == moved) {
    // we are going to jump into our own children
    // this can mean that target computed incorrectly
    XmlTag next = down ? PsiTreeUtil.getNextSiblingOfType(moved, XmlTag.class) :
                  PsiTreeUtil.getPrevSiblingOfType(moved, XmlTag.class);
    if (next == null) return info.prohibitMove();
    info.toMove = new LineRange(moved);
    info.toMove2 = new LineRange(next);
    return true;
  }
  else if (moved.getParent() == target) {
    return false;
  }

  LineRange targetRange = new LineRange(target);
  if (targetRange.contains(info.toMove2)) {
    // we are going to jump into sibling tag
    XmlElementDescriptor descriptor = moved.getDescriptor();
    if (descriptor == null) return false;
    XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor();
    if (nsDescriptor == null) return false;
    XmlFile descriptorFile = nsDescriptor.getDescriptorFile();
    if (descriptorFile == null || XmlDocumentImpl.isAutoGeneratedSchema(descriptorFile)) return false;
    if (!TagNameVariantCollector.couldContain(target, moved)) {
      info.toMove = new LineRange(moved);
      info.toMove2 = targetRange;
      return true;
    }
  }

  return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:34,代码来源:XmlMover.java


示例5: getElementsDescriptors

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
@Override
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
  XmlDocumentImpl xmlDocument = PsiTreeUtil.getParentOfType(context, XmlDocumentImpl.class);
  if (xmlDocument == null) return EMPTY_ARRAY;
  return xmlDocument.getRootTagNSDescriptor().getRootElementsDescriptors(xmlDocument);
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:7,代码来源:CatberryComponentTagDescriptor.java


示例6: getElementsDescriptors

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
@Override
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
    XmlDocumentImpl xmlDocument = PsiTreeUtil.getParentOfType(context, XmlDocumentImpl.class);
    if (xmlDocument == null) return EMPTY_ARRAY;
    return xmlDocument.getRootTagNSDescriptor().getRootElementsDescriptors(xmlDocument);
}
 
开发者ID:idok,项目名称:react-templates-plugin,代码行数:7,代码来源:RTClassTagDescriptor.java


示例7: getTags

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
public static Map<String, Set<String>> getTags(XmlFile psiFile) {

        Map<String, Set<String>> map = new HashMap<>();

        XmlDocumentImpl document = PsiTreeUtil.getChildOfType(psiFile, XmlDocumentImpl.class);
        if(document == null) {
            return map;
        }

        /*
         * <services>
         *   <service id="espend_form.foo_type" class="%espend_form.foo_type.class%">
         *     <tag name="form.type" alias="foo_type_alias" />
         *   </service>
         * </services>
         */

        XmlTag xmlTags[] = PsiTreeUtil.getChildrenOfType(psiFile.getFirstChild(), XmlTag.class);
        if(xmlTags == null) {
            return map;
        }

        for(XmlTag xmlTag: xmlTags) {
            if(xmlTag.getName().equals("container")) {
                for(XmlTag servicesTag: xmlTag.getSubTags()) {
                    if(servicesTag.getName().equals("services")) {
                        for(XmlTag serviceTag: servicesTag.getSubTags()) {
                            XmlAttribute attrValue = serviceTag.getAttribute("id");
                            if(attrValue != null) {

                                // <service id="foo.bar" class="Class\Name">
                                String serviceNameId = attrValue.getValue();
                                if(serviceNameId != null) {

                                    Set<String> serviceTags = getTags(serviceTag);
                                    if(serviceTags.size() > 0) {
                                        map.put(serviceNameId, serviceTags);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }

        return map;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:50,代码来源:FormUtil.java


示例8: getXmlRouteDefinitions

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
public static Collection<StubIndexedRoute> getXmlRouteDefinitions(XmlFile psiFile) {

        XmlDocumentImpl document = PsiTreeUtil.getChildOfType(psiFile, XmlDocumentImpl.class);
        if(document == null) {
            return Collections.emptyList();
        }

        Collection<StubIndexedRoute> indexedRoutes = new ArrayList<>();

        /*
         * <routes>
         *   <route id="foo" path="/blog/{slug}" methods="GET">
         *     <default key="_controller">Foo</default>
         *   </route>
         *
         *   <route id="foo" path="/blog/{slug}" methods="GET" controller="AppBundle:Blog:list"/>
         * </routes>
         */
        for(XmlTag xmlTag: PsiTreeUtil.getChildrenOfTypeAsList(psiFile.getFirstChild(), XmlTag.class)) {
            if(xmlTag.getName().equals("routes")) {
                for(XmlTag servicesTag: xmlTag.getSubTags()) {
                    if(servicesTag.getName().equals("route")) {
                        XmlAttribute xmlAttribute = servicesTag.getAttribute("id");
                        if(xmlAttribute != null) {
                            String attrValue = xmlAttribute.getValue();
                            if(attrValue != null && StringUtils.isNotBlank(attrValue)) {

                                StubIndexedRoute route = new StubIndexedRoute(attrValue);
                                String pathAttribute = servicesTag.getAttributeValue("path");
                                if(pathAttribute == null) {
                                    pathAttribute = servicesTag.getAttributeValue("pattern");
                                }

                                if(pathAttribute != null && StringUtils.isNotBlank(pathAttribute) ) {
                                    route.setPath(pathAttribute);
                                }

                                String methods = servicesTag.getAttributeValue("methods");
                                if(methods != null && StringUtils.isNotBlank(methods))  {
                                    String[] split = methods.replaceAll(" +", "").toLowerCase().split("\\|");
                                    if(split.length > 0) {
                                        route.addMethod(split);
                                    }
                                }

                                // <route><default key="_controller"/></route>
                                //  <route controller="AppBundle:Blog:list"/>
                                String controller = getXmlController(servicesTag);
                                if(controller != null) {
                                    route.setController(normalizeRouteController(controller));
                                }

                                indexedRoutes.add(route);
                            }
                        }
                    }
                }
            }
        }

        return indexedRoutes;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:63,代码来源:RouteHelper.java


示例9: getFileParameterMap

import com.intellij.psi.impl.source.xml.XmlDocumentImpl; //导入依赖的package包/类
public static Map<String, String> getFileParameterMap(XmlFile psiFile) {

        Map<String, String> services = new HashMap<>();

        if(!(psiFile.getFirstChild() instanceof XmlDocumentImpl)) {
            return services;
        }

        XmlTag xmlTags[] = PsiTreeUtil.getChildrenOfType(psiFile.getFirstChild(), XmlTag.class);
        if(xmlTags == null) {
            return services;
        }

        for(XmlTag xmlTag: xmlTags) {
            if(xmlTag.getName().equals("container")) {
                for(XmlTag servicesTag: xmlTag.getSubTags()) {
                    if(servicesTag.getName().equals("parameters")) {
                        for(XmlTag parameterTag: servicesTag.getSubTags()) {

                            // <parameter key="fos_user.user_manager.class">FOS\UserBundle\Doctrine\UserManager</parameter>
                            // <parameter key="fos_rest.formats" type="collection">
                            //    <parameter key="json">false</parameter>
                            // </parameter>

                            if(parameterTag.getName().equals("parameter")) {
                                XmlAttribute keyAttr = parameterTag.getAttribute("key");
                                if(keyAttr != null) {
                                    String parameterName = keyAttr.getValue();
                                    if(parameterName != null && StringUtils.isNotBlank(parameterName)) {

                                        String parameterValue = null;

                                        String typeAttr = parameterTag.getAttributeValue("type");

                                        // get value of parameter if we have a text value
                                        if(!"collection".equals(typeAttr) && parameterTag.getSubTags().length == 0) {
                                            XmlTagValue attrClass = parameterTag.getValue();
                                            String myParameterValue = attrClass.getText();

                                            // dont index long values
                                            if(myParameterValue.length() < 150) {
                                                parameterValue = myParameterValue;
                                            }
                                        }

                                        services.put(parameterName.toLowerCase(), parameterValue);
                                    }

                                }
                            }
                        }
                    }
                }
            }
        }

        return services;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:59,代码来源:XmlHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypeCodeReader类代码示例发布时间:2022-05-22
下一篇:
Java EObjectAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap