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


Java XmlTag.getSubTags方法代码示例

本文整理汇总了Java中com.intellij.psi.xml.XmlTag.getSubTags方法的典型用法代码示例。如果您正苦于以下问题:Java XmlTag.getSubTags方法的具体用法?Java XmlTag.getSubTags怎么用?Java XmlTag.getSubTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.xml.XmlTag的用法示例。


在下文中一共展示了XmlTag.getSubTags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillRelatedTags

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static void fillRelatedTags(String classFqn, XmlTag parentTag, List<XmlTag> tagsReferences) {
    for (XmlTag childTag: parentTag.getSubTags()) {
        String tagName = childTag.getName();
        String attribute = TAG_ATTRIBUTE_RELATION.get(tagName);
        if (attribute != null) {
            String className = childTag.getAttributeValue(attribute);
            if (className != null && PhpLangUtil.toPresentableFQN(className).equals(classFqn)) {
                tagsReferences.add(getLineMarkerDecorator(childTag));
            }
        }

        // type tag has plugin tags
        if (tagName.equals(TYPE_TAG)) {
            fillRelatedTags(classFqn, childTag, tagsReferences);
        }

        if (tagName.equals("event")) {
            fillRelatedTags(classFqn, childTag, tagsReferences);
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:22,代码来源:TypeConfigurationIndex.java

示例2: process

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public void process(XmlTag rootTag, Processor processor) {
  final XmlTag[] actions = rootTag.findSubTags("actions");
  for (XmlTag tag : actions) {
    if (!tag.isPhysical()) continue;
    final XmlTag[] components = tag.getSubTags();
    for (XmlTag actionOrGroup : components) {
      if (myName.equals(actionOrGroup.getName())) {
        if (!processor.process(this, actionOrGroup)) {
          return;
        }
      } else if (this == ACTION && GROUP.myName.equals(actionOrGroup.getName())) {
        final XmlTag[] groupActions = actionOrGroup.findSubTags(myName);
        for (XmlTag a : groupActions) {
          if (!processor.process(this, a)) {
            return;
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ActionType.java

示例3: parseAndAddAttrGroups

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private void parseAndAddAttrGroups(XmlTag tag) {
  String attrGroup = null;
  for (XmlTag subTag : tag.getSubTags()) {
    String subTagName = subTag.getName();
    if (TAG_ATTR.equals(subTagName)) {
      AttributeDefinition def = myAttrs.get(subTag.getAttributeValue(ATTR_NAME));
      if (def != null) {
        def.setAttrGroup(attrGroup);
      }
    }
    else if (TAG_EAT_COMMENT.equals(subTagName)) {
      String newAttrGroup = getCommentBeforeEatComment(subTag);
      if (newAttrGroup != null && newAttrGroup.length() <= ATTR_GROUP_MAX_CHARACTERS) {
        attrGroup = newAttrGroup;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AttributeDefinitionsImpl.java

示例4: createTagSnapshot

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@NotNull
public static TagSnapshot createTagSnapshot(@NotNull XmlTag tag) {
  // Attributes
  List<AttributeSnapshot> attributes = AttributeSnapshot.createAttributesForTag(tag);

  // Children
  List<TagSnapshot> children;
  XmlTag[] subTags = tag.getSubTags();
  if (subTags.length > 0) {
    TagSnapshot last = null;
    children = Lists.newArrayListWithExpectedSize(subTags.length);
    for (XmlTag subTag : subTags) {
      TagSnapshot child = createTagSnapshot(subTag);
      children.add(child);
      if (last != null) {
        last.myNext = child;
      }
      last = child;
    }
  } else {
    children = Collections.emptyList();
  }

  return new TagSnapshot(tag, tag.getName(), tag.getNamespacePrefix(), tag.getNamespace(), attributes, children);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TagSnapshot.java

示例5: invoke

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
  if (!FileModificationService.getInstance().preparePsiElementsForWrite(element)) return;
  final XmlTag tag = (XmlTag)element.getParent();
  final String value;
  if (tag.getSubTags().length == 0) {
    value = tag.getValue().getText().trim();
  }
  else {
    value = StringUtil.join(tag.getSubTags(), new Function<XmlTag, String>() {
      @Override
      public String fun(XmlTag childTag) {
        final XmlAttribute valueAttr = childTag.getAttribute(FxmlConstants.FX_VALUE);
        if (valueAttr != null) {
          return valueAttr.getValue();
        }
        return "";
      }
    }, ", ");
  }
  final XmlAttribute attribute = XmlElementFactory.getInstance(project).createXmlAttribute(tag.getName(), value);
  final XmlTag parentTag = tag.getParentTag();
  parentTag.add(attribute);
  tag.delete();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaFxCollapseSubTagToAttributeIntention.java

示例6: isAvailable

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
  if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_NAME && element.getParent() instanceof XmlTag) {
    final XmlTag tag = (XmlTag)element.getParent();
    for (XmlTag xmlTag : tag.getSubTags()) {
      if (xmlTag.getAttribute(FxmlConstants.FX_VALUE) == null) return false;
    }
    final XmlTag parentTag = tag.getParentTag();
    if (parentTag != null &&
        tag.getDescriptor() instanceof JavaFxPropertyElementDescriptor &&
        parentTag.getDescriptor() instanceof JavaFxClassBackedElementDescriptor) {

      setText("Collapse tag '" + tag.getName() + "' to attribute");
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaFxCollapseSubTagToAttributeIntention.java

示例7: invoke

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
  Map<XmlTag,DomElement> map = new THashMap<XmlTag, DomElement>();
  for (final CollectionChildDescriptionImpl qname : myQnames) {
    for (DomElement element : handler.getCollectionChildren(qname)) {
      map.put(element.getXmlTag(), element);
    }
  }
  final XmlTag tag = handler.getXmlTag();
  if (tag == null) return Collections.emptyList();

  final List<DomElement> list = new ArrayList<DomElement>();
  for (final XmlTag subTag : tag.getSubTags()) {
    ContainerUtil.addIfNotNull(map.get(subTag), list);
  }
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GetCompositeCollectionInvocation.java

示例8: findViewTag

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Nullable
private static String findViewTag(XmlTag tag, String target) {
  String id = tag.getAttributeValue(ATTR_ID, ANDROID_URI);
  if (id != null && id.endsWith(target) && target.equals(LintUtils.stripIdPrefix(id))) {
    return tag.getName();
  }

  for (XmlTag sub : tag.getSubTags()) {
    if (sub.isValid()) {
      String found = findViewTag(sub, target);
      if (found != null) {
        return found;
      }
    }
  }

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

示例9: getRangeInElement

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
@NotNull
public TextRange getRangeInElement(@NotNull final XmlTag tag) {
  if (tag.getSubTags().length > 0) {
    // Text range in tag with subtags is not supported, return empty range, consider making this function nullable.
    return TextRange.EMPTY_RANGE;
  }

  final XmlTagValue value = tag.getValue();
  final XmlText[] texts = value.getTextElements();
  switch (texts.length) {
    case 0:
      return value.getTextRange().shiftRight(-tag.getTextOffset());
    case 1:
      return getValueRange(texts[0]);
    default:
      return TextRange.EMPTY_RANGE;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XmlTagManipulator.java

示例10: getHeaderText

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static String getHeaderText(final @Nullable XmlTag header) {
  if (header == null) return null;

  final StringBuilder buf = new StringBuilder();

  if (HGROUP_ELEMENT.equalsIgnoreCase(header.getLocalName())) {
    for (XmlTag subTag : header.getSubTags()) {
      if (ArrayUtil.contains(subTag.getLocalName().toLowerCase(), HEADER_ELEMENTS)) {
        if (buf.length() > 0) {
          buf.append(" ");
        }
        appendTextRecursively(subTag, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
      }
    }
  }
  else {
    appendTextRecursively(header, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
  }

  return buf.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:Html5SectionsProcessor.java

示例11: collectComponentDeclarations

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private static void collectComponentDeclarations(XmlTag parentTag, List<XmlTag> results, String componentName, String componentType, ComponentMatcher componentMatcher) {
    for (XmlTag childTag: parentTag.getSubTags()) {
        if (componentType.equals(childTag.getName()) && componentMatcher.matches(componentName, childTag)) {
            results.add(childTag);
        } else if(childTag.getSubTags().length > 0 ) {
            collectComponentDeclarations(childTag, results, componentName, componentType, componentMatcher);
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:10,代码来源:LayoutIndex.java

示例12: fillResultMap

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
private void fillResultMap(XmlTag parentTag, Map<String, Void> resultMap) {
    for (XmlTag childTag: parentTag.getSubTags()) {
        if (childTag.getName().equals(indexTag)) {
            String attributeValue = childTag.getAttributeValue(indexAttribute);
            if (attributeValue != null) {
                attributeValue = valueProcessor != null ? valueProcessor.apply(attributeValue) : attributeValue;
                resultMap.put(attributeValue, null);
            }
        }
        fillResultMap(childTag, resultMap);
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:13,代码来源:LayoutDataIndexer.java

示例13: getChildrenBase

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<StructureViewTreeElement> getChildrenBase() {
  if (isHtml5SectionsMode()) {
    return Collections.emptyList(); // Html5SectionsNodeProvider will return its structure
  }

  final XmlFile xmlFile = getElement();
  final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
  if (document == null) {
    return Collections.emptyList();
  }

  final List<XmlTag> rootTags = new SmartList<XmlTag>();
  document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);

  if (rootTags.isEmpty()) {
    return Collections.emptyList();
  }
  else if (rootTags.size() == 1) {
    final XmlTag rootTag = rootTags.get(0);
    if ("html".equalsIgnoreCase(rootTag.getLocalName())) {
      final XmlTag[] subTags = rootTag.getSubTags();
      if (subTags.length == 1 &&
          ("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) {
        return new HtmlTagTreeElement(subTags[0]).getChildrenBase();
      }
      return new HtmlTagTreeElement(rootTag).getChildrenBase();
    }

    return Collections.<StructureViewTreeElement>singletonList(new HtmlTagTreeElement(rootTag));
  }
  else {
    final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(rootTags.size());
    for (XmlTag tag : rootTags) {
      result.add(new HtmlTagTreeElement(tag));
    }
    return result;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:HtmlFileTreeElement.java

示例14: updateTag

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public void updateTag(XmlTag tag) {
  setTag(tag);

  int size = myChildren.size();
  XmlTag[] tags = tag.getSubTags();

  for (int i = 0; i < size; i++) {
    RadViewComponent child = (RadViewComponent)myChildren.get(i);
    child.updateTag(tags[i]);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RadViewComponent.java

示例15: isNameInXml

import com.intellij.psi.xml.XmlTag; //导入方法依赖的package包/类
public static boolean isNameInXml(XmlTag rootTag, String name){
    if(rootTag == null){
        return false;
    }
    XmlTag[] xmlTags = rootTag.getSubTags();
    for(XmlTag xmlTag : xmlTags){
        if(xmlTag.getAttribute("name").getValue().equals(name)){
            return true;
        }
    }
    return false;
}
 
开发者ID:Androidyuan,项目名称:AndroidResourceGeneratedPlugin,代码行数:13,代码来源:TextUtils.java


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