Java 类com.intellij.psi.impl.source.tree.LazyParseableElement 实例源码

项目:consulo-xml    文件:XmlASTLazyFactory.java   
@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;
}
项目:intellij-ce-playground    文件:MiscPsiTest.java   
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());
}
项目:intellij-ce-playground    文件:ASTFactory.java   
@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);
}
项目:tools-idea    文件:MiscPsiTest.java   
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());
}
项目:intellij-ce-playground    文件:ASTFactory.java   
@Nullable
public LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text) {
  return null;
}
项目:intellij-haxe    文件:HaxeAstFactory.java   
@Nullable
@Override
public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) {
  return super.createLazy(type, text);
}
项目:consulo    文件:ASTLazyFactory.java   
@Nonnull
LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text);
项目:consulo    文件:ASTFactory.java   
@Nonnull
public static LazyParseableElement lazy(@Nonnull final ILazyParseableElementType type, final CharSequence text) {
  return ASTLazyFactory.EP.getValue(type).createLazy(type, text);
}