EditorTextField (Project project, boolean isClassAccepted, JavaCodeFragment.VisibilityChecker visibilityChecker, FileType fileType) { if (project.isDefault()) { return new EditorTextField(); } else { PsiElement defaultPackage = JavaPsiFacade.getInstance(project).findPackage(""); JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project); JavaCodeFragment fragment = factory.createReferenceCodeFragment("", defaultPackage, true, isClassAccepted); fragment.setVisibilityChecker(visibilityChecker); Document document = PsiDocumentManager.getInstance(project).getDocument(fragment); return new EditorTextField(document, project, fileType); } }