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


Java FileContent.getProject方法代码示例

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


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

示例1: buildStubTree

import com.intellij.util.indexing.FileContent; //导入方法依赖的package包/类
@Override
public StubElement buildStubTree(FileContent fileContent) {
  try {
    VirtualFile file = fileContent.getFile();
    Project project = fileContent.getProject();
    byte[] content = fileContent.getContent();
    final ClsStubBuilderFactory[] factories = Extensions.getExtensions(ClsStubBuilderFactory.EP_NAME);
    for (ClsStubBuilderFactory factory : factories) {
      if (!factory.isInnerClass(file) && factory.canBeProcessed(file, content)) {
        PsiFileStub stub = factory.buildFileStub(file, content, project);
        if (stub != null) return stub;
      }
    }
    if (!fileContent.getFileName().contains("$")) {
      LOG.info("No stub built for file " + fileContent);
    }
    return null;
  }
  catch (ClsFormatException e) {
    return null;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ClassFileStubBuilder.java

示例2: buildStubTree

import com.intellij.util.indexing.FileContent; //导入方法依赖的package包/类
@Override
public Stub buildStubTree(FileContent fileContent) {
  PsiFile psiFile = fileContent.getPsiFile();
  if (!(psiFile instanceof XmlFile)) return null;

  Document document = FileDocumentManager.getInstance().getCachedDocument(fileContent.getFile());
  Project project = fileContent.getProject();
  if (project == null) {
    project = psiFile.getProject();
  }
  if (document != null) {
    PsiFile existingPsi = PsiDocumentManager.getInstance(project).getPsiFile(document);
    if (existingPsi instanceof XmlFile) {
      psiFile = existingPsi;
    }
  }

  XmlFile xmlFile = (XmlFile)psiFile;
  try {
    XmlUtil.BUILDING_DOM_STUBS.set(Boolean.TRUE);
    DomFileElement<? extends DomElement> fileElement = DomManager.getDomManager(project).getFileElement(xmlFile);
    if (fileElement == null || !fileElement.getFileDescription().hasStubs()) return null;

    XmlFileHeader header = DomService.getInstance().getXmlFileHeader(xmlFile);
    if (header.getRootTagLocalName() == null) {
      LOG.error("null root tag for " + fileElement + " for " + fileContent.getFile());
    }
    FileStub fileStub = new FileStub(header);
    XmlTag rootTag = xmlFile.getRootTag();
    if (rootTag != null) {
      new DomStubBuilderVisitor(DomManagerImpl.getDomManager(project)).visitXmlElement(rootTag, fileStub, 0);
    }
    return fileStub;
  }
  finally {
    XmlUtil.BUILDING_DOM_STUBS.set(Boolean.FALSE);
    SemService.getSemService(project).clearCache();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:DomStubBuilder.java

示例3: buildStubTree

import com.intellij.util.indexing.FileContent; //导入方法依赖的package包/类
@Override
public Stub buildStubTree(FileContent fileContent) {
  VirtualFile file = fileContent.getFile();
  Project project = fileContent.getProject();
  PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  if (!(psiFile instanceof XmlFile)) return null;

  XmlFile xmlFile = (XmlFile)psiFile;
  try {
    XmlUtil.BUILDING_DOM_STUBS.set(Boolean.TRUE);
    psiFile.putUserData(CONTENT_FOR_DOM_STUBS, fileContent);
    DomFileElement<? extends DomElement> fileElement = DomManager.getDomManager(project).getFileElement(xmlFile);
    if (fileElement == null || !fileElement.getFileDescription().hasStubs()) return null;

    XmlFileHeader header = DomService.getInstance().getXmlFileHeader(xmlFile);
    if (header.getRootTagLocalName() == null) {
      LOG.error("null root tag for " + fileElement + " for " + file);
    }
    FileStub fileStub = new FileStub(header);
    DomStubBuilderVisitor visitor = new DomStubBuilderVisitor(fileStub);
    visitor.visitDomElement(fileElement.getRootElement());
    return fileStub;
  }
  finally {
    XmlUtil.BUILDING_DOM_STUBS.set(Boolean.FALSE);
    psiFile.putUserData(CONTENT_FOR_DOM_STUBS, null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:DomStubBuilder.java

示例4: buildStubTree

import com.intellij.util.indexing.FileContent; //导入方法依赖的package包/类
@Override
public Stub buildStubTree(FileContent fileContent)
{
	VirtualFile file = fileContent.getFile();
	Project project = fileContent.getProject();
	PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
	if(!(psiFile instanceof XmlFile))
	{
		return null;
	}

	XmlFile xmlFile = (XmlFile) psiFile;
	try
	{
		XmlUtil.BUILDING_DOM_STUBS.set(Boolean.TRUE);
		psiFile.putUserData(CONTENT_FOR_DOM_STUBS, fileContent);
		DomFileElement<? extends DomElement> fileElement = DomManager.getDomManager(project).getFileElement(xmlFile);
		if(fileElement == null || !fileElement.getFileDescription().hasStubs())
		{
			return null;
		}

		XmlFileHeader header = DomService.getInstance().getXmlFileHeader(xmlFile);
		if(header.getRootTagLocalName() == null)
		{
			LOG.error("null root tag for " + fileElement + " for " + file);
		}
		FileStub fileStub = new FileStub(header);
		XmlTag rootTag = xmlFile.getRootTag();
		if(rootTag != null)
		{
			new DomStubBuilderVisitor(DomManagerImpl.getDomManager(project)).visitXmlElement(rootTag, fileStub, 0);
		}
		return fileStub;
	}
	finally
	{
		XmlUtil.BUILDING_DOM_STUBS.set(Boolean.FALSE);
		psiFile.putUserData(CONTENT_FOR_DOM_STUBS, null);
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:42,代码来源:DomStubBuilder.java


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