@NotNull @Override public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) { if (type == XML_FILE) { return new XmlFileElement(type, text); } else if (type == DTD_FILE) { return new XmlFileElement(type, text); } else if (type == XHTML_FILE) { return new XmlFileElement(type, text); } else if (type == HTML_FILE) { return new HtmlFileElement(text); } else if (type instanceof TemplateDataElementType) { return new XmlFileElement(type, text); } return null; }
public void testDoNotExpandNestedChameleons() throws Exception { PsiJavaFile file = (PsiJavaFile)myFixture.addFileToProject("a.java", "class A {{{}}}"); file.getNode(); PsiCodeBlock initializer = file.getClasses()[0].getInitializers()[0].getBody(); assertFalse(assertInstanceOf(initializer.getNode(), LazyParseableElement.class).isParsed()); PsiCodeBlock nestedBlock = ((PsiBlockStatement)initializer.getStatements()[0]).getCodeBlock(); assertTrue(assertInstanceOf(initializer.getNode(), LazyParseableElement.class).isParsed()); assertFalse(assertInstanceOf(nestedBlock.getNode(), LazyParseableElement.class).isParsed()); }
@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); }
@Nullable public LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text) { return null; }
@Nullable @Override public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) { return super.createLazy(type, text); }
@Nonnull LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text);
@Nonnull public static LazyParseableElement lazy(@Nonnull final ILazyParseableElementType type, final CharSequence text) { return ASTLazyFactory.EP.getValue(type).createLazy(type, text); }