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

Java XmlTagImpl类代码示例

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

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



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

示例1: isElementWithEmbeddedType

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isElementWithEmbeddedType(XmlTagImpl xml, final String typeName, final String typeNsPrefix) {
  final String localName = xml.getLocalName();
  if (! (XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName))) {
    return false;
  }
  final XmlAttribute nameAttr = getNameAttr(xml);
  if (nameAttr == null || nameAttr.getValue() == null) return false;
  final String localTypeName = XmlUtil.findLocalNameByQualifiedName(nameAttr.getValue());
  final String prefix = XmlUtil.findPrefixByQualifiedName(nameAttr.getValue());
  if (! typeName.equals(localTypeName) || ! typeNsPrefix.equals(prefix)) {
    return false;
  }
  final XmlTag[] tags = xml.getSubTags();
  for (XmlTag tag : tags) {
    if (isTypeElement((XmlTagImpl)tag)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SchemaDefinitionsSearch.java


示例2: isElementWithSomeEmbeddedType

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isElementWithSomeEmbeddedType(XmlTagImpl xml)
{
	final String localName = xml.getLocalName();
	if(!(XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName)))
	{
		return false;
	}
	final XmlTag[] tags = xml.getSubTags();
	for(XmlTag tag : tags)
	{
		if(isTypeElement((XmlTagImpl) tag))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:18,代码来源:SchemaDefinitionsSearch.java


示例3: isCertainTypeElement

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
private boolean isCertainTypeElement(XmlTagImpl xml, final String typeName, final String nsPrefix)
{
	if(!isTypeElement(xml))
	{
		return false;
	}
	final XmlAttribute name = getNameAttr(xml);
	if(name == null)
	{
		return false;
	}
	final String value = name.getValue();
	if(value == null)
	{
		return false;
	}
	final String localName = XmlUtil.findLocalNameByQualifiedName(value);
	return typeName.equals(localName) && nsPrefix.equals(XmlUtil.findPrefixByQualifiedName(value));
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:20,代码来源:SchemaDefinitionsSearch.java


示例4: findRouteFromElement

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
/**
 * Returns the Camel route from a PsiElement
 *
 * @param element the element
 * @return the String route or null if there nothing can be found
 */
private String findRouteFromElement(PsiElement element) {
    XmlTag xml = PsiTreeUtil.getParentOfType(element, XmlTag.class);
    if (xml != null) {
        return ((XmlTagImpl) element.getParent()).getAttributeValue("uri");
    }

    if (element instanceof PsiLiteralExpressionImpl) {
        return ((PsiLiteralExpressionImpl) element).getValue() == null ? null : ((PsiLiteralExpressionImpl) element).getValue().toString();
    }

    if (element instanceof PsiIdentifier) {
        PsiIdentifier id = (PsiIdentifier) element;
        String text = id.getText();
        if (text != null) {
            return text;
        }
    }

    // Only variables can be resolved?
    Optional<PsiVariable> variable = resolvedIdentifier(element)
        .filter(PsiVariable.class::isInstance)
        .map(PsiVariable.class::cast);
    if (variable.isPresent()) {
        // Try to resolve variable and recursive search route
        return variable.map(PsiVariable::getInitializer)
            .map(this::findRouteFromElement)
            .orElse(null);
    }

    return null;
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:38,代码来源:CamelRouteLineMarkerProvider.java


示例5: getRenderer

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(@NotNull PsiElement element, @NotNull GotoTargetHandler.GotoData gotoData) {
  if (element instanceof XmlTagImpl) {
    if (SchemaDefinitionsSearch.isTypeElement((XmlTagImpl)element)) {
      return new MyRenderer("");
    }  else if (SchemaDefinitionsSearch.isElementWithSomeEmbeddedType((XmlTagImpl)element)) {
      return new MyRenderer("xsd:element: ");
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GotoXmlSchemaTypeRendererProvider.java


示例6: isElementWithSomeEmbeddedType

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isElementWithSomeEmbeddedType(XmlTagImpl xml) {
  final String localName = xml.getLocalName();
  if (! (XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName))) {
    return false;
  }
  final XmlTag[] tags = xml.getSubTags();
  for (XmlTag tag : tags) {
    if (isTypeElement((XmlTagImpl)tag)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SchemaDefinitionsSearch.java


示例7: isCertainTypeElement

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
private boolean isCertainTypeElement(XmlTagImpl xml, final String typeName, final String nsPrefix) {
  if (! isTypeElement(xml)) return false;
  final XmlAttribute name = getNameAttr(xml);
  if (name == null) return false;
  final String value = name.getValue();
  if (value == null) return false;
  final String localName = XmlUtil.findLocalNameByQualifiedName(value);
  return typeName.equals(localName) && nsPrefix.equals(XmlUtil.findPrefixByQualifiedName(value));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SchemaDefinitionsSearch.java


示例8: getRenderer

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(PsiElement element, GotoTargetHandler.GotoData gotoData) {
  if (element instanceof XmlTagImpl) {
    if (SchemaDefinitionsSearch.isTypeElement((XmlTagImpl)element)) {
      return new MyRenderer("");
    }  else if (SchemaDefinitionsSearch.isElementWithSomeEmbeddedType((XmlTagImpl)element)) {
      return new MyRenderer("xsd:element: ");
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GotoXmlSchemaTypeRendererProvider.java


示例9: givenBlobPropertyXmlTag

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
private void givenBlobPropertyXmlTag()
{
    // TODO xmlTag zusammenbauen scheitert :-(
    xmlTag = new XmlTagImpl();
    xmlTag.setName(BlobProperty.PROPERTY_TYPE);
    xmlTag.setAttribute(BlobProperty.NAME_ATTR, "MP3");
    xmlTag.setAttribute(BlobProperty.MIME_TYPE_ATTR, "audio/x-mpeg");
}
 
开发者ID:monday-consulting,项目名称:idea-coremedia-plugin,代码行数:9,代码来源:PropertyTest.java


示例10: NSDeclTracker

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public NSDeclTracker(XmlTag rootTag)
{
	myRootTag = (XmlTagImpl) rootTag;
	myFile = rootTag.getContainingFile();
	myNSDecls = getNSDecls(false);
	myRootCount = myFile.getModificationStamp();
	myCount = 0;
}
 
开发者ID:consulo,项目名称:consulo-xslt,代码行数:9,代码来源:NSDeclTracker.java


示例11: isElementWithEmbeddedType

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isElementWithEmbeddedType(XmlTagImpl xml, final String typeName, final String typeNsPrefix)
{
	final String localName = xml.getLocalName();
	if(!(XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName)))
	{
		return false;
	}
	final XmlAttribute nameAttr = getNameAttr(xml);
	if(nameAttr == null || nameAttr.getValue() == null)
	{
		return false;
	}
	final String localTypeName = XmlUtil.findLocalNameByQualifiedName(nameAttr.getValue());
	final String prefix = XmlUtil.findPrefixByQualifiedName(nameAttr.getValue());
	if(!typeName.equals(localTypeName) || !typeNsPrefix.equals(prefix))
	{
		return false;
	}
	final XmlTag[] tags = xml.getSubTags();
	for(XmlTag tag : tags)
	{
		if(isTypeElement((XmlTagImpl) tag))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:29,代码来源:SchemaDefinitionsSearch.java


示例12: getElementText

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
public String getElementText(XmlTagImpl element) {
  final XmlAttribute attr = SchemaDefinitionsSearch.getNameAttr(element);
  return myPrefix + (attr == null || attr.getValue() == null ? element.getName() : attr.getValue());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GotoXmlSchemaTypeRendererProvider.java


示例13: getContainerText

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
protected String getContainerText(XmlTagImpl element, String name) {
  final PsiFile file = element.getContainingFile();
  return "(" + file.getName() + ")";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GotoXmlSchemaTypeRendererProvider.java


示例14: execute

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<PsiElement> consumer) {
  if (queryParameters instanceof XmlTagImpl) {
    final XmlTagImpl xml = (XmlTagImpl) queryParameters;
    if (isTypeElement(xml)) {
      final Collection<SchemaTypeInfo> infos = ApplicationManager.getApplication().runReadAction(new Computable<Collection<SchemaTypeInfo>>() {

        @Override
        public Collection<SchemaTypeInfo> compute() {
          return gatherInheritors(xml);
        }
      });

      if (infos != null && ! infos.isEmpty()) {
        final XmlFile file = XmlUtil.getContainingFile(xml);
        final Project project = file.getProject();
        final Module module = ModuleUtilCore.findModuleForPsiElement(queryParameters);
        //if (module == null) return false;

        final VirtualFile vf = file.getVirtualFile();
        String thisNs = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
          @Override
          public String compute() {
            return XmlNamespaceIndex.getNamespace(vf, project, file);
          }
        });
        thisNs = thisNs == null ? getDefaultNs(file) : thisNs;
        // so thisNs can be null
        if (thisNs == null) return false;
        final ArrayList<SchemaTypeInfo> infosLst = new ArrayList<SchemaTypeInfo>(infos);
        Collections.sort(infosLst);
        final Map<String, Set<XmlFile>> nsMap = new HashMap<String, Set<XmlFile>>();
        for (final SchemaTypeInfo info : infosLst) {
          Set<XmlFile> targetFiles = nsMap.get(info.getNamespaceUri());
          if (targetFiles == null) {
            targetFiles = new HashSet<XmlFile>();
            if (Comparing.equal(info.getNamespaceUri(), thisNs)) {
              targetFiles.add(file);
            }
            final Collection<XmlFile> files = ApplicationManager.getApplication().runReadAction(new Computable<Collection<XmlFile>>() {
              @Override
              public Collection<XmlFile> compute() {
                return XmlUtil.findNSFilesByURI(info.getNamespaceUri(), project, module);
              }
            });
            if (files != null) {
              targetFiles.addAll(files);
            }
            nsMap.put(info.getNamespaceUri(), targetFiles);
          }
          if (! targetFiles.isEmpty()) {
            for (final XmlFile targetFile : targetFiles) {
              ApplicationManager.getApplication().runReadAction(new Runnable() {
                @Override
                public void run() {
                  final String prefixByURI = XmlUtil.findNamespacePrefixByURI(targetFile, info.getNamespaceUri());
                  if (prefixByURI == null) return;
                  final PsiElementProcessor processor = new PsiElementProcessor() {
                    @Override
                    public boolean execute(@NotNull PsiElement element) {
                      if (element instanceof XmlTagImpl) {
                        if (isCertainTypeElement((XmlTagImpl)element, info.getTagName(), prefixByURI) ||
                            isElementWithEmbeddedType((XmlTagImpl)element, info.getTagName(), prefixByURI)) {
                          consumer.process(element);
                          return false;
                        }
                      }
                      return true;
                    }
                  };
                  XmlUtil.processXmlElements(targetFile, processor, true);
                }
              });
            }
          }
        }
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:82,代码来源:SchemaDefinitionsSearch.java


示例15: isTypeElement

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isTypeElement(XmlTagImpl xml) {
  final String localName = xml.getLocalName();
  return XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && ("complexType".equals(localName) || "simpleType".equals(localName));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:SchemaDefinitionsSearch.java


示例16: gatherInheritors

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
private Collection<SchemaTypeInfo> gatherInheritors(XmlTagImpl xml) {
  XmlAttribute name = getNameAttr(xml);
  if (name == null || StringUtil.isEmptyOrSpaces(name.getValue())) return null;
  String localName = name.getValue();
  final boolean hasPrefix = localName.contains(":");
  localName = hasPrefix ? localName.substring(localName.indexOf(':') + 1) : localName;
  final String nsPrefix = hasPrefix ? name.getValue().substring(0, name.getValue().indexOf(':')) : null;

  final XmlFile file = XmlUtil.getContainingFile(xml);
  if (file == null) return null;
  final Project project = file.getProject();
  if (project == null) return null;

  final Set<SchemaTypeInfo> result = new HashSet<SchemaTypeInfo>();
  final ArrayDeque<SchemaTypeInfo> queue = new ArrayDeque<SchemaTypeInfo>();

  String nsUri;
  if (! hasPrefix) {
    nsUri = getDefaultNs(file);
  } else {
    nsUri = XmlUtil.findNamespaceByPrefix(nsPrefix, file.getRootTag());
  }
  if (nsUri == null) return null;

  queue.add(new SchemaTypeInfo(localName, true, nsUri));

  final PairConvertor<String,String,List<Set<SchemaTypeInfo>>> worker =
    SchemaTypeInheritanceIndex.getWorker(project, file.getContainingFile().getVirtualFile());
  while (! queue.isEmpty()) {
    final SchemaTypeInfo info = queue.removeFirst();
    final List<Set<SchemaTypeInfo>> childrenOfType = worker.convert(info.getNamespaceUri(), info.getTagName());
    for (Set<SchemaTypeInfo> infos : childrenOfType) {
      for (SchemaTypeInfo typeInfo : infos) {
        if (typeInfo.isIsTypeName()) {
          queue.add(typeInfo);
        }
        result.add(typeInfo);
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:SchemaDefinitionsSearch.java


示例17: getNameAttr

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static XmlAttribute getNameAttr(XmlTagImpl xml) {
  XmlAttribute name = xml.getAttribute("name", XmlUtil.XML_SCHEMA_URI);
  name = name == null ? xml.getAttribute("name") : name;
  return name;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:SchemaDefinitionsSearch.java


示例18: NSDeclTracker

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public NSDeclTracker(XmlTag rootTag) {
    myRootTag = (XmlTagImpl)rootTag;
    myNSDecls = getNSDecls(false);
    myRootCount = myRootTag.getModificationCount();
    myCount = 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:NSDeclTracker.java


示例19: execute

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final PsiElement queryParameters, @NotNull final Processor<PsiElement> consumer) {
  if (queryParameters instanceof XmlTagImpl) {
    final XmlTagImpl xml = (XmlTagImpl) queryParameters;
    if (isTypeElement(xml)) {
      final Collection<SchemaTypeInfo> infos = ApplicationManager.getApplication().runReadAction(new Computable<Collection<SchemaTypeInfo>>() {

        @Override
        public Collection<SchemaTypeInfo> compute() {
          return gatherInheritors(xml);
        }
      });

      if (infos != null && ! infos.isEmpty()) {
        final XmlFile file = XmlUtil.getContainingFile(xml);
        final Project project = file.getProject();
        final Module module = ModuleUtil.findModuleForPsiElement(queryParameters);
        //if (module == null) return false;

        final VirtualFile vf = file.getVirtualFile();
        String thisNs = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
          @Override
          public String compute() {
            return XmlNamespaceIndex.getNamespace(vf, project, file);
          }
        });
        thisNs = thisNs == null ? getDefaultNs(file) : thisNs;
        // so thisNs can be null
        if (thisNs == null) return false;
        final ArrayList<SchemaTypeInfo> infosLst = new ArrayList<SchemaTypeInfo>(infos);
        Collections.sort(infosLst);
        final Map<String, Set<XmlFile>> nsMap = new HashMap<String, Set<XmlFile>>();
        for (final SchemaTypeInfo info : infosLst) {
          Set<XmlFile> targetFiles = nsMap.get(info.getNamespaceUri());
          if (targetFiles == null) {
            targetFiles = new HashSet<XmlFile>();
            if (Comparing.equal(info.getNamespaceUri(), thisNs)) {
              targetFiles.add(file);
            }
            final Collection<XmlFile> files = ApplicationManager.getApplication().runReadAction(new Computable<Collection<XmlFile>>() {
              @Override
              public Collection<XmlFile> compute() {
                return XmlUtil.findNSFilesByURI(info.getNamespaceUri(), project, module);
              }
            });
            if (files != null) {
              targetFiles.addAll(files);
            }
            nsMap.put(info.getNamespaceUri(), targetFiles);
          }
          if (! targetFiles.isEmpty()) {
            for (final XmlFile targetFile : targetFiles) {
              ApplicationManager.getApplication().runReadAction(new Runnable() {
                @Override
                public void run() {
                  final String prefixByURI = XmlUtil.findNamespacePrefixByURI(targetFile, info.getNamespaceUri());
                  if (prefixByURI == null) return;
                  final PsiElementProcessor processor = new PsiElementProcessor() {
                    @Override
                    public boolean execute(@NotNull PsiElement element) {
                      if (element instanceof XmlTagImpl) {
                        if (isCertainTypeElement((XmlTagImpl)element, info.getTagName(), prefixByURI) ||
                            isElementWithEmbeddedType((XmlTagImpl)element, info.getTagName(), prefixByURI)) {
                          consumer.process(element);
                          return false;
                        }
                      }
                      return true;
                    }
                  };
                  XmlUtil.processXmlElements(targetFile, processor, true);
                }
              });
            }
          }
        }
      }
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:82,代码来源:SchemaDefinitionsSearch.java


示例20: isTypeElement

import com.intellij.psi.impl.source.xml.XmlTagImpl; //导入依赖的package包/类
public static boolean isTypeElement(XmlTagImpl xml)
{
	final String localName = xml.getLocalName();
	return XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && ("complexType".equals(localName) || "simpleType".equals(localName));
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:6,代码来源:SchemaDefinitionsSearch.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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