boolean () { PyPsiUtils.assertValid(myTarget); if ((myTarget instanceof PyQualifiedExpression) && ((((PyQualifiedExpression)myTarget).isQualified()))) { return false; // we cannot be qualified } for (ImportCandidateHolder item : mySources) { PyPsiUtils.assertValid(item.getImportable()); PyPsiUtils.assertValid(item.getFile()); final PyImportElement element = item.getImportElement(); if (element != null) { PyPsiUtils.assertValid(element); } } if (mySources.isEmpty()) { return false; } // act if (insideIntentionPreview()) { ImportCandidateHolder item = mySources.get(0); if (item.getImportable() == null) { return false; } doIt(item); } else if (mySources.size() == 1) { doWriteAction(mySources.get(0)); } else { selectSourceAndDo(); } return true; }