mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show already collected error message (IDEA-69784)
This commit is contained in:
+20
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user