removing empty changelists
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Mon, 15 Mar 2010 11:56:03 +0000 (14:56 +0300)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Mon, 15 Mar 2010 11:56:03 +0000 (14:56 +0300)
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java
platform/vcs-api/src/com/intellij/openapi/vcs/VcsShowConfirmationOption.java
platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListListener.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsConfirmationDialog.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.form
platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java

index a70d4b8ab392df24c6a693b7ded64e3df9a041c3..84fdb70b15815e87f3d9038438a3d8993ec66445 100644 (file)
@@ -42,10 +42,8 @@ import java.awt.*;
 import java.awt.event.*;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.*;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.regex.Pattern;
@@ -1064,5 +1062,28 @@ public class UIUtil {
     return g instanceof PrintGraphics;
   }
 
+  public static int getSelectedButton(ButtonGroup group) {
+    Enumeration<AbstractButton> enumeration = group.getElements();
+    int i = 0;
+    while (enumeration.hasMoreElements()) {
+      AbstractButton button = enumeration.nextElement();
+      if (group.isSelected(button.getModel())) {
+        return i;
+      }
+      i++;
+    }
+    return -1;
+  }
+
+  public static void setSelectedButton(ButtonGroup group, int index) {
+    Enumeration<AbstractButton> enumeration = group.getElements();
+    int i = 0;
+    while (enumeration.hasMoreElements()) {
+      AbstractButton button = enumeration.nextElement();
+      group.setSelected(button.getModel(), index == i);
+      i++;
+    }
+  }
+
 }
 
index 63159e43c35c61282498ca98436b5a0921579977..59dc044c95c547dbb930f85c2e80a08f2d1f8e46 100644 (file)
@@ -63,6 +63,7 @@ public final class VcsConfiguration implements PersistentStateComponent<Element>
   public boolean PERFORM_ROLLBACK_IN_BACKGROUND = false;
   public volatile boolean CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND = false;
   public VcsShowConfirmationOption.Value MOVE_TO_FAILED_COMMIT_CHANGELIST = VcsShowConfirmationOption.Value.SHOW_CONFIRMATION;
+  public VcsShowConfirmationOption.Value REMOVE_EMPTY_INACTIVE_CHANGELISTS = VcsShowConfirmationOption.Value.SHOW_CONFIRMATION;
   public boolean ENABLE_BACKGROUND_PROCESSES = false;
   public int CHANGED_ON_SERVER_INTERVAL = 60;
 
index 4c43ad78a904b492a09c2bf7e156019ed67de93b..d077e7621ee482488f83e84894b6a5a13e131d89 100644 (file)
@@ -27,7 +27,10 @@ public interface VcsShowConfirmationOption {
       myId = id;
     }
 
-
+    public int getId() {
+      return myId;
+    }
+    
     public String toString() {
       return String.valueOf(myId);
     }
index 3c5398f44f580b40025084068aec37ef133f9557..3d30fcc55261210ec31eb8b47357b5503a79ea1b 100644 (file)
@@ -21,6 +21,9 @@ import java.util.Collection;
 
 /**
  * @author max
+ *
+ * @see com.intellij.openapi.vcs.changes.ChangeListManager#addChangeListListener(ChangeListListener)
+ * @see com.intellij.openapi.vcs.changes.ChangeListManager#removeChangeListListener(ChangeListListener)  
  */
 public interface ChangeListListener extends EventListener {
   void changeListAdded(ChangeList list);
index 6a201f6dda929553c617d49c0daa33bdf74a4179..e94ded8095e986dd03d122b15698f498f6a0fff3 100644 (file)
@@ -107,7 +107,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
     return (ChangeListManagerImpl) project.getComponent(ChangeListManager.class);
   }
 
