NPE
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 12 May 2011 09:31:29 +0000 (13:31 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 12 May 2011 09:31:29 +0000 (13:31 +0400)
(cherry picked from commit 0368e329d4ca1041a43fd07cd168a7e234b7e8f0)

java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java

index a5a116df7c1228d16fcff2d7d7fb70d4a18ee97c..2bc3a08d026cd588ddc71506bc195333470f7706 100644 (file)
@@ -257,12 +257,14 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
     protected JComponent getComponent() {
       if (!myInitialized) {
         myInitialized = true;
-        myWholePanel.add(myCanBeFinalCb,
-                         new GridBagConstraints(0, myCbReplaceAllOccurences == null ? 2 : 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST,
-                                                GridBagConstraints.NONE, new Insets(0, 5, 2, 5), 0, 0));
-        if (myHasWriteAccess) {
-          myCanBeFinalCb.setSelected(false);
-          myCanBeFinalCb.setEnabled(false);
+        if (myCanBeFinalCb != null) {
+          myWholePanel.add(myCanBeFinalCb,
+                           new GridBagConstraints(0, myCbReplaceAllOccurences == null ? 2 : 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST,
+                                                  GridBagConstraints.NONE, new Insets(0, 5, 2, 5), 0, 0));
+          if (myHasWriteAccess) {
+            myCanBeFinalCb.setSelected(false);
+            myCanBeFinalCb.setEnabled(false);
+          }
         }
       }
       return myWholePanel;
@@ -298,7 +300,7 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
     protected void saveSettings(PsiVariable psiVariable) {
       final JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();
       InplaceIntroduceParameterPopup.super.saveSettings(settings);
-      if (myCanBeFinalCb.isEnabled()) {
+      if (myCanBeFinalCb != null && myCanBeFinalCb.isEnabled()) {
         settings.INTRODUCE_PARAMETER_CREATE_FINALS = psiVariable.hasModifierProperty(PsiModifier.FINAL);
       }
       TypeSelectorManagerImpl.typeSelected(psiVariable.getType(), myDefaultParameterTypePointer.getType());