TreeElement (final Project project, final String text, boolean mark) { final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(project).getParserFacade(); final TreeElement element = (TreeElement)parserFacade.createReferenceFromText(text, null).getNode(); if (mark) element.acceptTree(new GeneratedMarkerVisitor()); return element; }