diff --git a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties
index 45492b96de6f..3b4d2f1d26fb 100644
--- a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties
+++ b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties
@@ -55,6 +55,7 @@ hg4idea.unable.to.run.hg=Unable to run hg: {0}
hg4idea.run.success.title=Hg Executed Successfully
hg4idea.run.failed.title=Hg Execution Failed
+hg4idea.configuration.check.incoming.outgoing=Check for &incoming and outgoing changesets
hg4idea.configuration.ignore.whitespace.in.annotate=Ignore &whitespace differences in annotations
hg4idea.command.executable.error=Error executing \"{0}\". Make sure you have setup the right executable in Mercurial configuration
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.form b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.form
deleted file mode 100644
index f15c40211173..000000000000
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.form
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java
index 3aaf4ed323f5..c6eab1fd3df5 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java
@@ -19,8 +19,12 @@ import com.intellij.openapi.options.ConfigurableUi;
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.ui.panel.JBPanelFactory;
import com.intellij.ui.components.JBCheckBox;
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.VcsExecutablePathSelector;
+import com.intellij.util.ui.components.BorderLayoutPanel;
import org.jetbrains.annotations.NotNull;
import org.zmlx.hg4idea.*;
import org.zmlx.hg4idea.repo.HgRepositoryManager;
@@ -30,28 +34,44 @@ import javax.swing.*;
import java.util.Objects;
public class HgConfigurationProjectPanel implements ConfigurableUi {
- private JPanel myMainPanel;
- private JPanel myExecutablePathSelectorPanel;
- private VcsExecutablePathSelector myExecutablePathSelector;
- private JCheckBox myCheckIncomingOutgoingCbx;
- private JCheckBox myIgnoredWhitespacesInAnnotationsCbx;
- private JBCheckBox mySyncControl;
+ private final BorderLayoutPanel myMainPanel;
+ private final VcsExecutablePathSelector myExecutablePathSelector;
+ private final JBCheckBox myCheckIncomingOutgoingCbx;
+ private final JBCheckBox myIgnoredWhitespacesInAnnotationsCbx;
+ private final JBCheckBox mySyncControl;
@NotNull private final Project myProject;
public HgConfigurationProjectPanel(@NotNull Project project) {
myProject = project;
- if (!project.isDefault()) {
- final HgRepositoryManager repositoryManager = ServiceManager.getService(project, HgRepositoryManager.class);
- mySyncControl.setVisible(repositoryManager != null && repositoryManager.moreThanOneRoot());
- }
- else {
- mySyncControl.setVisible(true);
- }
- mySyncControl.setToolTipText(DvcsBundle.message("sync.setting.description", "Mercurial"));
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
myExecutablePathSelector = new VcsExecutablePathSelector(this::testExecutable);
- myExecutablePathSelectorPanel.add(myExecutablePathSelector.getMainPanel());
+ panel.add(myExecutablePathSelector.getMainPanel());
+
+ myCheckIncomingOutgoingCbx = new JBCheckBox(HgVcsMessages.message("hg4idea.configuration.check.incoming.outgoing"));
+ panel.add(JBPanelFactory.panel(myCheckIncomingOutgoingCbx).createPanel());
+
+ myIgnoredWhitespacesInAnnotationsCbx = new JBCheckBox(HgVcsMessages.message("hg4idea.configuration.ignore.whitespace.in.annotate"));
+ panel.add(JBPanelFactory.panel(myIgnoredWhitespacesInAnnotationsCbx).createPanel());
+
+ mySyncControl = new JBCheckBox(DvcsBundle.getString("sync.setting"));
+ JPanel mySyncControlPanel = ObjectUtils.notNull(JBPanelFactory.panel(mySyncControl)
+ .withTooltip(DvcsBundle.message("sync.setting.description", "Mercurial"))
+ .createPanel());
+ if (!project.isDefault()) {
+ final HgRepositoryManager repositoryManager = ServiceManager.getService(project, HgRepositoryManager.class);
+ mySyncControlPanel.setVisible(repositoryManager != null && repositoryManager.moreThanOneRoot());
+ }
+ else {
+ mySyncControlPanel.setVisible(true);
+ }
+ panel.add(mySyncControlPanel);
+
+ myMainPanel = JBUI.Panels.simplePanel();
+ myMainPanel.addToTop(panel);
}
private void testExecutable(@NotNull String executable) {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutablePathPanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutablePathPanel.java
deleted file mode 100644
index 2905a67587bf..000000000000
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutablePathPanel.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.zmlx.hg4idea.ui;
-
-import com.intellij.openapi.fileChooser.FileChooserDescriptor;
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.ui.TextFieldWithBrowseButton;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.zmlx.hg4idea.HgProjectSettings;
-import org.zmlx.hg4idea.HgVcsMessages;
-import org.zmlx.hg4idea.util.HgUtil;
-
-import java.awt.event.ActionListener;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * HgSetExecutablePathPanel is a {@link com.intellij.openapi.ui.TextFieldWithBrowseButton}, which opens a file chooser for hg executable
- * and checks validity of the selected file to be an hg executable.
- */
-class HgSetExecutablePathPanel extends TextFieldWithBrowseButton {
- HgSetExecutablePathPanel() {
- FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
- public void validateSelectedFiles(VirtualFile[] files) throws Exception {
- String path = files[0].getPath();
- if (!HgUtil.isExecutableValid(path)) {
- throw new ConfigurationException(HgVcsMessages.message("hg4idea.configuration.executable.error", path));
- }
- }
- };
- addBrowseFolderListener(HgVcsMessages.message("hg4idea.configuration.title"), HgVcsMessages.message("hg4idea.configuration.description"), null, descriptor);
- }
-}