<commit_before>package com.intellij.facet.impl.ui.facetType;

import com.intellij.facet.FacetConfiguration;
import com.intellij.facet.FacetType;
import com.intellij.facet.ProjectFacetManager;
import com.intellij.facet.ui.CommonFacetSettingsEditor;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * @author nik
 */
public class DefaultFacetSettingsEditor<C extends FacetConfiguration> implements Configurable {
  private final FacetType<?, C> myFacetType;
  private final Project myProject;
  private final CommonFacetSettingsEditor myDelegate;
  private final C myConfiguration;

  public DefaultFacetSettingsEditor(final @NotNull FacetType<?, C> facetType, final @NotNull Project project, final @NotNull CommonFacetSettingsEditor delegate,
                                    @NotNull C configuration) {
    myFacetType = facetType;
    myProject = project;
    myDelegate = delegate;
    myConfiguration = configuration;
  }

  public String getDisplayName() {
    return ProjectBundle.message("facet.defaults.display.name");
  }

  public Icon getIcon() {
    return null;
  }

  public String getHelpTopic() {
    return null;
  }

  public JComponent createComponent() {
    return myDelegate.createComponent();
  }

  public boolean isModified() {
    return myDelegate.isModified();
  }

  public void apply() throws ConfigurationException {
    myDelegate.apply();
    ProjectFacetManager.getInstance(myProject).setDefaultConfiguration(myFacetType, myConfiguration);
  }

  public void reset() {
    myDelegate.reset();
  }

  public void disposeUIResources() {
    myDelegate.disposeUIResources();
  }
}<commit_msg>default facet settings: don't save if not modified<commit_after>package com.intellij.facet.impl.ui.facetType;

import com.intellij.facet.FacetConfiguration;
import com.intellij.facet.FacetType;
import com.intellij.facet.ProjectFacetManager;
import com.intellij.facet.ui.CommonFacetSettingsEditor;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * @author nik
 */
public class DefaultFacetSettingsEditor<C extends FacetConfiguration> implements Configurable {
  private final FacetType<?, C> myFacetType;
  private final Project myProject;
  private final CommonFacetSettingsEditor myDelegate;
  private final C myConfiguration;

  public DefaultFacetSettingsEditor(final @NotNull FacetType<?, C> facetType, final @NotNull Project project, final @NotNull CommonFacetSettingsEditor delegate,
                                    @NotNull C configuration) {
    myFacetType = facetType;
    myProject = project;
    myDelegate = delegate;
    myConfiguration = configuration;
  }

  public String getDisplayName() {
    return ProjectBundle.message("facet.defaults.display.name");
  }

  public Icon getIcon() {
    return null;
  }

  public String getHelpTopic() {
    return null;
  }

  public JComponent createComponent() {
    return myDelegate.createComponent();
  }

  public boolean isModified() {
    return myDelegate.isModified();
  }

  public void apply() throws ConfigurationException {
    if (myDelegate.isModified()) {
      myDelegate.apply();
      ProjectFacetManager.getInstance(myProject).setDefaultConfiguration(myFacetType, myConfiguration);
    }
  }

  public void reset() {
    myDelegate.reset();
  }

  public void disposeUIResources() {
    myDelegate.disposeUIResources();
  }
}
{'fraction_non_alphanumeric': 0.09054910242872229, 'fraction_numerical': 0.0, 'mean_word_length': 4.405135520684736, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5938532', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1054, 'n_words': 237}