View Javadoc
1   /*****************************************************************************
2    * Copyright (c) 2015 CEA LIST.
3    *
4    *
5    * All rights reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    *
10   * Contributors:
11   *  Francois Le Fevre francois.le-fevre@cea.fr  - Initial API and implementation
12   *****************************************************************************/
13  package org.eclipse.papyrus.sysml14.ui.queries.property;
14  
15  import java.util.ArrayList;
16  import java.util.Collection;
17  import java.util.List;
18  
19  import org.eclipse.emf.ecore.EObject;
20  import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
21  import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
22  import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
23  import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
24  import org.eclipse.uml2.uml.Property;
25  
26  
27  /**
28   * Build the facet linked to a typed property for Menu Explorer customisation
29   * Get the collection of all owned elements of the typed property
30   * 
31   * @pap.req org.eclipse.papyrus.sysml14.ui#REQ_001
32   * @author Francois Le Fevre
33   *
34   */
35  public class GetContainedAttributesJavaQuery implements IJavaQuery2<Property, Collection<EObject>> {
36  
37  
38  	/* (non-Javadoc)
39  	 * @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)
40  	 * @Override
41  	 */
42  	public Collection<EObject> evaluate(Property property, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
43  		List<EObject> result = new ArrayList<EObject>();
44  		if(property.getType()!=null){
45  			result.addAll(property.getType().getOwnedElements());
46  		}
47  		return result;
48  	}
49  }