<commit_before>/*
 * Copyright 2000-2007 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.execution.configurations;

import com.intellij.execution.RunManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * @author dyoma
 */
public abstract class ConfigurationFactory {
  public static final Icon ADD_ICON = IconLoader.getIcon("/general/add.png");

  private final ConfigurationType myType;

  protected ConfigurationFactory(@NotNull final ConfigurationType type) {
    myType = type;
  }

  public RunConfiguration createConfiguration(String name, RunConfiguration template) {
    RunConfiguration newConfiguration = template.clone();
    newConfiguration.setName(name);
    return newConfiguration;
  }

  public abstract RunConfiguration createTemplateConfiguration(Project project);

  public RunConfiguration createTemplateConfiguration(Project project, RunManager runManager) {
    return createTemplateConfiguration(project);
  }

  public String getName() {
    return myType.getDisplayName();
  }

  public Icon getAddIcon() {
    return ADD_ICON;
  }

  public Icon getIcon(@NotNull final RunConfiguration configuration) {
    return getIcon();
  }

  public Icon getIcon() {
    return myType.getIcon();
  }

  @NotNull
  public ConfigurationType getType() {
    return myType;
  }
}
<commit_msg>Maven: before run task migrated to the new API + refactoring<commit_after>/*
 * Copyright 2000-2007 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.execution.configurations;

import com.intellij.execution.RunManager;
import com.intellij.execution.BeforeRunTask;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * @author dyoma
 */
public abstract class ConfigurationFactory {
  public static final Icon ADD_ICON = IconLoader.getIcon("/general/add.png");

  private final ConfigurationType myType;

  protected ConfigurationFactory(@NotNull final ConfigurationType type) {
    myType = type;
  }

  public RunConfiguration createConfiguration(String name, RunConfiguration template) {
    RunConfiguration newConfiguration = template.clone();
    newConfiguration.setName(name);
    return newConfiguration;
  }

  public abstract RunConfiguration createTemplateConfiguration(Project project);

  public RunConfiguration createTemplateConfiguration(Project project, RunManager runManager) {
    return createTemplateConfiguration(project);
  }

  public String getName() {
    return myType.getDisplayName();
  }

  public Icon getAddIcon() {
    return ADD_ICON;
  }

  public Icon getIcon(@NotNull final RunConfiguration configuration) {
    return getIcon();
  }

  public Icon getIcon() {
    return myType.getIcon();
  }

  @NotNull
  public ConfigurationType getType() {
    return myType;
  }

  /**
   * In this method you can configure defaults for the task, which are preferable to be used for your particular configuration type
   * @param providerID
   * @param task
   */
  public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) {
  }
}

{'fraction_non_alphanumeric': 0.08109965635738832, 'fraction_numerical': 0.005498281786941581, 'mean_word_length': 4.3570552147239265, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7394276', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1122, 'n_words': 390}