Java 类com.intellij.psi.impl.include.FileIncludeInfo 实例源码

项目:intellij-ce-playground    文件:FilePathResolveTest.java   
public void testResolveFileReference() throws Exception {
  configureByFile(BASE_PATH + "C.java", BASE_PATH);
  FileIncludeManager fileIncludeManager = FileIncludeManager.getManager(getProject());
  PsiFileSystemItem item = fileIncludeManager.resolveFileInclude(new FileIncludeInfo("x/MyFile.txt"), getFile());
  assertNotNull(item);
  assertEquals("MyFile.txt", item.getName());
}
项目:intellij-ce-playground    文件:RelaxIncludeProvider.java   
@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()]);
}
项目:tools-idea    文件:FilePathResolveTest.java   
public void testResolveFileReference() throws Exception {
  configureByFile(BASE_PATH + "C.java", BASE_PATH);
  FileIncludeManager fileIncludeManager = FileIncludeManager.getManager(getProject());
  PsiFileSystemItem item = fileIncludeManager.resolveFileInclude(new FileIncludeInfo("x/MyFile.txt"), getFile());
  assertNotNull(item);
  assertEquals("MyFile.txt", item.getName());
}
项目:tools-idea    文件:RelaxIncludeProvider.java   
@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()]);
}
项目:consulo-xml    文件:RelaxIncludeProvider.java   
@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()]);
}
项目:consulo-java    文件:FilePathResolveTest.java   
public void testResolveFileReference() throws Exception {
  configureByFile(BASE_PATH + "C.java", BASE_PATH);
  FileIncludeManager fileIncludeManager = FileIncludeManager.getManager(getProject());
  PsiFileSystemItem item = fileIncludeManager.resolveFileInclude(new FileIncludeInfo("x/MyFile.txt"), getFile());
  assertNotNull(item);
  assertEquals("MyFile.txt", item.getName());
}
项目:intellij-ce-playground    文件:RelaxIncludeProvider.java   
public RngBuilderAdapter(ArrayList<FileIncludeInfo> infos) {
  myInfos = infos;
}
项目:intellij-ce-playground    文件:RelaxIncludeProvider.java   
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
  if (isInclude && "href".equals(key)) {
    myInfos.add(new FileIncludeInfo(value));
  }
}
项目:tools-idea    文件:RelaxIncludeProvider.java   
public RngBuilderAdapter(ArrayList<FileIncludeInfo> infos) {
  myInfos = infos;
}
项目:tools-idea    文件:RelaxIncludeProvider.java   
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
  if (isInclude && "href".equals(key)) {
    myInfos.add(new FileIncludeInfo(value));
  }
}
项目:consulo-xml    文件:RelaxIncludeProvider.java   
public RngBuilderAdapter(ArrayList<FileIncludeInfo> infos) {
  myInfos = infos;
}
项目:consulo-xml    文件:RelaxIncludeProvider.java   
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
  if (isInclude && "href".equals(key)) {
    myInfos.add(new FileIncludeInfo(value));
  }
}