Document (CharSequence text, Project project) { if (project == null) { return super.createDocument(text, null); } final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project); final JavaCodeFragment fragment = factory.createCodeBlockCodeFragment((String)text, psiFacade.findPackage(""), true); DaemonCodeAnalyzer.getInstance(project).setHighlightingEnabled(fragment, false); return PsiDocumentManager.getInstance(project).getDocument(fragment); }