[Mercurial] Removed "Mercurial" group from global settings, moved hg executable setti...
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Thu, 1 Jul 2010 09:42:31 +0000 (13:42 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Thu, 1 Jul 2010 09:42:31 +0000 (13:42 +0400)
plugins/hg4idea/src/META-INF/plugin.xml
plugins/hg4idea/src/org/zmlx/hg4idea/HgIdeConfigurable.java [deleted file]
plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectConfigurable.java
plugins/hg4idea/src/org/zmlx/hg4idea/HgProjectSettings.java
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.form [deleted file]
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.java [deleted file]
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.form
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java

index 6fd8e7d4339222781d3df39ca9e5771ac906e5d5..7f7ef4c7ff14f5fc2ec2d39a987214e69b641ab3 100644 (file)
@@ -26,7 +26,6 @@
     <vcs name="hg4idea" vcsClass="org.zmlx.hg4idea.HgVcs"/>
     <checkoutProvider implementation="org.zmlx.hg4idea.provider.HgCheckoutProvider"/>
     <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
-    <applicationConfigurable implementation="org.zmlx.hg4idea.HgIdeConfigurable"/>
 
     <applicationService serviceInterface="org.zmlx.hg4idea.HgGlobalSettings"
                         serviceImplementation="org.zmlx.hg4idea.HgGlobalSettings"/>
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgIdeConfigurable.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgIdeConfigurable.java
deleted file mode 100644 (file)
index 1f1c104..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2008-2010 Victor Iacoban
-//
-// 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 org.zmlx.hg4idea;
-
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.options.SearchableConfigurable;
-import org.jetbrains.annotations.Nls;
-import org.zmlx.hg4idea.ui.HgConfigurationIdePanel;
-
-import javax.swing.*;
-
-public class HgIdeConfigurable implements SearchableConfigurable {
-
-  private final HgConfigurationIdePanel panel;
-
-  public HgIdeConfigurable(HgGlobalSettings globalSettings) {
-    panel = new HgConfigurationIdePanel(globalSettings);
-  }
-
-  @Nls
-  public String getDisplayName() {
-    return HgVcsMessages.message("hg4idea.mercurial");
-  }
-
-  public Icon getIcon() {
-    return HgVcs.MERCURIAL_ICON;
-  }
-
-  public String getHelpTopic() {
-    return null;
-  }
-
-  public JComponent createComponent() {
-    return panel.getBasePanel();
-  }
-
-  public boolean isModified() {
-    return panel.isModified();
-  }
-
-  public void apply() throws ConfigurationException {
-    panel.validate();
-    panel.saveSettings();
-  }
-
-  public void reset() {
-    panel.loadSettings();
-  }
-
-  public void disposeUIResources() {
-  }
-
-  public String getId() {
-    return "Mercurial";
-  }
-
-  public Runnable enableSearch(String option) {
-    return null;
-  }
-}
index b8ebe6ea951897e5d78dd74e62929adb2febedff..67098f3735d3e21ec6226730c23c351a1cc83444 100644 (file)
@@ -15,16 +15,17 @@ package org.zmlx.hg4idea;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.options.SearchableConfigurable;
 import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
 import org.zmlx.hg4idea.ui.HgConfigurationProjectPanel;
 
 import javax.swing.*;
 
 public class HgProjectConfigurable implements SearchableConfigurable {
 
-  private final HgConfigurationProjectPanel hgConfigurationProjectPanel;
+  private final HgConfigurationProjectPanel myPanel;
 
   public HgProjectConfigurable(HgProjectSettings projectSettings) {
-    hgConfigurationProjectPanel = new HgConfigurationProjectPanel(projectSettings);
+    myPanel = new HgConfigurationProjectPanel(projectSettings);
   }
 
   @Nls
@@ -41,24 +42,26 @@ public class HgProjectConfigurable implements SearchableConfigurable {
   }
 
   public JComponent createComponent() {
-    return hgConfigurationProjectPanel.getPanel();
+    return myPanel.getPanel();
   }
 
   public boolean isModified() {
-    return hgConfigurationProjectPanel.isModified();
+    return myPanel.isModified();
   }
 
   public void apply() throws ConfigurationException {
-    hgConfigurationProjectPanel.saveSettings();
+    myPanel.validate();
+    myPanel.saveSettings();
   }
 
   public void reset() {
-    hgConfigurationProjectPanel.loadSettings();
+    myPanel.loadSettings();
   }
 
   public void disposeUIResources() {
   }
 
+  @NotNull
   public String getId() {
     return "Mercurial.Project";
   }
index 38e0f59ab20abf1209f344afe831349950fbf209..448a1161864e74ec6a5a167bb95b90bdec7408f4 100644 (file)
@@ -20,34 +20,66 @@ import com.intellij.openapi.components.Storage;
   name = "hg4idea.settings",
   storages = @Storage(id = "hg4idea.settings", file = "$PROJECT_FILE$")
 )
-public class HgProjectSettings implements PersistentStateComponent<HgProjectSettings> {
+public class HgProjectSettings implements PersistentStateComponent<HgProjectSettings.State> {
 
-  private boolean checkIncoming = true;
-  private boolean checkOutgoing = true;
+  private boolean myCheckIncoming = true;
+  private boolean myCheckOutgoing = true;
+  private HgGlobalSettings myGlobalSettings;
+
+  public HgProjectSettings(HgGlobalSettings globalSettings) {
+    myGlobalSettings = globalSettings;
+  }
+
+  public State getState() {
+    return new State(myCheckIncoming, myCheckOutgoing, myGlobalSettings);
+  }
+
+  public void loadState(State state) {
+    myCheckIncoming = state.myCheckIncoming;
+    myCheckOutgoing = state.myCheckOutgoing;
+    myGlobalSettings = state.myGlobalSettings;
+  }
 
   public boolean isCheckIncoming() {
-    return checkIncoming;
+    return myCheckIncoming;
   }
 
   public void setCheckIncoming(boolean checkIncoming) {
-    this.checkIncoming = checkIncoming;
+    this.myCheckIncoming = checkIncoming;
   }
 
   public boolean isCheckOutgoing() {
-    return checkOutgoing;
+    return myCheckOutgoing;
   }
 
   public void setCheckOutgoing(boolean checkOutgoing) {
-    this.checkOutgoing = checkOutgoing;
+    this.myCheckOutgoing = checkOutgoing;
   }
 
-  public HgProjectSettings getState() {
-    return this;
+  public String getHgExecutable() {
+    return myGlobalSettings.getHgExecutable();
   }
 
-  public void loadState(HgProjectSettings state) {
-    checkIncoming = state.checkIncoming;
-    checkOutgoing = state.checkOutgoing;
+  public boolean isAutodetectHg() {
+    return myGlobalSettings.isAutodetectHg();
   }
 
+  public void enableAutodetectHg() {
+    myGlobalSettings.enableAutodetectHg();
+  }
+
+  public void setHgExecutable(String text) {
+    myGlobalSettings.setHgExecutable(text);
+  }
+
+  public static class State {
+    private boolean myCheckIncoming;
+    private boolean myCheckOutgoing;
+    private HgGlobalSettings myGlobalSettings;
+    private State(boolean checkIncoming, boolean checkOutgoing, HgGlobalSettings globalSettings) {
+      myCheckIncoming = checkIncoming;
+      myCheckOutgoing = checkOutgoing;
+      myGlobalSettings = globalSettings;
+    }
+  }
 }
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.form b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.form
deleted file mode 100644 (file)
index 4dcb914..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.zmlx.hg4idea.ui.HgConfigurationIdePanel">
-  <grid id="27dc6" binding="basePanel" layout-manager="GridLayoutManager" row-count="2" 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>
-      <xy x="20" y="20" width="500" height="400"/>
-    </constraints>
-    <properties/>
-    <border type="none"/>
-    <children>
-      <grid id="1beb4" layout-manager="GridLayoutManager" row-count="2" column-count="2" 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"/>
-        </constraints>
-        <properties/>
-        <border type="etched" title="Path to hg executable"/>
-        <children>
-          <component id="1491f" class="javax.swing.JRadioButton" binding="autoRadioButton">
-            <constraints>
-              <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>
-              <selected value="true"/>
-              <text value="&amp;Autodetect hg in PATH"/>
-            </properties>
-          </component>
-          <component id="45c9f" class="javax.swing.JRadioButton" binding="selectRadioButton">
-            <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>
-              <enabled value="true"/>
-              <text value="&amp;Specify executable path"/>
-            </properties>
-          </component>
-          <component id="42f2c" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="pathSelector" custom-create="true">
-            <constraints>
-              <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false">
-                <minimum-size width="100" height="-1"/>
-              </grid>
-            </constraints>
-            <properties>
-              <enabled value="false"/>
-            </properties>
-          </component>
-        </children>
-      </grid>
-      <vspacer id="c4171">
-        <constraints>
-          <grid row="1" 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>
-    </children>
-  </grid>
-  <buttonGroups>
-    <group name="hgPathGroup">
-      <member id="1491f"/>
-      <member id="45c9f"/>
-    </group>
-  </buttonGroups>
-</form>
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationIdePanel.java
deleted file mode 100644 (file)
index d6075de..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2008-2010 Victor Iacoban
-//
-// 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 org.zmlx.hg4idea.ui;
-
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.ui.TextFieldWithBrowseButton;
-import org.apache.commons.lang.StringUtils;
-import org.zmlx.hg4idea.HgGlobalSettings;
-import org.zmlx.hg4idea.HgVcsMessages;
-import org.zmlx.hg4idea.command.HgVersionCommand;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-public class HgConfigurationIdePanel {
-  private JRadioButton autoRadioButton;
-  private JRadioButton selectRadioButton;
-  private TextFieldWithBrowseButton pathSelector;
-  private JPanel basePanel;
-
-  private final HgGlobalSettings globalSettings;
-
-  public HgConfigurationIdePanel(HgGlobalSettings globalSettings) {
-    this.globalSettings = globalSettings;
-    loadSettings();
-
-    final ActionListener listener = new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        pathSelector.setEnabled(selectRadioButton.isSelected());
-      }
-    };
-
-    selectRadioButton.addActionListener(listener);
-    autoRadioButton.addActionListener(listener);
-  }
-
-  public boolean isModified() {
-    if (selectRadioButton.isSelected()) {
-      return !pathSelector.getText().equals(globalSettings.getHgExecutable());
-    }
-    return autoRadioButton.isSelected() != globalSettings.isAutodetectHg();
-  }
-
-  public JPanel getBasePanel() {
-    return basePanel;
-  }
-
-  public void validate() throws ConfigurationException {
-    String hgExecutable;
-    if (autoRadioButton.isSelected()) {
-      hgExecutable = HgGlobalSettings.getDefaultExecutable();
-    } else {
-      hgExecutable = pathSelector.getText();
-    }
-    HgVersionCommand command = new HgVersionCommand();
-    if (!command.isValid(hgExecutable)) {
-      throw new ConfigurationException(
-        HgVcsMessages.message("hg4idea.configuration.executable.error", hgExecutable)
-      );
-    }
-  }
-
-  public void saveSettings() {
-    if (autoRadioButton.isSelected()) {
-      globalSettings.enableAutodetectHg();
-    } else {
-      globalSettings.setHgExecutable(pathSelector.getText());
-    }
-  }
-
-  public void loadSettings() {
-    boolean isAutodetectHg = globalSettings.isAutodetectHg();
-    autoRadioButton.setSelected(isAutodetectHg);
-    selectRadioButton.setSelected(!isAutodetectHg);
-    pathSelector.setEnabled(!isAutodetectHg);
-    if (isAutodetectHg) {
-      pathSelector.setText(StringUtils.EMPTY);
-    } else {
-      pathSelector.setText(globalSettings.getHgExecutable());
-    }
-  }
-
-  private void createUIComponents() {
-    pathSelector = new HgSetExecutablePathPanel();
-  }
-}
index b074bf84c2ce120ca81b9cdfa9511f33ade2bb26..081bfbf896ce235cafd37e1056ebf4a30b5b69bb 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="org.zmlx.hg4idea.ui.HgConfigurationProjectPanel">
-  <grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="27dc6" binding="myMainPanel" 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>
       <xy x="20" y="20" width="500" height="400"/>
@@ -8,11 +8,6 @@
     <properties/>
     <border type="none"/>
     <children>
-      <vspacer id="4794a">
-        <constraints>
-          <grid row="1" 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="8c1f" 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>
@@ -21,7 +16,7 @@
         <properties/>
         <border type="etched" title="Changesets"/>
         <children>
-          <component id="f7b19" class="javax.swing.JCheckBox" binding="checkIncomingCbx">
+          <component id="f7b19" class="javax.swing.JCheckBox" binding="myCheckIncomingCbx">
             <constraints>
               <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>
               <text value="Check for &amp;incoming changesets"/>
             </properties>
           </component>
-          <vspacer id="4088f">
-            <constraints>
-              <grid row="2" 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>
-          <component id="cebcc" class="javax.swing.JCheckBox" binding="checkOutgoingCbx">
+          <component id="cebcc" class="javax.swing.JCheckBox" binding="myCheckOutgoingCbx">
             <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>
           </component>
         </children>
       </grid>
+      <grid id="4e3f3" layout-manager="GridLayoutManager" row-count="2" column-count="2" 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="Path to hg executable"/>
+        <children>
+          <component id="9a1fc" class="javax.swing.JRadioButton" binding="myAutoRadioButton">
+            <constraints>
+              <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">
+                <preferred-size width="183" height="23"/>
+              </grid>
+            </constraints>
+            <properties>
+              <selected value="true"/>
+              <text value="&amp;Autodetect hg in PATH"/>
+            </properties>
+          </component>
+          <component id="d14b" class="javax.swing.JRadioButton" binding="mySelectRadioButton">
+            <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">
+                <preferred-size width="183" height="23"/>
+              </grid>
+            </constraints>
+            <properties>
+              <enabled value="true"/>
+              <text value="&amp;Specify executable path"/>
+            </properties>
+          </component>
+          <component id="83ec6" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myPathSelector" custom-create="true">
+            <constraints>
+              <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false">
+                <minimum-size width="100" height="-1"/>
+              </grid>
+            </constraints>
+            <properties>
+              <enabled value="false"/>
+            </properties>
+          </component>
+        </children>
+      </grid>
+      <vspacer id="4088f">
+        <constraints>
+          <grid row="2" 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>
     </children>
   </grid>
   <buttonGroups>
     <group name="hgPathGroup">
       <member id="e2d67"/>
       <member id="9c6c7"/>
+      <member id="9a1fc"/>
+      <member id="d14b"/>
     </group>
   </buttonGroups>
 </form>
index 8f21511f71d5d66e3eebf4411d566f70499ac7f1..6d314b56f2247cabe018187cf60f6f6ef6cdd243 100644 (file)
 // limitations under the License.
 package org.zmlx.hg4idea.ui;
 
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.ui.TextFieldWithBrowseButton;
+import org.apache.commons.lang.StringUtils;
+import org.zmlx.hg4idea.HgGlobalSettings;
 import org.zmlx.hg4idea.HgProjectSettings;
+import org.zmlx.hg4idea.HgVcsMessages;
+import org.zmlx.hg4idea.command.HgVersionCommand;
 
 import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 
 public class HgConfigurationProjectPanel {
 
-  private JPanel panel;
-  private JCheckBox checkIncomingCbx;
-  private JCheckBox checkOutgoingCbx;
-  private final HgProjectSettings projectSettings;
+  private final HgProjectSettings myProjectSettings;
+
+  private JPanel myMainPanel;
+  private JCheckBox myCheckIncomingCbx;
+  private JCheckBox myCheckOutgoingCbx;
+  private JRadioButton myAutoRadioButton;
+  private JRadioButton mySelectRadioButton;
+  private TextFieldWithBrowseButton myPathSelector;
 
   public HgConfigurationProjectPanel(HgProjectSettings projectSettings) {
-    this.projectSettings = projectSettings;
+    myProjectSettings = projectSettings;
     loadSettings();
+
+    final ActionListener listener = new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        myPathSelector.setEnabled(mySelectRadioButton.isSelected());
+      }
+    };
+    mySelectRadioButton.addActionListener(listener);
+    myAutoRadioButton.addActionListener(listener);
   }
 
   public boolean isModified() {
-    return checkIncomingCbx.isSelected() != projectSettings.isCheckIncoming()
-      || checkOutgoingCbx.isSelected() != projectSettings.isCheckOutgoing();
+    boolean executableModified = mySelectRadioButton.isSelected()
+                                 ? !myPathSelector.getText().equals(myProjectSettings.getHgExecutable())
+                                 : myAutoRadioButton.isSelected() != myProjectSettings.isAutodetectHg();
+    return executableModified || myCheckIncomingCbx.isSelected() != myProjectSettings.isCheckIncoming()
+           || myCheckOutgoingCbx.isSelected() != myProjectSettings.isCheckOutgoing();
   }
 
   public void saveSettings() {
-    projectSettings.setCheckIncoming(checkIncomingCbx.isSelected());
-    projectSettings.setCheckOutgoing(checkOutgoingCbx.isSelected());
+    myProjectSettings.setCheckIncoming(myCheckIncomingCbx.isSelected());
+    myProjectSettings.setCheckOutgoing(myCheckOutgoingCbx.isSelected());
+
+    if (myAutoRadioButton.isSelected()) {
+      myProjectSettings.enableAutodetectHg();
+    } else {
+      myProjectSettings.setHgExecutable(myPathSelector.getText());
+    }
   }
 
   public void loadSettings() {
-    checkIncomingCbx.setSelected(projectSettings.isCheckIncoming());
-    checkOutgoingCbx.setSelected(projectSettings.isCheckOutgoing());
+    myCheckIncomingCbx.setSelected(myProjectSettings.isCheckIncoming());
+    myCheckOutgoingCbx.setSelected(myProjectSettings.isCheckOutgoing());
+
+    boolean isAutodetectHg = myProjectSettings.isAutodetectHg();
+    myAutoRadioButton.setSelected(isAutodetectHg);
+    mySelectRadioButton.setSelected(!isAutodetectHg);
+    myPathSelector.setEnabled(!isAutodetectHg);
+    if (isAutodetectHg) {
+      myPathSelector.setText(StringUtils.EMPTY);
+    } else {
+      myPathSelector.setText(myProjectSettings.getHgExecutable());
+    }
   }
 
   public JPanel getPanel() {
-    return panel;
+    return myMainPanel;
+  }
+
+  public void validate() throws ConfigurationException {
+    String hgExecutable;
+    if (myAutoRadioButton.isSelected()) {
+      hgExecutable = HgGlobalSettings.getDefaultExecutable();
+    } else {
+      hgExecutable = myPathSelector.getText();
+    }
+    HgVersionCommand command = new HgVersionCommand();
+    if (!command.isValid(hgExecutable)) {
+      throw new ConfigurationException(
+        HgVcsMessages.message("hg4idea.configuration.executable.error", hgExecutable)
+      );
+    }
+  }
+
+  private void createUIComponents() {
+    myPathSelector = new HgSetExecutablePathPanel();
   }
 
 }