/*******************************************************************************
* Copyright (c) 2012 BMW Car IT and others.
* 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
*******************************************************************************/
/*
* generated by Xtext
*/
package org.jnario.suite.scoping;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.scoping.impl.FilteringScope;
import org.jnario.suite.suite.SuitePackage;
import com.google.inject.Inject;
public class SuiteScopeProvider extends AbstractDeclarativeScopeProvider {
@Inject SuiteSpecFilter specFilter;
@Override
public IScope getScope(EObject context, EReference reference) {
if(reference == SuitePackage.Literals.SPEC_REFERENCE__SPEC){
return specReferenceScope(context, reference);
}
return super.getScope(context, reference);
}
private IScope specReferenceScope(EObject context, EReference reference) {
IScope delegate = super.getScope(context, reference);
return new FilteringScope(delegate, specFilter);
}
}