boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!(file instanceof PyFile)) { return false; } PyStringElement stringElement = findConvertibleStringElementUnderCaret(editor, file); if (stringElement == null) return false; PyStringLiteralExpression stringLiteral = as(stringElement.getParent(), PyStringLiteralExpression.class); if (stringLiteral == null) return false; final PyDocStringOwner docStringOwner = PsiTreeUtil.getParentOfType(stringLiteral, PyDocStringOwner.class); if (docStringOwner != null && docStringOwner.getDocStringExpression() == stringLiteral) return false; String currentQuote = stringElement.getQuote(); if (currentQuote.equals("'")) { setText(PyPsiBundle.message("INTN.quoted.string.single.to.double")); } else { setText(PyPsiBundle.message("INTN.quoted.string.double.to.single")); } return true; }