boolean () { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); if (!myReference.getElement().isValid()) { return false; } for (PsiClass myTargetClass : myTargetClasses) { if (!myTargetClass.isValid()) { return false; } } if (myTargetClasses.length == 1) { addImport(myReference, myTargetClasses[0]); } else { chooseClassAndImport(); } return true; }