<commit_before>package hu.eltesoft.modelexecution.ide.builder;

import hu.eltesoft.modelexecution.ide.IdePlugin;
import hu.eltesoft.modelexecution.ide.project.ExecutableModelNature;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.compiler.CompilationParticipant;

/**
 * Refreshes the output folder of Java builder after it finished. This ensures
 * that StratumBuilder will be notified about the new class files.
 */
public class StratumCompilationParticipant extends CompilationParticipant {

	@Override
	public void buildFinished(IJavaProject javaProject) {
		try {
			IPath outputPath = javaProject.getOutputLocation();
			IProject project = javaProject.getProject();
			IWorkspaceRoot root = project.getWorkspace().getRoot();
			IResource outputFolder = root.findMember(outputPath);
			if (outputFolder != null) {
				outputFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
			}
		} catch (CoreException e) {
			IdePlugin.logError("Unable to refresh output folder.", e);
		}
	}

	/**
	 * @return true only when the given project has xUML-RT nature
	 */
	@Override
	public boolean isActive(IJavaProject javaProject) {
		IProject project = javaProject.getProject();
		try {
			// check whether this project has the xUML-RT nature
			return null != project.getNature(ExecutableModelNature.NATURE_ID);
		} catch (CoreException e) {
			// do not enable the participant in case of any error
			IdePlugin.logError("Unable to check nature on project.", e);
			return false;
		}
	}
}<commit_msg>quick fix on stratum builder: do not try to get the nature of closed projects<commit_after>package hu.eltesoft.modelexecution.ide.builder;

import hu.eltesoft.modelexecution.ide.IdePlugin;
import hu.eltesoft.modelexecution.ide.project.ExecutableModelNature;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.compiler.CompilationParticipant;

/**
 * Refreshes the output folder of Java builder after it finished. This ensures
 * that StratumBuilder will be notified about the new class files.
 */
public class StratumCompilationParticipant extends CompilationParticipant {

	@Override
	public void buildFinished(IJavaProject javaProject) {
		try {
			IPath outputPath = javaProject.getOutputLocation();
			IProject project = javaProject.getProject();
			IWorkspaceRoot root = project.getWorkspace().getRoot();
			IResource outputFolder = root.findMember(outputPath);
			if (outputFolder != null) {
				outputFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
			}
		} catch (CoreException e) {
			IdePlugin.logError("Unable to refresh output folder.", e);
		}
	}

	/**
	 * @return true only when the given project has xUML-RT nature
	 */
	@Override
	public boolean isActive(IJavaProject javaProject) {
		IProject project = javaProject.getProject();
		try {
			if (!project.isOpen()) {
				// do not build closed projects
				// the nature getter below will fail in that case anyway
				return false;
			}
			// check whether this project has the xUML-RT nature
			return null != project.getNature(ExecutableModelNature.NATURE_ID);
		} catch (CoreException e) {
			// do not enable the participant in case of any error
			IdePlugin.logError("Unable to check nature on project.", e);
			return false;
		}
	}
}
{'fraction_non_alphanumeric': 0.09307359307359307, 'fraction_numerical': 0.0, 'mean_word_length': 4.542728635682159, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4746290', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1071, 'n_words': 295}