extend quickfix name (IDEA-107356)

This commit is contained in:
anna
2013-05-17 17:36:20 +02:00
parent 0be8996fce
commit 5fc3b0598a
49 changed files with 55 additions and 47 deletions
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.usageView.UsageViewUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -48,7 +49,7 @@ public class VariableArrayTypeFix extends LocalQuickFixAndIntentionActionOnPsiEl
PsiVariable myVariable = getVariableLocal(arrayInitializer);
myName = myVariable == null ? null : myTargetType.equals(myVariable.getType()) && myNewExpression != null ?
QuickFixBundle.message("change.new.operator.type.text", getNewText(myNewExpression,arrayInitializer), myTargetType.getCanonicalText(), "") :
QuickFixBundle.message("fix.variable.type.text", myVariable.getName(), myTargetType.getCanonicalText());
QuickFixBundle.message("fix.variable.type.text", UsageViewUtil.getType(myVariable), myVariable.getName(), myTargetType.getCanonicalText());
myFamilyName = myVariable == null ? null : myTargetType.equals(myVariable.getType()) && myNewExpression != null ?
QuickFixBundle.message("change.new.operator.type.family") :
QuickFixBundle.message("fix.variable.type.family");
@@ -24,6 +24,7 @@ import com.intellij.openapi.command.undo.UndoUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.util.TypeConversionUtil;
@@ -31,6 +32,8 @@ import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
import com.intellij.refactoring.changeSignature.JavaChangeSignatureDialog;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.util.RefactoringUIUtil;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -53,6 +56,7 @@ public class VariableTypeFix extends LocalQuickFixAndIntentionActionOnPsiElement
@Override
public String getText() {
return QuickFixBundle.message("fix.variable.type.text",
UsageViewUtil.getType(getStartElement()),
myName,
getReturnType().getCanonicalText());
}
@@ -33,6 +33,8 @@ import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.typeMigration.TypeMigrationLabeler;
import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
import com.intellij.refactoring.typeMigration.TypeMigrationRules;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.usages.impl.UsageViewImpl;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -49,6 +51,7 @@ public class VariableTypeFromCallFix implements IntentionAction {
@NotNull
public String getText() {
return QuickFixBundle.message("fix.variable.type.text",
UsageViewUtil.getType(myVar),
myVar.getName(),
myExpressionType.getCanonicalText());
}
@@ -1,4 +1,4 @@
// "Change 'list' type to 'List<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'List<java.lang.Integer>'" "true"
public class Test {
void foo() {
List<Integer> list = new List<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.String,java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.String,java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<String, Integer> list = new Lost<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<Integer> list = new Lost<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'List<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'List<java.lang.Integer>'" "true"
public class Test {
void foo() {
List<Integer> list = new List<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<Integer> list = new Lost<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<Integer> list = new Lost<>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'List<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'List<java.lang.Integer>'" "true"
public class Test {
void foo() {
List<String> list = new List<String>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.String,java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.String,java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<String, String> list = new Lost<String, String>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<String> list = new Lost<String>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'List<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'List<java.lang.Integer>'" "true"
public class Test {
void foo() {
List<String> list = new List<String>();
@@ -1,4 +1,4 @@
// "Change 'var' type to 'Foo" "false"
// "Change variable 'var' type to 'Foo" "false"
public class Test {
void foo() {
final Foo var = new Foo();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<String> list = new Lost<String>();
@@ -1,4 +1,4 @@
// "Change 'list' type to 'Lost<java.lang.Integer>'" "true"
// "Change variable 'list' type to 'Lost<java.lang.Integer>'" "true"
public class Test {
void foo() {
Lost<String> list = new Lost<String>();
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
final int[][] test = {new int<caret>[]{1}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
int[][] test = new int[][]{<caret>{1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
int[][] test = new int[][]{<caret>{1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
int[][] test = new int[][]{{<caret>1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[]'" "true"
// "Change variable 'test' type to 'char[]'" "true"
class A {
void m() {
final char[] test = new char[]{<caret>'a'};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[]'" "true"
// "Change variable 'test' type to 'char[]'" "true"
class A {
void m() {
final char[] test = {<caret>'a'};
@@ -1,4 +1,4 @@
// "Change 'myArr' type to 'char[][]'" "true"
// "Change field 'myArr' type to 'char[][]'" "true"
class A extends B {
void m() {
myArr = new char[][]{{<caret>'a'}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
final Long[][] test = {new int<caret>[]{1}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
Long[][][] test = new Long[]{<caret>{1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
Long[] test = new Long[]{<caret>{1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'int[][]'" "true"
// "Change variable 'test' type to 'int[][]'" "true"
class A {
void m() {
Long test = new Long[][][][]{{<caret>1}, {2}};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[]'" "true"
// "Change variable 'test' type to 'char[]'" "true"
class A {
void m() {
final Long[] test = new Long[]{<caret>'a'};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[]'" "true"
// "Change variable 'test' type to 'char[]'" "true"
class A {
void m() {
final Long[] test = {<caret>'a'};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[]'" "false"
// "Change variable 'test' type to 'char[]'" "false"
class A {
void m() {
final Long[] test = {<caret>'a', 1};
@@ -1,4 +1,4 @@
// "Change 'test' type to 'char[][]'" "false"
// "Change variable 'test' type to 'char[][]'" "false"
class A {
void m() {
final Long[] test = {<caret>{'a'}, {1}};
@@ -1,4 +1,4 @@
// "Change 'myArr' type to 'char[][]'" "true"
// "Change field 'myArr' type to 'char[][]'" "true"
class A extends B {
void m() {
myArr = new String[][]{{<caret>'a'}};
@@ -1,4 +1,4 @@
// "Change 'i' type to 'a.i.ii<java.lang.String>'" "true"
// "Change variable 'i' type to 'a.i.ii<java.lang.String>'" "true"
class a
{
class i {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'a.i.ii<java.lang.String>'" "true"
// "Change variable 'i' type to 'a.i.ii<java.lang.String>'" "true"
class a
{
class i {
@@ -1,4 +1,4 @@
// "Change 's' type to 'O.f<java.lang.String>'" "false"
// "Change variable 's' type to 'O.f<java.lang.String>'" "false"
class O {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'double'" "true"
// "Change variable 'i' type to 'double'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change variable 'i' type to 'java.lang.String'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'char'" "true"
// "Change variable 'i' type to 'char'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 's' type to 'java.lang.Runnable'" "true"
// "Change field 's' type to 'java.lang.Runnable'" "true"
class a {
Runnable s = new Runnable() {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change parameter 'i' type to 'java.lang.String'" "true"
class Base {
void foo(String i) {}
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change parameter 'i' type to 'java.lang.String'" "true"
class Ex{
void foo(String i) {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'double'" "true"
// "Change variable 'i' type to 'double'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change variable 'i' type to 'java.lang.String'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'char'" "true"
// "Change variable 'i' type to 'char'" "true"
import java.io.*;
class a {
@@ -1,4 +1,4 @@
// "Change 's' type to 'java.lang.Runnable'" "true"
// "Change field 's' type to 'java.lang.Runnable'" "true"
class a {
String s = <caret>new Runnable() {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change parameter 'i' type to 'java.lang.String'" "true"
class Base {
void foo(int i) {}
@@ -1,4 +1,4 @@
// "Change 'i' type to 'java.lang.String'" "true"
// "Change parameter 'i' type to 'java.lang.String'" "true"
class Ex{
void foo(int i) {
@@ -1,4 +1,4 @@
// "Change 'i' type to 'long'" "false"
// "Change parameter 'i' type to 'long'" "false"
class M extends Thread {
@Override
@@ -174,7 +174,7 @@ make.final.text=Make {0} final
make.final.copy.to.temp=Copy ''{0}'' to temp final variable
make.final.transform.to.one.element.array=Transform {0} into final one element array
fix.variable.type.family=Fix Variable Type
fix.variable.type.text=Change ''{0}'' type to ''{1}''
fix.variable.type.text=Change {0} ''{1}'' type to ''{2}''
# Sample: Boolean b = "true"; -> Boolean b = Boolean.valueOf("true");
wrap.expression.using.static.accessor.family=Wrap Expression