<commit_before>package tools.vitruv.framework.monitorededitor;

import java.util.HashMap;

import org.apache.log4j.Logger;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;

/**
 * {@link ProjectBuildUtils} is a utility class providing methods issuing the execution of a certain builder
 * for all projects which can be built with this builder.
 */
public final class ProjectBuildUtils {
    private static final Logger LOGGER = Logger.getLogger(ProjectBuildUtils.class);
    
    private ProjectBuildUtils() {
        
    }
    
    /**
     * Issues an incremental build of all projects supporting a given builder.
     * @param builderId 
     *       An Eclipse builder ID. Only this builder is executed on the currently
     *       existing projects supporting this builder.
     */
    public static void issueIncrementalBuildForAllProjectsWithBuilder(final String builderId) {
        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
        	issueIncrementalBuild(project, builderId);
        }
    }

    public static void issueIncrementalBuild(final IProject project, final String builderId) {
        LOGGER.trace("Issuing initial build for project " + project.getName());
        try {
            for (ICommand buildCommand : project.getDescription().getBuildSpec()) {
                if (buildCommand.getBuilderName().equals(builderId)) {
                	 project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, builderId, new HashMap<String, String>(),
                             new NullProgressMonitor());
                }
            }
        } catch (CoreException e) {
            LOGGER.fatal("Could not issue initial build for project " + project.getName() + ":\n" + e);
        }
    }
}<commit_msg>ProjectBuildUtils: Don’t issue a fatal message for closed projects<commit_after>package tools.vitruv.framework.monitorededitor;

import java.util.HashMap;

import org.apache.log4j.Logger;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;

/**
 * {@link ProjectBuildUtils} is a utility class providing methods issuing the execution of a certain
 * builder for all projects which can be built with this builder.
 */
public final class ProjectBuildUtils {
    private static final Logger LOGGER = Logger.getLogger(ProjectBuildUtils.class);

    private ProjectBuildUtils() {

    }

    /**
     * Issues an incremental build of all projects supporting a given builder.
     *
     * @param builderId
     *            An Eclipse builder ID. Only this builder is executed on the currently existing
     *            projects supporting this builder.
     */
    public static void issueIncrementalBuildForAllProjectsWithBuilder(final String builderId) {
        for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
            if (project.isOpen()) {
                issueIncrementalBuild(project, builderId);
            }
        }
    }

    public static void issueIncrementalBuild(final IProject project, final String builderId) {
        LOGGER.trace("Issuing initial build for project " + project.getName());
        try {
            for (ICommand buildCommand : project.getDescription().getBuildSpec()) {
                if (buildCommand.getBuilderName().equals(builderId)) {
                    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, builderId, new HashMap<String, String>(),
                            new NullProgressMonitor());
                }
            }
        } catch (CoreException e) {
            LOGGER.fatal("Could not issue initial build for project " + project.getName() + ":\n" + e);
        }
    }
}
{'fraction_non_alphanumeric': 0.08689355539464157, 'fraction_numerical': 0.0004827419744146754, 'mean_word_length': 2.9731543624161074, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5147971', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1026, 'n_words': 288}