mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
This commit is contained in:
+13
-15
@@ -43,30 +43,30 @@ public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWit
|
||||
@NonNls private static final String OPTION = "option";
|
||||
@NonNls private static final String ENV_VARIABLES = "ENV_VARIABLES";
|
||||
|
||||
private final EnvironmentVariablesTextField myEnvsTextField;
|
||||
private final EnvironmentVariablesTextFieldWithBrowseButton myEnvVars;
|
||||
|
||||
public EnvironmentVariablesComponent() {
|
||||
super();
|
||||
myEnvsTextField = new EnvironmentVariablesTextField();
|
||||
setComponent(myEnvsTextField.getComponent());
|
||||
myEnvVars = new EnvironmentVariablesTextFieldWithBrowseButton();
|
||||
setComponent(myEnvVars);
|
||||
setText(ExecutionBundle.message("environment.variables.component.title"));
|
||||
}
|
||||
|
||||
public void setEnvs(@NotNull Map<String, String> envs) {
|
||||
myEnvsTextField.setEnvs(envs);
|
||||
myEnvVars.setEnvs(envs);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<String, String> getEnvs() {
|
||||
return myEnvsTextField.getEnvs();
|
||||
return myEnvVars.getEnvs();
|
||||
}
|
||||
|
||||
public boolean isPassParentEnvs() {
|
||||
return myEnvsTextField.isPassParentEnvs();
|
||||
return myEnvVars.isPassParentEnvs();
|
||||
}
|
||||
|
||||
public void setPassParentEnvs(final boolean passParentEnvs) {
|
||||
myEnvsTextField.setPassParentEnvs(passParentEnvs);
|
||||
myEnvVars.setPassParentEnvs(passParentEnvs);
|
||||
}
|
||||
|
||||
public static void readExternal(Element element, Map<String, String> envs) {
|
||||
@@ -93,12 +93,10 @@ public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWit
|
||||
private static void splitVars(final Map<String, String> envs, final String val) {
|
||||
if (val != null) {
|
||||
final String[] envVars = val.split(";");
|
||||
if (envVars != null) {
|
||||
for (String envVar : envVars) {
|
||||
final int idx = envVar.indexOf('=');
|
||||
if (idx > -1) {
|
||||
envs.put(envVar.substring(0, idx), idx < envVar.length() - 1 ? envVar.substring(idx + 1) : "");
|
||||
}
|
||||
for (String envVar : envVars) {
|
||||
final int idx = envVar.indexOf('=');
|
||||
if (idx > -1) {
|
||||
envs.put(envVar.substring(0, idx), idx < envVar.length() - 1 ? envVar.substring(idx + 1) : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,11 +132,11 @@ public class EnvironmentVariablesComponent extends LabeledComponent<TextFieldWit
|
||||
|
||||
@Override
|
||||
public void addChangeListener(final ChangeListener changeListener) {
|
||||
myEnvsTextField.addChangeListener(changeListener);
|
||||
myEnvVars.addChangeListener(changeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChangeListener(final ChangeListener changeListener) {
|
||||
myEnvsTextField.removeChangeListener(changeListener);
|
||||
myEnvVars.removeChangeListener(changeListener);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-13
@@ -34,17 +34,16 @@ import java.awt.event.ActionListener;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class EnvironmentVariablesTextField {
|
||||
public class EnvironmentVariablesTextFieldWithBrowseButton extends TextFieldWithBrowseButton {
|
||||
|
||||
private final TextFieldWithBrowseButton myEnvsTextField;
|
||||
private final Map<String, String> myEnvs = new THashMap<String, String>();
|
||||
private boolean myPassParentEnvs;
|
||||
private final List<ChangeListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
|
||||
public EnvironmentVariablesTextField() {
|
||||
myEnvsTextField = new TextFieldWithBrowseButton();
|
||||
myEnvsTextField.setEditable(false);
|
||||
myEnvsTextField.addActionListener(new ActionListener() {
|
||||
public EnvironmentVariablesTextFieldWithBrowseButton() {
|
||||
super();
|
||||
setEditable(false);
|
||||
addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
new MyEnvironmentVariablesDialog().show();
|
||||
@@ -52,11 +51,6 @@ public class EnvironmentVariablesTextField {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TextFieldWithBrowseButton getComponent() {
|
||||
return myEnvsTextField;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<String, String> getEnvs() {
|
||||
return myEnvs;
|
||||
@@ -66,7 +60,7 @@ public class EnvironmentVariablesTextField {
|
||||
myEnvs.clear();
|
||||
myEnvs.putAll(envs);
|
||||
String envsStr = stringifyEnvs(myEnvs);
|
||||
myEnvsTextField.setText(envsStr);
|
||||
setText(envsStr);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -115,7 +109,7 @@ public class EnvironmentVariablesTextField {
|
||||
private final JPanel myWholePanel = new JPanel(new BorderLayout());
|
||||
|
||||
protected MyEnvironmentVariablesDialog() {
|
||||
super(myEnvsTextField, true);
|
||||
super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
|
||||
myEnvVariablesTable = new EnvVariablesTable();
|
||||
List<EnvironmentVariable> envVariables = ContainerUtil.newArrayList();
|
||||
for (Map.Entry<String, String> entry : myEnvs.entrySet()) {
|
||||
Reference in New Issue
Block a user