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


Java ApplicationLoader类代码示例

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


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

示例1: getIncludeInfos

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@NotNull
@Override
public FileIncludeInfo[] getIncludeInfos(FileContent content) {
  final ArrayList<FileIncludeInfo> infos;

  if (content.getFileType() == XmlFileType.INSTANCE) {
    CharSequence inputDataContentAsText = content.getContentAsText();
    if (CharArrayUtil.indexOf(inputDataContentAsText, ApplicationLoader.RNG_NAMESPACE, 0) == -1) return FileIncludeInfo.EMPTY;
    infos = new ArrayList<FileIncludeInfo>();
    NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(content.getContentAsText()), new RngBuilderAdapter(infos));
  } else if (content.getFileType() == RncFileType.getInstance()) {
    infos = new ArrayList<FileIncludeInfo>();
    content.getPsiFile().acceptChildren(new RncElementVisitor() {
      @Override
      public void visitElement(RncElement element) {
        element.acceptChildren(this);
      }

      @Override
      public void visitInclude(RncInclude include) {
        final String path = include.getFileReference();
        if (path != null) {
          infos.add(new FileIncludeInfo(path));
        }
      }
    });
  } else {
    return FileIncludeInfo.EMPTY;
  }
  return infos.toArray(new FileIncludeInfo[infos.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:RelaxIncludeProvider.java

示例2: startElement

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@Override
public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) throws Exception {
  boolean isRngTag = ApplicationLoader.RNG_NAMESPACE.equals(nsURI);
  if (!isRNG) { // analyzing start tag
    if (!isRngTag) {
      stop();
    } else {
      isRNG = true;
    }
  }
  isInclude = isRngTag && "include".equals(name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:RelaxIncludeProvider.java

示例3: validate

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@Override
public void validate(@NotNull PsiElement context, @NotNull final ValidationHost host) {
  final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false);
  if (doc == null) {
    return;
  }
  final XmlTag rootTag = doc.getRootTag();
  if (rootTag == null) {
    return;
  }
  // RNG XML itself is validated by parsing it with Jing, so we don't want to schema-validate it
  if (!ApplicationLoader.RNG_NAMESPACE.equals(rootTag.getNamespace())) {
    XmlInstanceValidator.doValidation(doc, host, getDescriptorFile());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RngNsDescriptor.java

示例4: createReferences

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@Override
@NotNull
public PsiReference[] createReferences(GenericDomValue<XmlFile> genericDomValue, PsiElement element, ConvertContext context) {
  final String s = genericDomValue.getStringValue();
  if (s == null || element == null) {
    return PsiReference.EMPTY_ARRAY;
  }
  final FileReferenceSet set = FileReferenceSet.createSet(element, false, false, false);
  if (set != null) {
    return FileReferenceUtil.restrict(set, FileReferenceUtil.byNamespace(ApplicationLoader.RNG_NAMESPACE), true);
  } else {
    return PsiReference.EMPTY_ARRAY;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RngHrefConverter.java

示例5: validate

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
public void validate(@NotNull PsiElement context, @NotNull final ValidationHost host) {
  final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false);
  if (doc == null) {
    return;
  }
  final XmlTag rootTag = doc.getRootTag();
  if (rootTag == null) {
    return;
  }
  // RNG XML itself is validated by parsing it with Jing, so we don't want to schema-validate it
  if (!ApplicationLoader.RNG_NAMESPACE.equals(rootTag.getNamespace())) {
    XmlInstanceValidator.doValidation(doc, host, getDescriptorFile());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:RngNsDescriptor.java

示例6: createReferences

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@NotNull
public PsiReference[] createReferences(GenericDomValue<XmlFile> genericDomValue, PsiElement element, ConvertContext context) {
  final String s = genericDomValue.getStringValue();
  if (s == null || element == null) {
    return PsiReference.EMPTY_ARRAY;
  }
  final FileReferenceSet set = FileReferenceSet.createSet(element, false, false, false);
  if (set != null) {
    return FileReferenceUtil.restrict(set, FileReferenceUtil.byNamespace(ApplicationLoader.RNG_NAMESPACE), true);
  } else {
    return PsiReference.EMPTY_ARRAY;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:RngHrefConverter.java

示例7: getIncludeInfos

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
@NotNull
@Override
public FileIncludeInfo[] getIncludeInfos(FileContent content) {
  final ArrayList<FileIncludeInfo> infos;

  if (content.getFileType() == XmlFileType.INSTANCE) {
    CharSequence inputDataContentAsText = content.getContentAsText();
    if (CharArrayUtil.indexOf(inputDataContentAsText, ApplicationLoader.RNG_NAMESPACE, 0) == -1) return FileIncludeInfo.EMPTY;
    infos = new ArrayList<>();
    NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(content.getContentAsText()), new RngBuilderAdapter(infos));
  } else if (content.getFileType() == RncFileType.getInstance()) {
    infos = new ArrayList<>();
    content.getPsiFile().acceptChildren(new RncElementVisitor() {
      @Override
      public void visitElement(RncElement element) {
        element.acceptChildren(this);
      }

      @Override
      public void visitInclude(RncInclude include) {
        final String path = include.getFileReference();
        if (path != null) {
          infos.add(new FileIncludeInfo(path));
        }
      }
    });
  } else {
    return FileIncludeInfo.EMPTY;
  }
  return infos.toArray(new FileIncludeInfo[infos.size()]);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:32,代码来源:RelaxIncludeProvider.java

示例8: visitXmlTag

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
public void visitXmlTag(XmlTag tag) {
  final PsiFile file = tag.getContainingFile();
  if (file.getFileType() != StdFileTypes.XML) {
    return;
  }
  if (!tag.getLocalName().equals("define")) {
    return;
  }
  if (!tag.getNamespace().equals(ApplicationLoader.RNG_NAMESPACE)) {
    return;
  }
  if (tag.getAttribute("combine") != null) {
    return; // ?
  }

  final XmlAttribute attr = tag.getAttribute("name");
  if (attr == null) return;

  final XmlAttributeValue value = attr.getValueElement();
  if (value == null) return;

  final String s = value.getValue();
  if (s == null || s.length() == 0) {
    return;
  }
  final PsiElement parent = value.getParent();
  if (!(parent instanceof XmlAttribute)) {
    return;
  }
  if (!"name".equals(((XmlAttribute)parent).getName())) {
    return;
  }
  final PsiElement grandParent = parent.getParent();
  if (!(grandParent instanceof XmlTag)) {
    return;
  }

  final DomElement element = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
  if (element == null) {
    return;
  }

  final RngGrammar rngGrammar = element.getParentOfType(RngGrammar.class, true);
  if (rngGrammar != null) {
    if (processUsages(tag, value, new LocalSearchScope(rngGrammar.getXmlTag()))) return;
  } else {
    if (processUsages(tag, value, new LocalSearchScope(file))) return;
  }

  final PsiElementProcessor.CollectElements<XmlFile> collector = new PsiElementProcessor.CollectElements<XmlFile>();
  RelaxIncludeIndex.processBackwardDependencies((XmlFile)file, collector);

  if (processUsages(tag, value, new LocalSearchScope(collector.toArray()))) return;

  myHolder.registerProblem(value, "Unreferenced define", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new MyFix<XmlTag>(tag));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:UnusedDefineInspection.java

示例9: visitXmlTag

import org.intellij.plugins.relaxNG.ApplicationLoader; //导入依赖的package包/类
public void visitXmlTag(XmlTag tag) {
  final PsiFile file = tag.getContainingFile();
  if (file.getFileType() != XmlFileType.INSTANCE) {
    return;
  }
  if (!tag.getLocalName().equals("define")) {
    return;
  }
  if (!tag.getNamespace().equals(ApplicationLoader.RNG_NAMESPACE)) {
    return;
  }
  if (tag.getAttribute("combine") != null) {
    return; // ?
  }

  final XmlAttribute attr = tag.getAttribute("name");
  if (attr == null) return;

  final XmlAttributeValue value = attr.getValueElement();
  if (value == null) return;

  final String s = value.getValue();
  if (s == null || s.length() == 0) {
    return;
  }
  final PsiElement parent = value.getParent();
  if (!(parent instanceof XmlAttribute)) {
    return;
  }
  if (!"name".equals(((XmlAttribute)parent).getName())) {
    return;
  }
  final PsiElement grandParent = parent.getParent();
  if (!(grandParent instanceof XmlTag)) {
    return;
  }

  final DomElement element = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
  if (element == null) {
    return;
  }

  final RngGrammar rngGrammar = element.getParentOfType(RngGrammar.class, true);
  if (rngGrammar != null) {
    if (processUsages(tag, value, new LocalSearchScope(rngGrammar.getXmlTag()))) return;
  } else {
    if (processUsages(tag, value, new LocalSearchScope(file))) return;
  }

  final PsiElementProcessor.CollectElements<XmlFile> collector = new PsiElementProcessor.CollectElements<>();
  RelaxIncludeIndex.processBackwardDependencies((XmlFile)file, collector);

  if (processUsages(tag, value, new LocalSearchScope(collector.toArray()))) return;

  myHolder.registerProblem(value, "Unreferenced define", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new MyFix<>(tag));
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:57,代码来源:UnusedDefineInspection.java


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