show already collected error message (IDEA-69784)

This commit is contained in:
anna
2011-05-19 21:17:17 +04:00
parent 06ea6769da
commit 6e32c53d09
@@ -37,6 +37,8 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
public class OptionsEditorDialog extends DialogWrapper implements DataProvider{
@@ -109,12 +111,29 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{
if (errors.size() == 0) {
setErrorText(null);
} else {
setErrorText("Changes were not applied because of an error");
String text = "Changes were not applied because of an error";
final String errorMessage = getErrorMessage(errors);
if (errorMessage != null) {
text += "<br>" + errorMessage;
}
setErrorText(text);
}
return errors.size() == 0;
}
@Nullable
private static String getErrorMessage(final Map<Configurable, ConfigurationException> errors) {
final Collection<ConfigurationException> values = errors.values();
final ConfigurationException[] exceptions = values.toArray(new ConfigurationException[values.size()]);
if (exceptions.length > 0) {
return exceptions[0].getMessage();
}
return null;
}
@Override
protected String getDimensionServiceKey() {
return DIMENSION_KEY;