Configuration: Fix behavior of "output directory" control

Do not show file chooser twice.
Disable/enable control on component initialization and change of
"Use project settings" option

 #KT-16952 Fixed
 #KT-16953 Fixed
This commit is contained in:
Alexey Sedunov
2017-03-20 16:44:23 +03:00
parent f56af41d1e
commit a795a256f4
@@ -153,22 +153,10 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
"Choose Output Directory",
false);
outputDirectory.addBrowseFolderListener(
"Choose Output Directory",
null,
project,
new FileChooserDescriptor(false, true, false, false, false, false),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
false
);
copyRuntimeFilesCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(@NotNull ChangeEvent e) {
if (isEnabled) {
outputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
labelForOutputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
}
updateOutputDirEnabled();
}
});
@@ -207,6 +195,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
warningLabel.setText(buildOverridingModulesWarning(modulesOverridingProjectSettings));
}
}
updateOutputDirEnabled();
}
@SuppressWarnings("unused")
@@ -302,6 +292,13 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
return !StringUtil.equals(StringUtil.nullize(chooser.getText(), true), currentValue);
}
private void updateOutputDirEnabled() {
if (isEnabled) {
outputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
labelForOutputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
}
}
@SuppressWarnings("unchecked")
private void restrictAPIVersions() {
String selectedAPIVersion = getSelectedAPIVersion();
@@ -607,6 +604,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
public void setEnabled(boolean value) {
isEnabled = value;
UIUtil.setEnabled(getContentPane(), value, true);
updateOutputDirEnabled();
}
public CommonCompilerArguments getCommonCompilerArguments() {