IDEA-67217 Introduce parameter should specify its type explicitly by default

This commit is contained in:
Maxim Medvedev
2011-03-31 16:01:41 +04:00
parent 5d08e663ec
commit 1cc41176eb
2 changed files with 8 additions and 1 deletions
@@ -180,7 +180,7 @@ public class GrIntroduceParameterDialog extends RefactoringDialog implements GrI
}
private void createUIComponents() {
myTypeComboBox = new GrTypeComboBox(myContext.var != null ? myContext.var.getDeclaredType() : myContext.expression.getType());
myTypeComboBox = new GrTypeComboBox(myContext.var != null ? myContext.var.getDeclaredType() : myContext.expression.getType(), true);
String[] possibleNames = GroovyNameSuggestionUtil.suggestVariableNames(myContext.expression, new GroovyFieldValidator(myContext), true);
if (myContext.var != null) {
@@ -29,9 +29,16 @@ public class GrTypeComboBox extends JComboBox {
private final PsiType myType;
public GrTypeComboBox(PsiType type) {
this(type, false);
}
public GrTypeComboBox(PsiType type, boolean selectType) {
super();
myType = type;
initialize();
if (selectType && getItemCount() > 1) {
setSelectedIndex(1);
}
}
private void initialize() {