void () { myEditorTextField1 = new EditorTextField("", myProject, JavaFileType.INSTANCE); final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(myProject); PsiPackage defaultPackage = JavaPsiFacade.getInstance(myProject).findPackage(""); final PsiCodeFragment fragment = factory.createReferenceCodeFragment("", defaultPackage, true, true); myEditorTextField1.setDocument(PsiDocumentManager.getInstance(myProject).getDocument(fragment)); }