-  public ChangeListManagerImpl(final Project project) {
+  public ChangeListManagerImpl(Project project, final VcsConfiguration config) {
     myProject = project;
     myChangesViewManager = ChangesViewManager.getInstance(myProject);
     myFileStatusManager = FileStatusManager.getInstance(myProject);
@@ -120,6 +120,44 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
     myModifier = new Modifier(myWorker, myDelayedNotificator);
 
     myConflictTracker = new ChangelistConflictTracker(project, this, myFileStatusManager, EditorNotifications.getInstance(project));
+
+    myListeners.addListener(new ChangeListAdapter() {
+      @Override
+      public void defaultListChanged(final ChangeList oldDefaultList, ChangeList newDefaultList) {
+        if (oldDefaultList instanceof LocalChangeList &&
+          oldDefaultList.getChanges().isEmpty()) {
+
+          SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+              switch (config.REMOVE_EMPTY_INACTIVE_CHANGELISTS) {
+
+                case SHOW_CONFIRMATION:
+                  VcsConfirmationDialog dialog = new VcsConfirmationDialog(myProject, new VcsShowConfirmationOption() {
+                    public Value getValue() {
+                      return config.REMOVE_EMPTY_INACTIVE_CHANGELISTS;
+                    }
+
+                    public void setValue(Value value) {
+                      config.REMOVE_EMPTY_INACTIVE_CHANGELISTS = value;
+                    }
+                  }, "<html>The empty changelist is no longer active.<br>" +
+                     "Do you want to remove it?</html>", "Remember my choice");
+                  dialog.show();
+                  if (!dialog.isOK()) {
+                    return;
+                  }
+                  break;
+                case DO_NOTHING_SILENTLY:
+                  return;
+                case DO_ACTION_SILENTLY:
+                  break;
+              }
+              removeChangeList((LocalChangeList)oldDefaultList);
+            }
+          });
+        }
+      }
+    });
   }
 
   public void projectOpened() {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsConfirmationDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsConfirmationDialog.java
new file mode 100644 (file)
index 0000000..def7696
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.vcs.changes;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.vcs.VcsShowConfirmationOption;
+import com.intellij.util.ui.OptionsDialog;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class VcsConfirmationDialog extends OptionsDialog {
+
+  private final VcsShowConfirmationOption myOption;
+  private final String myMessage;
+  private final String myDoNotShowMessage;
+
+  protected VcsConfirmationDialog(Project project, VcsShowConfirmationOption option, String message, String doNotShowMessage) {
+    super(project);
+    myOption = option;
+    myMessage = message;
+    myDoNotShowMessage = doNotShowMessage;
+
+    init();
+  }
+
+  @Override
+  protected boolean isToBeShown() {
+    return myOption.getValue() == VcsShowConfirmationOption.Value.SHOW_CONFIRMATION;
+  }
+
+  @Override
+  protected void setToBeShown(boolean value, boolean onOk) {
+    myOption.setValue(value ? VcsShowConfirmationOption.Value.SHOW_CONFIRMATION : onOk ? VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY : VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY);
+  }
+
+  @Override
+  protected boolean shouldSaveOptionsOnCancel() {
+    return true;
+  }
+
+  @Override
+  protected JComponent createCenterPanel() {
+    JPanel panel = new JPanel(new BorderLayout());
+    panel.add(new JLabel(myMessage));
+    panel.add(new JLabel(Messages.getQuestionIcon()));
+    return panel;
+  }
+
+  @Override
+  protected String getDoNotShowMessage() {
+    return myDoNotShowMessage;
+  }
+
+  @Override
+  protected Action[] createActions() {
+    return new Action[] {
+      new AbstractAction("Yes") {
+        public void actionPerformed(ActionEvent e) {
+          doOKAction();
+        }
+    }, new AbstractAction("No") {
+        public void actionPerformed(ActionEvent e) {
+          doCancelAction();
+        }
+      }};
+  }
+}
index 21e3f625ca9fad25c66d5edd999921cf4b906a27..6167748fc95ac724f82ac24d159819a95fc852c9 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.vcs.configurable.VcsGeneralConfigurationPanel">
-  <grid id="7e224" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="7e224" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
       <xy x="7" y="16" width="868" height="558"/>
@@ -8,24 +8,15 @@
     <properties/>
     <border type="none"/>
     <children>
-      <grid id="ec55" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children/>
-      </grid>
       <vspacer id="5b902">
         <constraints>
-          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
         </constraints>
       </vspacer>
       <grid id="e714c" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
         <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
-          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
         <border type="none"/>
           </grid>
         </children>
       </grid>
-      <grid id="a5aa5" binding="myPromptsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+      <grid id="4ec1c" binding="myAddConfirmationPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
         <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
-          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
-            <minimum-size width="300" height="-1"/>
-          </grid>
-        </constraints>
-        <properties/>
-        <border type="etched" title-resource-bundle="messages/VcsBundle" title-key="border.display.dialog.when.commands.invoked"/>
-        <children/>
-      </grid>
-      <hspacer id="308c6">
-        <constraints>
-          <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-        </constraints>
-      </hspacer>
-      <grid id="8145c" binding="myRemoveConfirmationPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
-        <border type="etched" title="Files Deletion"/>
+        <border type="etched" title="When files are created"/>
         <children>
-          <component id="ca721" class="javax.swing.JLabel" binding="myRemoveConfirmationLabel">
+          <component id="61373" class="javax.swing.JRadioButton" binding="myShowDialogOnAddingFile">
             <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
-              <text resource-bundle="messages/VcsBundle" key="label.after.deletion.group"/>
+              <margin top="2" left="2" bottom="2" right="2"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.show.options"/>
             </properties>
           </component>
-          <component id="1256b" class="javax.swing.JRadioButton" binding="myShowDialogOnRemovingFile">
+          <component id="3cc74" class="javax.swing.JRadioButton" binding="myPerformActionOnAddingFile">
             <constraints>
               <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
-              <margin top="2" left="2" bottom="2" right="2"/>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.show.options"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.add.silently"/>
             </properties>
           </component>
-          <component id="f0ee1" class="javax.swing.JRadioButton" binding="myPerformActionOnRemovingFile">
+          <component id="7fc5c" class="javax.swing.JRadioButton" binding="myDoNothingOnAddingFile">
             <constraints>
               <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
-              <margin top="2" left="2" bottom="2" right="2"/>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.remove.silently"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.do.not.add"/>
             </properties>
           </component>
-          <component id="daddb" class="javax.swing.JRadioButton" binding="myDoNothingOnRemovingFile">
+        </children>
+      </grid>
+      <grid id="19911" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="etched" title="When empty changelist becomes inactive"/>
+        <children>
+          <component id="7b546" class="javax.swing.JRadioButton">
             <constraints>
-              <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
-                <preferred-size width="97" height="23"/>
-              </grid>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
               <margin top="2" left="2" bottom="2" right="2"/>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.do.not.remove"/>
+              <text value="Show options before removing"/>
+            </properties>
+          </component>
+          <component id="59f74" class="javax.swing.JRadioButton">
+            <constraints>
+              <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties>
+              <text value="Remove silently"/>
+            </properties>
+          </component>
+          <component id="49213" class="javax.swing.JRadioButton">
+            <constraints>
+              <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties>
+              <text value="Do not remove"/>
             </properties>
           </component>
         </children>
       </grid>
-      <grid id="4ec1c" binding="myAddConfirmationPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+      <grid id="8145c" binding="myRemoveConfirmationPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
         <margin top="0" left="0" bottom="0" right="0"/>
         <constraints>
-          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
-        <border type="etched" title="Files Creation"/>
+        <border type="etched" title="When files are deleted"/>
         <children>
-          <component id="5d24" class="javax.swing.JLabel" binding="myAddConfirmationLabel">
+          <component id="1256b" class="javax.swing.JRadioButton" binding="myShowDialogOnRemovingFile">
             <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
-              <text resource-bundle="messages/VcsBundle" key="label.after.creation."/>
+              <margin top="2" left="2" bottom="2" right="2"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.show.options"/>
             </properties>
           </component>
-          <component id="61373" class="javax.swing.JRadioButton" binding="myShowDialogOnAddingFile">
+          <component id="f0ee1" class="javax.swing.JRadioButton" binding="myPerformActionOnRemovingFile">
             <constraints>
               <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
             </constraints>
             <properties>
               <margin top="2" left="2" bottom="2" right="2"/>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.show.options"/>
-            </properties>
-          </component>
-          <component id="3cc74" class="javax.swing.JRadioButton" binding="myPerformActionOnAddingFile">
-            <constraints>
-              <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.add.silently"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.remove.silently"/>
             </properties>
           </component>
-          <component id="7fc5c" class="javax.swing.JRadioButton" binding="myDoNothingOnAddingFile">
+          <component id="daddb" class="javax.swing.JRadioButton" binding="myDoNothingOnRemovingFile">
             <constraints>
-              <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+              <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
+                <preferred-size width="97" height="23"/>
+              </grid>
             </constraints>
             <properties>
-              <text resource-bundle="messages/VcsBundle" key="radio.after.creation.do.not.add"/>
+              <margin top="2" left="2" bottom="2" right="2"/>
+              <text resource-bundle="messages/VcsBundle" key="radio.after.deletion.do.not.remove"/>
             </properties>
           </component>
         </children>
       </grid>
+      <grid id="a5aa5" binding="myPromptsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+            <minimum-size width="300" height="-1"/>
+          </grid>
+        </constraints>
+        <properties/>
+        <border type="etched" title-resource-bundle="messages/VcsBundle" title-key="border.display.dialog.when.commands.invoked"/>
+        <children/>
+      </grid>
+      <hspacer id="308c6">
+        <constraints>
+          <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+        </constraints>
+      </hspacer>
     </children>
   </grid>
   <buttonGroups>
       <member id="f0ee1"/>
       <member id="daddb"/>
     </group>
+    <group name="myEmptyChangelistRemovingGroup" bound="true">
+      <member id="7b546"/>
+      <member id="59f74"/>
+      <member id="49213"/>
+    </group>
   </buttonGroups>
 </form>
index 0ccc62d5fad620bb0399145c52a06b216ad3ba69..fcfa0d99a237d10be9609d9377c7995f3da32392 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.intellij.openapi.vcs.configurable;
 
-import com.intellij.openapi.application.ApplicationNamesInfo;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.project.Project;
@@ -60,8 +59,7 @@ public class VcsGeneralConfigurationPanel implements Configurable {
   private JPanel myAddConfirmationPanel;
   private JCheckBox myCbOfferToMoveChanges;
   private JComboBox myFailedCommitChangelistCombo;
-  private JLabel myRemoveConfirmationLabel;
-  private JLabel myAddConfirmationLabel;
+  private ButtonGroup myEmptyChangelistRemovingGroup;
 
   public VcsGeneralConfigurationPanel(final Project project) {
 
@@ -93,8 +91,6 @@ public class VcsGeneralConfigurationPanel implements Configurable {
 
     myPromptsPanel.setSize(myPromptsPanel.getPreferredSize());
 
-    myAddConfirmationLabel.setText(VcsBundle.message("add.confirmation.label.text", ApplicationNamesInfo.getInstance().getProductName()));
-    myRemoveConfirmationLabel.setText(VcsBundle.message("remove.confirmation.label.text", ApplicationNamesInfo.getInstance().getProductName()));
   }
 
   public void apply() throws ConfigurationException {
@@ -103,6 +99,7 @@ public class VcsGeneralConfigurationPanel implements Configurable {
 
     settings.FORCE_NON_EMPTY_COMMENT = myForceNonEmptyComment.isSelected();
     settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT = myCbOfferToMoveChanges.isSelected();
+    settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS = getSelected(myEmptyChangelistRemovingGroup);
     settings.MOVE_TO_FAILED_COMMIT_CHANGELIST = getFailedCommitConfirm();
 
     for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
@@ -141,6 +138,15 @@ public class VcsGeneralConfigurationPanel implements Configurable {
     return VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY;
   }
 
+  private static VcsShowConfirmationOption.Value getSelected(ButtonGroup group) {
+    switch (UIUtil.getSelectedButton(group)) {
+      case 0:
+        return VcsShowConfirmationOption.Value.SHOW_CONFIRMATION;
+      case 1:
+        return VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY;
+    }
+    return VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY;
+  }
 
   private ReadonlyStatusHandlerImpl getReadOnlyStatusHandler() {
     return ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(myProject));
@@ -155,6 +161,9 @@ public class VcsGeneralConfigurationPanel implements Configurable {
     if (settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT != myCbOfferToMoveChanges.isSelected()){
       return true;
     }
+    if (settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS != getSelected(myEmptyChangelistRemovingGroup)){
+      return true;
+    }
 
     if (!Comparing.equal(getFailedCommitConfirm(), settings.MOVE_TO_FAILED_COMMIT_CHANGELIST)) {
       return true;
@@ -178,6 +187,8 @@ public class VcsGeneralConfigurationPanel implements Configurable {
     VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
     myForceNonEmptyComment.setSelected(settings.FORCE_NON_EMPTY_COMMENT);
     myCbOfferToMoveChanges.setSelected(settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT);
+    int id = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS.getId();
+    UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, id == 0 ? 0 : id == 1 ? 2 : 1);
     myShowReadOnlyStatusDialog.setSelected(getReadOnlyStatusHandler().getState().SHOW_DIALOG);
     if (settings.MOVE_TO_FAILED_COMMIT_CHANGELIST == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) {
       myFailedCommitChangelistCombo.setSelectedIndex(0);