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.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall; 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.lang.types.JetType;
import org.jetbrains.jet.plugin.JetBundle; import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.caches.resolve.KotlinCacheManagerUtil; import org.jetbrains.jet.plugin.caches.resolve.KotlinCacheManagerUtil;
@@ -48,7 +49,11 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
@NotNull @NotNull
@Override @Override
public String getText() { 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 @NotNull
@@ -1,4 +1,4 @@
// "Change 'x' type to '(String) -> Int'" "true" // "Change 'B.x' type to '(String) -> Int'" "true"
trait A { trait A {
var x: (String) -> Int var x: (String) -> Int
} }
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true" // "Change 'A.x' type to 'Int'" "true"
trait X { trait X {
val x: Int val x: Int
} }
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true" // "Change 'B.x' type to 'Int'" "true"
abstract class A { abstract class A {
abstract var x : Int 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 class A {
abstract var x : Int 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 { trait A {
var x: (String) -> Int var x: (String) -> Int
} }
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true" // "Change 'A.x' type to 'Int'" "true"
trait X { trait X {
val x: Int val x: Int
} }
@@ -1,4 +1,4 @@
// "Change 'x' type to 'Int'" "true" // "Change 'B.x' type to 'Int'" "true"
abstract class A { abstract class A {
abstract var x : Int 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 class A {
abstract var x : Int abstract var x : Int
} }