PsiType () { final Document document = myClassField.getEditorTextField().getDocument(); final PsiDocumentManager dm = PsiDocumentManager.getInstance(myProject); dm.commitDocument(document); final PsiFile psiFile = dm.getPsiFile(document); if (psiFile == null) return null; try { return ((PsiTypeCodeFragment)psiFile).getType(); } catch (PsiTypeCodeFragment.TypeSyntaxException | PsiTypeCodeFragment.NoTypeException e1) { return null; } }