blob: 6bf614cf03e5f6c6f106af657e4b5be481341054 [file] [log] [blame]
/**
* Copyright (c)2020 CEA LIST, Committer Name, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*/
package org.eclipse.papyrus.pdp4eng.req.ui.queries;
import org.eclipse.papyrus.emf.facet.custom.metamodel.custompt.IColor;
import org.eclipse.papyrus.emf.facet.custom.ui.internal.custompt.Color;
import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
import org.eclipse.papyrus.pdp4eng.req.profile.constraints.GDPRRequiementHelper;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;
/**
* this class is use to set in blue the color of GDPR requirements
*
*/
public class DisplayGDPRRequirement implements IJavaQuery2<NamedElement, IColor> {
public IColor evaluate(final NamedElement context, final IParameterValueList2 parameterValues, final IFacetManager facetManager)
throws DerivedTypedElementException {
Stereotype appStereotype = null;
if (context.getAppliedStereotypes().size() > 0) {
appStereotype = context.getAppliedStereotypes().get(0);
}
if ((context instanceof org.eclipse.uml2.uml.Class) && (appStereotype != null) && (GDPRRequiementHelper.isGDPR_Requirement(context))) {
return new Color( 51, 204, 255);
}
return new Color(0, 0, 0);
}
}