Merge pull request #433 from kuity/ReplaceInfixCallFix

Bug Fix for KT-4652 Replace with Infix Call
This commit is contained in:
Pavel Talanov
2014-04-21 04:44:44 -07:00
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) {