use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectConfigurationProblem in project intellij-community by JetBrains.
the class ErrorPaneConfigurable method refresh.
public void refresh() {
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> {
final String header = "<html>" + "<header><style type='text/css'>" + "body {" + " color: #" + ColorUtil.toHex(new JBColor(Gray.x33, UIUtil.getLabelForeground())) + ";" + " font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" + " font-size: " + UIUtil.getLabelFont().getSize() + ";" + "}" + "li {" + " margin-bottom: 5;" + "}" + "ol {" + "}" + "a {" + " text-decoration: none;" + "}" + "</style>" + "</header>" + "<body>";
final StringBuilder html = new StringBuilder(header);
int i = 0;
html.append("<ol>");
ConfigurationError[] errors;
int currentStamp;
synchronized (myLock) {
errors = myErrors.toArray(new ConfigurationError[0]);
currentStamp = myComputedErrorsStamp;
}
for (ConfigurationError error : errors) {
i++;
if (i > 100)
break;
html.append("<li>");
String description;
if (error instanceof ProjectConfigurationProblem) {
//todo[nik] pass ProjectStructureProblemDescription directly and get rid of ConfigurationError at all
ProjectStructureProblemDescription problemDescription = ((ProjectConfigurationProblem) error).getProblemDescription();
description = problemDescription.getDescription();
if (description == null) {
ProjectStructureElement place = problemDescription.getPlace().getContainingElement();
description = XmlStringUtil.convertToHtmlContent(problemDescription.getMessage(false));
if (problemDescription.canShowPlace()) {
description = place.getTypeName() + " <a href='http://navigate/" + i + "'>" + XmlStringUtil.convertToHtmlContent(place.getPresentableName()) + "</a>: " + StringUtil.decapitalize(description);
}
} else {
description = XmlStringUtil.convertToHtmlContent(description);
}
} else {
description = XmlStringUtil.convertToHtmlContent(error.getDescription());
}
if (error.canBeFixed()) {
description += " <a href='http://fix/" + i + "'>[Fix]</a>";
}
html.append(description).append("</li>");
}
html.append("</ol></body></html>");
myContentUpdateQueue.queue(new ShowErrorsUpdate(currentStamp, html.toString()));
if (myOnErrorsChanged != null) {
myOnErrorsChanged.run();
}
}, 100);
}
Aggregations