<commit_before>package de.uni_hildesheim.sse.qmApp.commands;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import de.uni_hildesheim.sse.qmApp.dialogs.Dialogs;
import de.uni_hildesheim.sse.qmApp.dialogs.UiTracerFactory;
import de.uni_hildesheim.sse.qmApp.model.Location;
import de.uni_hildesheim.sse.qmApp.model.ProjectDescriptor;
import de.uni_hildesheim.sse.qmApp.model.Reasoning;
import de.uni_hildesheim.sse.qmApp.model.SessionModel;
import de.uni_hildesheim.sse.qmApp.model.VariabilityModel;
import eu.qualimaster.easy.extension.modelop.ModelModifier;
import eu.qualimaster.easy.extension.modelop.ModelModifier.QMPlatformProvider;
import net.ssehub.easy.basics.modelManagement.ModelManagementException;
import net.ssehub.easy.instantiation.core.model.common.VilException;
import net.ssehub.easy.instantiation.core.model.execution.Executor;
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory;
import net.ssehub.easy.instantiation.core.model.vilTypes.IProjectDescriptor;
import net.ssehub.easy.producer.core.persistence.standard.StandaloneProjectDescriptor;
import net.ssehub.easy.producer.ui.productline_editor.EasyProducerDialog;
import net.ssehub.easy.producer.ui.productline_editor.EclipseConsole;
import net.ssehub.easy.varModel.confModel.Configuration;

/**
 * An abstract handler for local instantiation commands. This class supports the explicit selection
 * of the entry point of the main start rule. Please note that this class also assumes that all entry points
 * have the standard VIL parameters source, config and target.
 * 
 * @author <NAME>
 * @author El-Sharkawy
 */
public abstract class AbstractInstantiateLocal extends AbstractConfigurableHandler implements QMPlatformProvider {
    /**
     * Experimental: <tt>true</tt> use copied and cleaned up configuration for instantiation, 
     * <tt>false</tt> use underlying model and configuration.
     * @see ModelModifier
     */
    private static final boolean PRUNE_CONFIG = true;
    
    /**
     * For testing purpose: <tt>true</tt> expected behavior, <tt>false</tt> Reasoning, model pruning,
     * but no instantiation.
     */
    private static final boolean ENABLE_INSTANTIATION = false;

    private static String lastTargetLocation = Location.getInstantiationFolder().getAbsolutePath();
    
    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        HandlerUtils.saveDirty(true);
        boolean modelValid = Reasoning.reasonOn(VariabilityModel.Definition.TOP_LEVEL, false);
        if (modelValid || instantiateAlways()) {
            instantiate();
        }
        return null;
    }
        
    /**
     * Implements the actual instantiation by calling VIL.
     */
    protected void instantiate() {        
        EclipseConsole.INSTANCE.clearConsole();<commit_msg>Re-enabled instantiation, which was disabled in last commit accidentally<commit_after>package de.uni_hildesheim.sse.qmApp.commands;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import de.uni_hildesheim.sse.qmApp.dialogs.Dialogs;
import de.uni_hildesheim.sse.qmApp.dialogs.UiTracerFactory;
import de.uni_hildesheim.sse.qmApp.model.Location;
import de.uni_hildesheim.sse.qmApp.model.ProjectDescriptor;
import de.uni_hildesheim.sse.qmApp.model.Reasoning;
import de.uni_hildesheim.sse.qmApp.model.SessionModel;
import de.uni_hildesheim.sse.qmApp.model.VariabilityModel;
import eu.qualimaster.easy.extension.modelop.ModelModifier;
import eu.qualimaster.easy.extension.modelop.ModelModifier.QMPlatformProvider;
import net.ssehub.easy.basics.modelManagement.ModelManagementException;
import net.ssehub.easy.instantiation.core.model.common.VilException;
import net.ssehub.easy.instantiation.core.model.execution.Executor;
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory;
import net.ssehub.easy.instantiation.core.model.vilTypes.IProjectDescriptor;
import net.ssehub.easy.producer.core.persistence.standard.StandaloneProjectDescriptor;
import net.ssehub.easy.producer.ui.productline_editor.EasyProducerDialog;
import net.ssehub.easy.producer.ui.productline_editor.EclipseConsole;
import net.ssehub.easy.varModel.confModel.Configuration;

/**
 * An abstract handler for local instantiation commands. This class supports the explicit selection
 * of the entry point of the main start rule. Please note that this class also assumes that all entry points
 * have the standard VIL parameters source, config and target.
 * 
 * @author <NAME>
 * @author El-Sharkawy
 */
public abstract class AbstractInstantiateLocal extends AbstractConfigurableHandler implements QMPlatformProvider {
    /**
     * Experimental: <tt>true</tt> use copied and cleaned up configuration for instantiation, 
     * <tt>false</tt> use underlying model and configuration.
     * @see ModelModifier
     */
    private static final boolean PRUNE_CONFIG = true;
    
    /**
     * For testing purpose: <tt>true</tt> expected behavior, <tt>false</tt> Reasoning, model pruning,
     * but no instantiation.
     */
    private static final boolean ENABLE_INSTANTIATION = true;

    private static String lastTargetLocation = Location.getInstantiationFolder().getAbsolutePath();
    
    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        HandlerUtils.saveDirty(true);
        boolean modelValid = Reasoning.reasonOn(VariabilityModel.Definition.TOP_LEVEL, false);
        if (modelValid || instantiateAlways()) {
            instantiate();
        }
        return null;
    }
        
    /**
     * Implements the actual instantiation by calling VIL.
     */
    protected void instantiate() {        
        EclipseConsole.INSTANCE.clearConsole();
{'fraction_non_alphanumeric': 0.09351203167834297, 'fraction_numerical': 0.0, 'mean_word_length': 4.546452702702703, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '145086', 'n_tokens_mistral': 2001, 'n_tokens_neox': 1944, 'n_words': 393}