<commit_before>package de.cooperateproject.modeling.graphical.papyrus.extensions.validation;

import org.apache.log4j.Logger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.validation.model.IClientSelector;
import org.eclipse.uml2.uml.Element;

import de.cooperateproject.ui.nature.NatureUtils;

public class CooperateClientSelector implements IClientSelector {

    private static final Logger LOGGER = Logger.getLogger(CooperateClientSelector.class);

    @Override
    public boolean selects(Object object) {
        if (object instanceof Element) {
            Element model = (Element) object;
            Resource res = model.eResource();
            Path path = new Path(res.getURI().toPlatformString(true));
            IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(path).getProject();
            try {
                if (NatureUtils.hasCooperateNature(project)) {
                    return true;
                }
            } catch (CoreException e) {
                LOGGER.error("Fehler beim Überprüfen der Nature", e);
            }
        }
        return false;
    }

}<commit_msg>#6 Temporarily disabled client selector (Papyrus) because of NPE<commit_after>package de.cooperateproject.modeling.graphical.papyrus.extensions.validation;

import org.apache.log4j.Logger;
import org.eclipse.emf.validation.model.IClientSelector;

public class CooperateClientSelector implements IClientSelector {

    private static final Logger LOGGER = Logger.getLogger(CooperateClientSelector.class);

    @Override
    public boolean selects(Object object) {
        // if (object instanceof Element) {
        // Element model = (Element) object;
        // Resource res = model.eResource();
        // Path path = new Path(res.getURI().toPlatformString(true));
        // IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(path).getProject();
        // try {
        // if (NatureUtils.hasCooperateNature(project)) {
        // return true;
        // }
        // } catch (CoreException e) {
        // LOGGER.error("Fehler beim Überprüfen der Nature", e);
        // }
        // }
        return false;
    }

}
{'fraction_non_alphanumeric': 0.10524091293322063, 'fraction_numerical': 0.0016906170752324597, 'mean_word_length': 2.8425324675324677, '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': '6654155', 'n_tokens_mistral': 658, 'n_tokens_neox': 647, 'n_words': 134}