Bug Fix for KT-4652 Replace with Infix Call

This commit is contained in:
Lingzhang
2014-04-03 15:57:56 -04:00
parent d28ca5bdfa
commit 6feee57d5e
6 changed files with 43 additions and 0 deletions
@@ -34,6 +34,20 @@ import org.jetbrains.jet.lang.psi.JetFile
public class ReplaceWithInfixFunctionCallIntention : JetSelfTargetingIntention<JetCallExpression>("replace.with.infix.function.call.intention", javaClass()) {
override fun isApplicableTo(element: JetCallExpression): Boolean {
throw IllegalStateException("isApplicableTo(JetExpressionImpl, Editor) should be called instead")
}
override fun isApplicableTo(element: JetCallExpression, editor: Editor): Boolean {
val caretLocation = editor.getCaretModel().getOffset()
val calleeExpr = element.getCalleeExpression()
if (calleeExpr == null) return false
val textRange = calleeExpr.getTextRange()
if (textRange == null) return false
if (caretLocation !in textRange) return false
val parent = element.getParent()
if (parent is JetDotQualifiedExpression) {