boolean () { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); PsiElement element = myRef.getElement(); if (element == null || !element.isValid()){ return false; } for (T targetMethod : myCandidates) { if (!targetMethod.isValid()) { return false; } } if (myCandidates.size() == 1){ doImport(myCandidates.get(0)); } else{ chooseAndImport(myEditor, myProject); } return true; }