mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Minor: Removed errorLabel, use DialogWrapper.setErrorText instead. Fixed code style.
This commit is contained in:
@@ -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.HgSetExecutableDialog">
|
||||
<grid id="27dc6" binding="centerPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myCenterPanel" 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="564" height="400"/>
|
||||
@@ -8,7 +8,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c91cc" class="org.zmlx.hg4idea.ui.HgSetExecutablePathPanel" binding="hgExecutablePath" custom-create="true">
|
||||
<component id="c91cc" class="org.zmlx.hg4idea.ui.HgSetExecutablePathPanel" binding="myHgExecutablePath" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="9" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="400" height="-1"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="a1421" class="javax.swing.JLabel" binding="infoLabel">
|
||||
<component id="a1421" class="javax.swing.JLabel" binding="myInfoLabel">
|
||||
<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"/>
|
||||
</constraints>
|
||||
@@ -24,19 +24,9 @@
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.configuration.description"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="c771f" class="javax.swing.JLabel" binding="errorLabel">
|
||||
<constraints>
|
||||
<grid row="2" 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>
|
||||
<font style="2"/>
|
||||
<foreground awt-color="red"/>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.configuration.executable.error"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="4c273">
|
||||
<constraints>
|
||||
<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"/>
|
||||
<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>
|
||||
|
||||
@@ -21,10 +21,9 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class HgSetExecutableDialog extends DialogWrapper {
|
||||
private JPanel centerPanel;
|
||||
private HgSetExecutablePathPanel hgExecutablePath;
|
||||
private JLabel infoLabel;
|
||||
private JLabel errorLabel;
|
||||
private JPanel myCenterPanel;
|
||||
private HgSetExecutablePathPanel myHgExecutablePath;
|
||||
private JLabel myInfoLabel;
|
||||
|
||||
public HgSetExecutableDialog(Project project) {
|
||||
super(project, false);
|
||||
@@ -33,23 +32,23 @@ public class HgSetExecutableDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
return centerPanel;
|
||||
return myCenterPanel;
|
||||
}
|
||||
|
||||
public void setBadHgPath(String hgPath) {
|
||||
hgExecutablePath.setText(hgPath);
|
||||
errorLabel.setText(HgVcsMessages.message("hg4idea.configuration.executable.error", hgPath));
|
||||
myHgExecutablePath.setText(hgPath);
|
||||
setErrorText(HgVcsMessages.message("hg4idea.configuration.executable.error", hgPath));
|
||||
}
|
||||
|
||||
public String getNewHgPath() {
|
||||
return hgExecutablePath.getText();
|
||||
return myHgExecutablePath.getText();
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
hgExecutablePath = new HgSetExecutablePathPanel();
|
||||
hgExecutablePath.addOKListener(new ActionListener() {
|
||||
myHgExecutablePath = new HgSetExecutablePathPanel();
|
||||
myHgExecutablePath.addOKListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
errorLabel.setText("");
|
||||
setErrorText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.zmlx.hg4idea.HgVcsMessages;
|
||||
import org.zmlx.hg4idea.command.HgVersionCommand;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -18,7 +17,7 @@ import java.util.Set;
|
||||
*/
|
||||
class HgSetExecutablePathPanel extends TextFieldWithBrowseButton {
|
||||
|
||||
private Set<ActionListener> okListeners = new HashSet<ActionListener>();
|
||||
private final Set<ActionListener> myOkListeners = new HashSet<ActionListener>();
|
||||
|
||||
HgSetExecutablePathPanel() {
|
||||
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
|
||||
@@ -28,7 +27,7 @@ class HgSetExecutablePathPanel extends TextFieldWithBrowseButton {
|
||||
if (!command.isValid(path)) {
|
||||
throw new ConfigurationException(HgVcsMessages.message("hg4idea.configuration.executable.error", path));
|
||||
}
|
||||
for (ActionListener okListener : okListeners) {
|
||||
for (ActionListener okListener : myOkListeners) {
|
||||
okListener.actionPerformed(null);
|
||||
}
|
||||
}
|
||||
@@ -36,8 +35,11 @@ class HgSetExecutablePathPanel extends TextFieldWithBrowseButton {
|
||||
addBrowseFolderListener(HgVcsMessages.message("hg4idea.configuration.title"), HgVcsMessages.message("hg4idea.configuration.description"), null, descriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener which will be called when file chooser dialog is closed successfully.
|
||||
*/
|
||||
void addOKListener(ActionListener listener) {
|
||||
okListeners.add(listener);
|
||||
myOkListeners.add(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user