@NotNull public static LazyParseableElement lazy(@NotNull final ILazyParseableElementType type, CharSequence text) { final ASTNode node = type.createNode(text); if (node != null) return (LazyParseableElement)node; if (type == TokenType.CODE_FRAGMENT) { return new CodeFragmentElement(null); } else if (type == TokenType.DUMMY_HOLDER) { return new DummyHolderElement(text); } final LazyParseableElement customLazy = factory(type).createLazy(type, text); return customLazy != null ? customLazy : DefaultFactoryHolder.DEFAULT.createLazy(type, text); }
private boolean isNonPhysicalOrInjected() { FileElement fileElement = TreeUtil.getFileElement(this); if (fileElement == null || fileElement instanceof DummyHolderElement) return true; if (fileElement.getTreeParent() != null) return true; // dummy holder PsiElement wrapper = this instanceof PsiElement ? (PsiElement)this : myWrapper; if (wrapper == null) return true; PsiFile psiFile = wrapper.getContainingFile(); return psiFile == null || psiFile instanceof DummyHolder || psiFile.getViewProvider() instanceof FreeThreadedFileViewProvider || !psiFile.isPhysical(); }
@NotNull public static LazyParseableElement lazy(@NotNull final ILazyParseableElementType type, final CharSequence text) { final ASTNode node = type.createNode(text); if (node != null) return (LazyParseableElement)node; if (type == TokenType.CODE_FRAGMENT) { return new CodeFragmentElement(null); } else if (type == TokenType.DUMMY_HOLDER) { return new DummyHolderElement(text); } final LazyParseableElement customLazy = factory(type).createLazy(type, text); return customLazy != null ? customLazy : DefaultFactoryHolder.DEFAULT.createLazy(type, text); }