mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-182736 Migrating Hg settings away from UIDesigner
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,61 +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.HgConfigurationProjectPanel">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" 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="623" height="299"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="4088f">
|
||||
<constraints>
|
||||
<grid row="4" 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="f7b19" class="javax.swing.JCheckBox" binding="myCheckIncomingOutgoingCbx">
|
||||
<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>
|
||||
<selected value="true"/>
|
||||
<text value="Check for &incoming and outgoing changesets"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="36003" class="javax.swing.JCheckBox" binding="myIgnoredWhitespacesInAnnotationsCbx">
|
||||
<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>
|
||||
<selected value="true"/>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.configuration.ignore.whitespace.in.annotate"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fadf2" class="com.intellij.ui.components.JBCheckBox" binding="mySyncControl">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="com/intellij/dvcs/ui/DvcsBundle" key="sync.setting"/>
|
||||
<toolTipText value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="7bca5" binding="myExecutablePathSelectorPanel" layout-manager="BorderLayout" hgap="0" vgap="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="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
<group name="hgPathGroup">
|
||||
<member id="e2d67"/>
|
||||
<member id="9c6c7"/>
|
||||
<member id="9a1fc"/>
|
||||
<member id="d14b"/>
|
||||
</group>
|
||||
</buttonGroups>
|
||||
</form>
|
||||
@@ -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<HgProjectConfigurable.HgSettingsHolder> {
|
||||
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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user