public static void showDialog(
      @NotNull Project project,
      @NotNull String title,
      ConfigurationErrorType type,
      @NotNull String invalidElements,
      @NotNull List<ConfigurationErrorDescription> errors) {
    if (errors.isEmpty()) {
      return;
    }
    if (errors.size() == 1) {
      ConfigurationErrorDescription error = errors.get(0);
      String message = error.getDescription() + "\n" + error.getIgnoreConfirmationMessage();
      final int answer = Messages.showYesNoDialog(project, message, title, Messages.getErrorIcon());
      if (answer == Messages.YES) {
        error.ignoreInvalidElement();
      }
      return;
    }

    RemoveInvalidElementsDialog dialog =
        new RemoveInvalidElementsDialog(title, type, invalidElements, project, errors);
    dialog.show();
    if (dialog.isOK()) {
      for (ConfigurationErrorDescription errorDescription : dialog.getSelectedItems()) {
        errorDescription.ignoreInvalidElement();
      }
    }
  }
 private RemoveInvalidElementsDialog(
     final String title,
     ConfigurationErrorType type,
     String invalidElements,
     final Project project,
     List<ConfigurationErrorDescription> errors) {
   super(project, true);
   setTitle(title);
   myDescriptionLabel.setText(
       ProjectBundle.message(
           type.canIgnore()
               ? "label.text.0.cannot.be.loaded.ignore"
               : "label.text.0.cannot.be.loaded.remove",
           invalidElements));
   myContentPanel.setLayout(new VerticalFlowLayout());
   for (ConfigurationErrorDescription error : errors) {
     JCheckBox checkBox = new JCheckBox(error.getElementName() + ".");
     checkBox.setSelected(true);
     myCheckboxes.put(checkBox, error);
     JPanel panel = new JPanel(new GridBagLayout());
     GridBagConstraints constraints = new GridBagConstraints();
     constraints.anchor = GridBagConstraints.NORTHWEST;
     constraints.ipadx = 5;
     panel.add(checkBox, constraints);
     constraints.anchor = GridBagConstraints.NORTHWEST;
     constraints.insets.top = 5;
     panel.add(
         new JLabel(
             "<html><body>"
                 + StringUtil.replace(error.getDescription(), "\n", "<br>")
                 + "</body></html>"),
         constraints);
     constraints.weightx = 1;
     panel.add(new JPanel(), constraints);
     myContentPanel.add(panel);
   }
   init();
   setOKButtonText(
       ProjectBundle.message(
           type.canIgnore() ? "button.text.ignore.selected" : "button.text.remove.selected"));
   setCancelButtonText(ProjectBundle.message("button.text.keep.all"));
 }