KT-12893: fix another potential issue (could not reproduce)

This commit is contained in:
Alexey Andreev
2016-06-29 14:28:08 +03:00
parent 476c1ec264
commit 9a50e91cd8
@@ -152,11 +152,12 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
ComparingUtils.isModified(generateSourceMapsCheckBox, k2jsCompilerArguments.sourceMap) || ComparingUtils.isModified(generateSourceMapsCheckBox, k2jsCompilerArguments.sourceMap) ||
isModified(outputPrefixFile, k2jsCompilerArguments.outputPrefix) || isModified(outputPrefixFile, k2jsCompilerArguments.outputPrefix) ||
isModified(outputPostfixFile, k2jsCompilerArguments.outputPostfix) || isModified(outputPostfixFile, k2jsCompilerArguments.outputPostfix) ||
!getSelectedModuleKind().equals(k2jsCompilerArguments.moduleKind); !getSelectedModuleKind().equals(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind));
} }
@NotNull
private String getSelectedModuleKind() { private String getSelectedModuleKind() {
return (String) moduleKindComboBox.getSelectedItem(); return getModuleKindOrDefault((String) moduleKindComboBox.getSelectedItem());
} }
@Override @Override
@@ -182,6 +183,14 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
BuildManager.getInstance().clearState(project); BuildManager.getInstance().clearState(project);
} }
@NotNull
private static String getModuleKindOrDefault(@Nullable String moduleKindId) {
if (moduleKindId == null) {
moduleKindId = K2JsArgumentConstants.MODULE_PLAIN;
}
return moduleKindId;
}
@Override @Override
public void reset() { public void reset() {
generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings); generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings);
@@ -196,11 +205,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
outputPrefixFile.setText(k2jsCompilerArguments.outputPrefix); outputPrefixFile.setText(k2jsCompilerArguments.outputPrefix);
outputPostfixFile.setText(k2jsCompilerArguments.outputPostfix); outputPostfixFile.setText(k2jsCompilerArguments.outputPostfix);
String moduleKind = k2jsCompilerArguments.moduleKind; moduleKindComboBox.setSelectedItem(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind));
if (moduleKind == null) {
moduleKind = K2JsArgumentConstants.MODULE_PLAIN;
}
moduleKindComboBox.setSelectedItem(moduleKind);
} }
@Override @Override