public void reportResult(final @NotNull String htmlReport,
                           final @NotNull ValuesExtractionResult calculatedValues,
                           final @NotNull Project project,
                           final @NotNull CodeStyleSettings cloneSettings,
                           final @NotNull PsiFile file,
                           final @NotNull Map<Value, Object> backup) {
    UIUtil.invokeLaterIfNeeded(() -> {
      final Balloon balloon = JBPopupFactory
        .getInstance()
        .createHtmlTextBalloonBuilder(
          LangBundle.message("popup.content.formatting.options", file.getName(), !htmlReport.isEmpty() ? ("<br/>" + htmlReport) : ""),
          MessageType.INFO,
          new HyperlinkListener() {
            @Override
            public void hyperlinkUpdate(HyperlinkEvent e) {
              if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                boolean apply = "apply".equals(e.getDescription());
                ExtractedSettingsDialog myDialog = null;
                if (!apply) {
                  final List<Value> values = calculatedValues.getValues();
                  Language language = file.getLanguage();
                  CodeStyleSettingsNameProvider nameProvider = new CodeStyleSettingsNameProvider();
                  for (final LanguageCodeStyleSettingsProvider provider : LanguageCodeStyleSettingsProvider.getAllProviders()) {
                    Language target = provider.getLanguage();
                    if (target.equals(language)) {
                      //this is our language
                      nameProvider.addSettings(provider);
                      myDialog = new ExtractedSettingsDialog(project, nameProvider, values);
                      apply = myDialog.showAndGet();
                      break;
                    }
                  }
                }
                if (apply /*&& myDialog != null*/) {
                  //create new settings named after the file
                  //final ExtractedSettingsDialog finalMyDialog = myDialog;
                  //calculatedValues.applyConditioned(value -> finalMyDialog.valueIsSelectedInTree(value), backup);
                  calculatedValues.applySelected();
                  CodeStyleScheme derivedScheme = CodeStyleSchemes
                    .getInstance()
                    .createNewScheme("Derived from " + file.getName(), null);
                  derivedScheme.getCodeStyleSettings().copyFrom(cloneSettings);
                  CodeStyleSchemes.getInstance().addScheme(derivedScheme);
                  CodeStyleSchemesImpl.getSchemeManager().setCurrent(derivedScheme);
                  CodeStyleSettingsManager.getInstance(project).PREFERRED_PROJECT_CODE_STYLE = derivedScheme.getName();
                }
              }
            }
          }
        )
        .setFadeoutTime(0)
        .setShowCallout(false)
        .setAnimationCycle(0)
        .setHideOnClickOutside(false)
        .setHideOnKeyOutside(false)
        .setHideOnLinkClick(true)
        .setCloseButtonEnabled(true)
        .createBalloon();

      Disposer.register(project, balloon);

      Window window = WindowManager.getInstance().getFrame(project);
      if (window == null) {
        window = JOptionPane.getRootFrame();
      }
      if (window instanceof IdeFrame) {
        BalloonLayout layout = ((IdeFrame)window).getBalloonLayout();
        if (layout != null) {
          balloon.show(new PositionTracker<>(((IdeFrame)window).getComponent()) {
            @Override
            public RelativePoint recalculateLocation(@NotNull Balloon object) {
              Component c = getComponent();
              int y = c.getHeight() - 45;
              return new RelativePoint(c, new Point(c.getWidth() - 150, y));
            }
          }, Balloon.Position.above);
        }
      }
    });
  }
public void reportResult(final @NotNull String htmlReport,
                           final @NotNull ValuesExtractionResult calculatedValues,
                           final @NotNull Project project,
                           final @NotNull CodeStyleSettings cloneSettings,
                           final @NotNull PsiFile file,
                           final @NotNull Map<Value, Object> backup)