void (final String className) { final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(myProject); PsiPackage defaultPackage = JavaPsiFacade.getInstance(myProject).findPackage(""); final PsiCodeFragment fragment = factory.createReferenceCodeFragment(className, defaultPackage, true, true); myDocument = PsiDocumentManager.getInstance(myProject).getDocument(fragment); myEditorTextField.setDocument(myDocument); updateOKAction(); }