blob: dda8ee1e5c3ffc2ec20c3303c12453fa303c8419 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - 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.dialogdsl.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.dto.LDto;
import org.eclipse.osbp.dsl.semantic.dto.OSBPDtoPackage;
import org.eclipse.osbp.ecview.semantic.uimodel.UiModelPackage;
import org.eclipse.osbp.ecview.semantic.uimodel.UiView;
import org.eclipse.osbp.xtext.action.ActionDSLPackage;
import org.eclipse.osbp.xtext.action.ActionToolbar;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryDSLPackage;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryInitialization;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryInitializationGroup;
import org.eclipse.osbp.xtext.oxtype.imports.DefaultShouldImportProvider;
import org.eclipse.osbp.xtext.strategy.StrategyDSLPackage;
public class ShouldImportProvider extends DefaultShouldImportProvider {
protected boolean doShouldImport(EObject toImport, EReference eRef, EObject context) {
return toImport instanceof LDto ||
toImport instanceof ActionToolbar ||
toImport instanceof UiView ||
toImport instanceof FunctionLibraryInitializationGroup ||
toImport instanceof FunctionLibraryInitialization;
}
protected boolean doShouldProposeAllElements(EObject object, EReference reference) {
EClass type = reference.getEReferenceType();
return FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_INITIALIZATION_GROUP.isSuperTypeOf(type)
|| FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_INITIALIZATION.isSuperTypeOf(type)
|| ActionDSLPackage.Literals.ACTION_TOOLBAR.isSuperTypeOf(type)
|| UiModelPackage.Literals.UI_VIEW.isSuperTypeOf(type)
|| OSBPDtoPackage.Literals.LDTO.isSuperTypeOf(type);
}
}