@Override
  public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
    SelectedTextFormatter textFormatter = new SelectedTextFormatter(project, editor, file);
    LanguageCodeStyleSettingsProvider settingsProvider = getProviderForContext(editor, file);
    assert settingsProvider != null;

    //reformat before calculating settings to show
    //to avoid considering that arbitrary first setting affects formatting for this fragment
    CodeStyleSettings settings = CodeStyle.getSettings(file);
    textFormatter.reformatSelectedText(settings);

    CodeStyleSettingsToShow settingsToShow = new CodeStyleSettingsCodeFragmentFilter(file, textFormatter.getSelectedRange(), settingsProvider)
      .getFieldNamesAffectingCodeFragment(SPACING_SETTINGS, WRAPPING_AND_BRACES_SETTINGS);

    new FragmentCodeStyleSettingsDialog(editor, textFormatter, settingsProvider, settings, settingsToShow).show();
  }
@Override
  public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file)