Better text for ChangeVariableTypeFix

This commit is contained in:
Wojciech Lopata
2013-05-15 20:25:34 +02:00
parent 1a5d515972
commit 0d65a1b789
9 changed files with 14 additions and 9 deletions
@@ -30,6 +30,7 @@ import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.caches.resolve.KotlinCacheManagerUtil;
@@ -48,7 +49,11 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
@NotNull
@Override
public String getText() {
return JetBundle.message("change.element.type", element.getName(), renderedType);
String propertyName = element.getName();
FqName fqName = JetPsiUtil.getFQName(element);
if (fqName != null) propertyName = fqName.asString();
return JetBundle.message("change.element.type", propertyName, renderedType);
}
@NotNull
@@ -1,4 +1,4 @@
// "Change 'x' type to '(String) -> Int'" "true"
// "Change 'B.x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'A.x' type to 'Int'" "true"
trait X {
val x: Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to '(String) -> Int'" "true"
// "Change 'B.x' type to '(String) -> Int'" "true"
trait A {
var x: (String) -> Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'A.x' type to 'Int'" "true"
trait X {
val x: Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true"
// "Change 'B.x' type to 'Int'" "true"
abstract class A {
abstract var x : Int
}