blob: caa77581936a667b1b0948a05380145093f338d4 [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.action.imports;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.osbp.xtext.datainterchange.DataDSLPackage;
import org.eclipse.osbp.xtext.datainterchange.DataInterchange;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryActionGroup;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryCanExecute;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryDSLPackage;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryExecute;
import org.eclipse.osbp.xtext.messagedsl.MessageCategory;
import org.eclipse.osbp.xtext.messagedsl.MessageDSLPackage;
import org.eclipse.osbp.xtext.messagedsl.MessageItem;
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 FunctionLibraryActionGroup ||
toImport instanceof FunctionLibraryCanExecute ||
toImport instanceof FunctionLibraryExecute ||
toImport instanceof DataInterchange ||
toImport instanceof MessageCategory ||
toImport instanceof MessageItem;
}
protected boolean doShouldProposeAllElements(EObject object, EReference reference) {
EClass type = reference.getEReferenceType();
return FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_ACTION_GROUP.isSuperTypeOf(type)
|| FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_CAN_EXECUTE.isSuperTypeOf(type)
|| FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_EXECUTE.isSuperTypeOf(type)
|| DataDSLPackage.Literals.DATA_INTERCHANGE.isSuperTypeOf(type)
|| MessageDSLPackage.Literals.MESSAGE_CATEGORY.isSuperTypeOf(type)
|| MessageDSLPackage.Literals.MESSAGE_ITEM.isSuperTypeOf(type);
}
}