mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-74933 Groovy: Introduce Closure Parameter with "Delegate via overloading" and "Remove parameter" options doesn't remove parameter no longer used
This commit is contained in:
+4
-2
@@ -485,8 +485,10 @@ public class GrIntroduceClosureParameterProcessor extends BaseRefactoringProcess
|
||||
call.append(newName).append('(');
|
||||
|
||||
final GrParameter[] parameters = result.getParameters();
|
||||
for (GrParameter parameter : parameters) {
|
||||
call.append(parameter.getName()).append(", ");
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
if (!mySettings.parametersToRemove().contains(i)) {
|
||||
call.append(parameters[i].getName()).append(", ");
|
||||
}
|
||||
}
|
||||
call.append(myParameterInitializer.getText());
|
||||
call.append(")");
|
||||
|
||||
+2
-1
@@ -99,6 +99,7 @@ public class GrIntroduceParameterDialog extends RefactoringDialog implements GrI
|
||||
myDeclareFinalCheckBox.setSelected(hasFinalModifier());
|
||||
|
||||
myChangeVarUsages.setVisible(context.toReplaceIn instanceof GrClosableBlock && context.toSearchFor instanceof GrVariable);
|
||||
myChangeVarUsages.setSelected(true);
|
||||
|
||||
setTitle(RefactoringBundle.message("introduce.parameter.title"));
|
||||
init();
|
||||
@@ -176,7 +177,7 @@ public class GrIntroduceParameterDialog extends RefactoringDialog implements GrI
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setLine(3);
|
||||
final GridBag c = new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setLine(4);
|
||||
for (Object o : toRemoveCBs.keys()) {
|
||||
c.nextLine();
|
||||
myCheckBoxContainer.add(((JCheckBox)o), c);
|
||||
|
||||
+4
@@ -92,4 +92,8 @@ public class GrIntroduceParameterInClosureTest extends LightCodeInsightFixtureTe
|
||||
public void testCorrectOccurrencesForLocalVar() {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, null, false);
|
||||
}
|
||||
|
||||
public void testDelegateRemoveUnusedParam() {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
def clos = { int i ->
|
||||
println <selection>"test"</selection>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
def closDelegate = { String anObject ->
|
||||
println anObject
|
||||
}
|
||||
def clos = {int i ->
|
||||
closDelegate("test")
|
||||
}
|
||||
Reference in New Issue
Block a user