| /******************************************************************************* |
| * Copyright (c) 2016 Thales Global Services S.A.S. |
| * 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: |
| * Thales Global Services S.A.S - initial API and implementation |
| ******************************************************************************/ |
| |
| package org.eclipse.emf.ecoretools.explorer.contextual.queries; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.amalgam.explorer.contextual.core.query.IQuery; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EReference; |
| |
| /** |
| * @author Boubekeur Zendagui |
| */ |
| public class EClassReferencedEClassesQuery implements IQuery { |
| |
| @Override |
| public List<Object> compute(Object object_p) { |
| List<Object> result = new ArrayList<Object>(); |
| if (object_p instanceof EClass) |
| { |
| EClass eClass = (EClass) object_p; |
| EList<EReference> eAllReferences = eClass.getEAllReferences(); |
| for (EReference eReference : eAllReferences) |
| { |
| result.add(eReference.getEType()); |
| } |
| } |
| return result; |
| } |
| |
| } |