restore varargs combo on fold/unfold parameters
authorAnna Kozlova <Anna.Kozlova@jetbrains.com>
Thu, 17 Sep 2009 11:37:46 +0000 (15:37 +0400)
committerAnna Kozlova <Anna.Kozlova@jetbrains.com>
Thu, 17 Sep 2009 11:37:46 +0000 (15:37 +0400)
java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java

index 2d2533f7cb1e9b8857d74909c12b8d915b4e1d1c..4d034cfd961b465b0c1332f7ffa9b8866904c889 100644 (file)
@@ -81,6 +81,10 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
       canBeVarargs |= data.type instanceof PsiArrayType;
     }
     myVariableData = inputVariables;
+    
+    if (inputVariables.isFoldable()) {
+      canBeVarargs |= inputVariables.isFoldingSelectedByDefault();
+    }
 
     setTitle(title);
     myHelpId = helpId;
@@ -207,6 +211,7 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
       public void actionPerformed(ActionEvent e) {
         myVariableData.setFoldingAvailable(myFoldCb.isSelected());
         myInputVariables = myVariableData.getInputVariables().toArray(new ParameterTablePanel.VariableData[myVariableData.getInputVariables().size()]);
+        updateVarargsEnabled();
         createParametersPanel();
         updateSignature();
       }
index 46c784a2597ca80c864dc3cc843bbeca54d65678..43122b30f870c472f0902af0e86a71614f987f3b 100644 (file)
@@ -84,6 +84,7 @@ public class ExtractMethodObjectDialog extends AbstractExtractDialog {
     for (ParameterTablePanel.VariableData data : inputVariables.getInputVariables()) {
       canBeVarargs |= data.type instanceof PsiArrayType;
     }
+    canBeVarargs |= inputVariables.isFoldable()  && inputVariables.isFoldingSelectedByDefault();
     myWasStatic = canBeVarargs;
 
     myVariableData = inputVariables;
@@ -216,6 +217,7 @@ public class ExtractMethodObjectDialog extends AbstractExtractDialog {
         myParametersTableContainer.removeAll();
         myParametersTableContainer.add(createParametersPanel(), BorderLayout.CENTER);
         updateSignature();
+        updateVarargsEnabled();
       }
     });
     myParametersTableContainer.add(createParametersPanel(), BorderLayout.CENTER);