Java Code Examples for com.intellij.psi.util.PsiUtilCore#NULL_PSI_ELEMENT
The following examples show how to use
com.intellij.psi.util.PsiUtilCore#NULL_PSI_ELEMENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PsiInvalidElementAccessException.java From consulo with Apache License 2.0 | 6 votes |
public PsiInvalidElementAccessException(@Nullable PsiElement element, @Nullable String message, @Nullable Throwable cause) { super(null, cause); myElementReference = new SoftReference<PsiElement>(element); if (element == null) { myMessage = message; myDiagnostic = Attachment.EMPTY_ARRAY; } else if (element == PsiUtilCore.NULL_PSI_ELEMENT) { myMessage = "NULL_PSI_ELEMENT ;" + message; myDiagnostic = Attachment.EMPTY_ARRAY; } else { boolean recursiveInvocation = Boolean.TRUE.equals(element.getUserData(REPORTING_EXCEPTION)); element.putUserData(REPORTING_EXCEPTION, Boolean.TRUE); try { Object trace = recursiveInvocation ? null : getPsiInvalidationTrace(element); myMessage = getMessageWithReason(element, message, recursiveInvocation, trace); myDiagnostic = createAttachments(trace); } finally { element.putUserData(REPORTING_EXCEPTION, null); } } }
Example 2
Source File: ElementTypeAsPsiFactory.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public PsiElement createElement(@Nonnull ASTNode astNode) { if (myConstructor == null) { return PsiUtilCore.NULL_PSI_ELEMENT; } return ReflectionUtil.createInstance(myConstructor, astNode); }
Example 3
Source File: PsiInvalidElementAccessException.java From consulo with Apache License 2.0 | 4 votes |
@NonNls @Nonnull private static String reason(@Nonnull PsiElement root) { if (root == PsiUtilCore.NULL_PSI_ELEMENT) return "NULL_PSI_ELEMENT"; PsiElement element = root instanceof PsiFile ? root : root.getParent(); if (element == null) { String m = "parent is null"; if (root instanceof StubBasedPsiElement) { StubElement stub = ((StubBasedPsiElement)root).getStub(); while (stub != null) { m += "\n each stub=" + stub; if (stub instanceof PsiFileStub) { m += "; fileStub.psi=" + stub.getPsi() + "; reason=" + ((PsiFileStub)stub).getInvalidationReason(); } stub = stub.getParentStub(); } } return m; } while (element != null && !(element instanceof PsiFile)) element = element.getParent(); PsiFile file = (PsiFile)element; if (file == null) return "containing file is null"; FileViewProvider provider = file.getViewProvider(); VirtualFile vFile = provider.getVirtualFile(); if (!vFile.isValid()) return vFile + " is invalid"; if (!provider.isPhysical()) { PsiElement context = file.getContext(); if (context != null && !context.isValid()) { return "invalid context: " + reason(context); } } PsiManager manager = file.getManager(); if (manager.getProject().isDisposed()) return "project is disposed"; Language language = file.getLanguage(); if (language != provider.getBaseLanguage()) return "File language:" + language + " != Provider base language:" + provider.getBaseLanguage(); FileViewProvider p = manager.findViewProvider(vFile); if (provider != p) return "different providers: " + provider + "(" + id(provider) + "); " + p + "(" + id(p) + ")"; if (!provider.isPhysical()) return "non-physical provider: " + provider; // "dummy" file? return "psi is outdated"; }
Example 4
Source File: PlainTextParserDefinition.java From consulo with Apache License 2.0 | 4 votes |
@RequiredReadAction @Override @Nonnull public PsiElement createElement(@Nonnull ASTNode node) { return PsiUtilCore.NULL_PSI_ELEMENT; }
Example 5
Source File: FindUsagesHandler.java From consulo with Apache License 2.0 | 4 votes |
private NullFindUsagesHandler() { super(PsiUtilCore.NULL_PSI_ELEMENT); }