| /** |
| * |
| * Copyright (c) 2011, 2017 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * 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: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.datamartdsl.imports; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntity; |
| import org.eclipse.osbp.dsl.semantic.entity.OSBPEntityPackage; |
| import org.eclipse.osbp.xtext.cubedsl.CubeDSLPackage; |
| import org.eclipse.osbp.xtext.cubedsl.CubeType; |
| import org.eclipse.osbp.xtext.oxtype.imports.DefaultShouldImportProvider; |
| |
| public class ShouldImportProvider extends DefaultShouldImportProvider { |
| |
| protected boolean doShouldImport(EObject toImport, EReference eRef, EObject context) { |
| return toImport instanceof LEntity || toImport instanceof CubeType; |
| } |
| |
| protected boolean doShouldProposeAllElements(EObject object, EReference reference) { |
| EClass type = reference.getEReferenceType(); |
| return OSBPEntityPackage.Literals.LENTITY.isSuperTypeOf(type) |
| || CubeDSLPackage.Literals.CUBE_TYPE.isSuperTypeOf(type); |
| } |
| } |