本文整理汇总了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;
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}