| /***************************************************************************** |
| * Copyright (c) 2018 EclipseSource and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * EclipseSource - Initial API and implementation |
| * |
| *****************************************************************************/ |
| |
| package org.eclipse.papyrus.internal.infra.gmfdiag.layers.ui.queries; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.gmf.runtime.notation.Diagram; |
| 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.infra.gmfdiag.common.utils.DiagramUtils; |
| |
| /** |
| * Query to retrieve the graphical container of a Diagram. If no such container |
| * exists, the semantic element of the Diagram is returned. |
| * |
| * @see {@link DiagramUtils#getOwner(Diagram)} |
| */ |
| public class GetDiagramContainer implements IJavaQuery2<Diagram, EObject> { |
| |
| /** |
| * @see org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2#evaluate(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2, org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager) |
| * |
| * @param source |
| * @param parameterValues |
| * @param facetManager |
| * @return |
| * @throws DerivedTypedElementException |
| */ |
| @Override |
| public EObject evaluate(Diagram source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException { |
| return DiagramUtils.getOwner(source); |
| } |
| |
| } |