本文整理汇总了Java中com.intellij.psi.impl.PsiFileEx类的典型用法代码示例。如果您正苦于以下问题:Java PsiFileEx类的具体用法?Java PsiFileEx怎么用?Java PsiFileEx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiFileEx类属于com.intellij.psi.impl包,在下文中一共展示了PsiFileEx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renewFile
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
private void renewFile() {
if (myFile == null || !myFile.isValid()) {
myFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
myCompiled = myFile instanceof PsiCompiledFile;
if (myCompiled) {
myFile = ((PsiCompiledFile)myFile).getDecompiledPsiFile();
}
if (myFile != null && !myFile.isValid()) {
myFile = null;
}
}
if (myFile != null) {
myFile.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, Boolean.TRUE);
}
}
示例2: calcXmlFileHeader
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
@NotNull
private static XmlFileHeader calcXmlFileHeader(final XmlFile file) {
if (file instanceof PsiFileEx && ((PsiFileEx)file).isContentsLoaded() && file.getNode().isParsed()) {
return computeHeaderByPsi(file);
}
if (!XmlUtil.isStubBuilding() && file.getFileType() == XmlFileType.INSTANCE) {
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile instanceof VirtualFileWithId) {
ObjectStubTree tree = StubTreeLoader.getInstance().readFromVFile(file.getProject(), virtualFile);
if (tree != null) {
Stub root = tree.getRoot();
if (root instanceof FileStub) {
return ((FileStub)root).getHeader();
}
}
}
}
if (!file.isValid()) return XmlFileHeader.EMPTY;
return NanoXmlUtil.parseHeader(file);
}
示例3: requeueIfPossible
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public static void requeueIfPossible(InferenceCapable element) {
final Boolean userData = ObjectUtils.notNull(element.getContainingFile().getUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING), false);
if (!userData && !PsiTreeUtil.hasErrorElements(element)) {
final Project project = element.getProject();
if (project != null)
LuaPsiManager.getInstance(project).queueInferences(element);
}
}
示例4: analyzeFileDependencies
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public static void analyzeFileDependencies(@NotNull PsiFile file,
@NotNull DependencyProcessor processor,
@NotNull DependencyVisitorFactory.VisitorOptions options) {
file.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, Boolean.TRUE);
file.accept(DependencyVisitorFactory.createVisitor(file, processor, options));
file.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, null);
}
示例5: compute
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
if (!(psiFile instanceof XmlFile)) {
return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE, PsiModificationTracker.MODIFICATION_COUNT);
}
final XmlFile xmlFile = (XmlFile)psiFile;
if (psiFile instanceof PsiFileEx) {
if (((PsiFileEx)psiFile).isContentsLoaded()) {
final XmlDocument doc = xmlFile.getDocument();
if (doc != null) {
final XmlTag rootTag = doc.getRootTag();
if (rootTag != null) {
XmlAttribute v;
XsltChecker.LanguageLevel level;
if (isXsltRootTag(rootTag)) {
v = rootTag.getAttribute("version");
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
}
else {
v = rootTag.getAttribute("version", XSLT_NS);
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
}
return CachedValueProvider.Result.create(level, rootTag);
}
}
}
}
final XsltChecker xsltChecker = new XsltChecker();
NanoXmlUtil.parseFile(psiFile, xsltChecker);
return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}
示例6: configure
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
private void configure() throws Throwable {
final String fileName = getTestFileName();
String path = fileName.replaceAll("_.*$", "") + ".xsl";
final VirtualFile file = myFixture.copyFileToProject(path);
myFixture.openFileInEditor(file);
if (fileName.endsWith("_Loaded")) {
((XmlFile)myFixture.getFile()).getDocument();
assertTrue(((PsiFileEx)myFixture.getFile()).isContentsLoaded());
} else {
assertFalse(((PsiFileEx)myFixture.getFile()).isContentsLoaded());
}
}
示例7: createFileCopy
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public static PsiFile createFileCopy(FileContent content, PsiFile psiFile) {
VirtualFile vFile = psiFile.getVirtualFile();
if (vFile == null) return psiFile; // It's already a copy created via PsiManager.getFile(FileContent). Usually happens on initial startup.
if (psiFile instanceof PsiFileEx) {
return ((PsiFileEx)psiFile).cacheCopy(content);
}
return psiFile;
}
示例8: calcXmlFileHeader
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
@NotNull
private static XmlFileHeader calcXmlFileHeader(final XmlFile file) {
if (file instanceof PsiFileEx && ((PsiFileEx)file).isContentsLoaded() && file.getNode().isParsed()) {
return computeHeaderByPsi(file);
}
if (!XmlUtil.isStubBuilding() && file.getFileType() == XmlFileType.INSTANCE) {
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile instanceof VirtualFileWithId) {
ObjectStubTree tree = StubTreeLoader.getInstance().readFromVFile(file.getProject(), virtualFile);
if (tree != null) {
Stub root = tree.getRoot();
if (root instanceof FileStub) {
return ((FileStub)root).getHeader();
}
}
}
}
if (!file.isValid()) return XmlFileHeader.EMPTY;
if (XmlUtil.isStubBuilding() && file.getFileType() == XmlFileType.INSTANCE) {
FileContent fileContent = file.getUserData(DomStubBuilder.CONTENT_FOR_DOM_STUBS);
if (fileContent != null) {
//noinspection IOResourceOpenedButNotSafelyClosed
return NanoXmlUtil.parseHeader(new CharSequenceReader(fileContent.getContentAsText()));
}
}
return NanoXmlUtil.parseHeader(file);
}
示例9: compute
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
if (!(psiFile instanceof XmlFile)) {
return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE);
}
final XmlFile xmlFile = (XmlFile)psiFile;
if (psiFile instanceof PsiFileEx) {
if (((PsiFileEx)psiFile).isContentsLoaded()) {
final XmlDocument doc = xmlFile.getDocument();
if (doc != null) {
final XmlTag rootTag = doc.getRootTag();
if (rootTag != null) {
XmlAttribute v;
XsltChecker.LanguageLevel level;
if (isXsltRootTag(rootTag)) {
v = rootTag.getAttribute("version");
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
}
else {
v = rootTag.getAttribute("version", XSLT_NS);
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
}
return CachedValueProvider.Result.create(level, rootTag);
}
}
}
}
final XsltChecker xsltChecker = new XsltChecker();
NanoXmlUtil.parseFile(psiFile, xsltChecker);
return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}
示例10: configure
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
private void configure() throws Throwable {
final String fileName = getTestFileName();
myFixture.configureByFile(fileName.replaceAll("_.*$", "") + ".xsl");
if (fileName.endsWith("_Loaded")) {
((XmlFile)myFixture.getFile()).getDocument();
assertTrue(((PsiFileEx)myFixture.getFile()).isContentsLoaded());
} else {
assertFalse(((PsiFileEx)myFixture.getFile()).isContentsLoaded());
}
}
示例11: getPsiInner
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
@Override
@Nullable
protected PsiFile getPsiInner(@Nonnull Language target) {
if (target != getBaseLanguage()) {
return null;
}
PsiFile psiFile = myPsiFile.get();
if (psiFile == null) {
psiFile = createFile();
if (psiFile == null) {
psiFile = PsiUtilCore.NULL_PSI_FILE;
}
boolean set = myPsiFile.compareAndSet(null, psiFile);
if (!set && psiFile != PsiUtilCore.NULL_PSI_FILE) {
PsiFile alreadyCreated = myPsiFile.get();
if (alreadyCreated == psiFile) {
LOG.error(this + ".createFile() must create new file instance but got the same: " + psiFile);
}
if (psiFile instanceof PsiFileEx) {
PsiFile finalPsiFile = psiFile;
DebugUtil.performPsiModification("invalidating throw-away copy", () ->
((PsiFileEx)finalPsiFile).markInvalidated()
);
}
psiFile = alreadyCreated;
}
}
return psiFile == PsiUtilCore.NULL_PSI_FILE ? null : psiFile;
}
示例12: forceCachedPsi
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public final void forceCachedPsi(@Nonnull PsiFile psiFile) {
PsiFile prev = myPsiFile.getAndSet(psiFile);
if (prev != null && prev != psiFile && prev instanceof PsiFileEx) {
((PsiFileEx)prev).markInvalidated();
}
getManager().getFileManager().setViewProvider(getVirtualFile(), this);
}
示例13: markInvalidated
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
@Override
public final void markInvalidated() {
PsiFile psiFile = getCachedPsi(getBaseLanguage());
if (psiFile instanceof PsiFileEx) {
((PsiFileEx)psiFile).markInvalidated();
}
super.markInvalidated();
}
示例14: renewFile
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
private void renewFile() {
if (myFile == null || !myFile.isValid()) {
myFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
if (myFile != null && !myFile.isValid()) {
myFile = null;
}
}
if (myFile != null) {
myFile.putUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING, Boolean.TRUE);
}
}
示例15: compute
import com.intellij.psi.impl.PsiFileEx; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
if (!(psiFile instanceof XmlFile)) {
return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE);
}
final XmlFile xmlFile = (XmlFile)psiFile;
if (psiFile instanceof PsiFileEx) {
if (((PsiFileEx)psiFile).isContentsLoaded()) {
final XmlDocument doc = xmlFile.getDocument();
if (doc != null) {
final XmlTag rootTag = doc.getRootTag();
if (rootTag != null) {
XmlAttribute v;
XsltChecker.LanguageLevel level;
if (isXsltRootTag(rootTag)) {
v = rootTag.getAttribute("version");
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
} else {
v = rootTag.getAttribute("version", XSLT_NS);
level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
}
return CachedValueProvider.Result.create(level, rootTag);
}
}
}
}
final XsltChecker xsltChecker = new XsltChecker();
NanoXmlUtil.parseFile(psiFile, xsltChecker);
return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}