HtmlChunk (final int index, @NotNull final ConfigurationError error) { //todo pass ProjectStructureProblemDescription directly and get rid of ConfigurationError at all if (!(error instanceof ProjectConfigurationProblem)) return error.getDescription(); final ProjectStructureProblemDescription problemDescription = ((ProjectConfigurationProblem)error).getProblemDescription(); if (!problemDescription.getDescription().isEmpty()) return problemDescription.getDescription(); if (!problemDescription.canShowPlace()) return HtmlChunk.raw(problemDescription.getMessage()); final String message = StringUtil.decapitalize(problemDescription.getMessage()); final ProjectStructureElement place = problemDescription.getPlace().getContainingElement(); final HtmlChunk link = HtmlChunk.link("http://navigate/" + index, place.getPresentableName()); return new HtmlBuilder().append(place.getTypeName()) .append(" ") .append(link) .append(": ") .append(message) .toFragment(); }