| package org.eclipse.osbp.ecview.dsl.imports; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.osbp.xtext.oxtype.imports.DefaultShouldImportProvider; |
| import org.eclipse.xtext.common.types.JvmType; |
| |
| public class ShouldImportProvider extends DefaultShouldImportProvider { |
| |
| @Override |
| public boolean shouldImport(EObject toImport, EReference eRef, |
| EObject context) { |
| |
| // in this case, we also need to import JvmTypes |
| // The JvmTypeOrganizeImport stuff will not do so, since |
| // UiBeanSlot#jvmType has no parent context based on JvmType hence no |
| // inferrer |
| if (toImport instanceof JvmType) { |
| return true; |
| } |
| |
| boolean result = toImport.eResource() != context.eResource(); |
| |
| if (result == true) { |
| return doShouldImport(toImport, eRef, context); |
| } else { |
| return false; |
| } |
| } |
| |
| protected boolean doShouldImport(EObject toImport, EReference eRef, |
| EObject context) { |
| return false; |
| } |
| } |