Search in sources :

Example 11 with SimpleScope

use of org.eclipse.xtext.scoping.impl.SimpleScope in project smarthome by eclipse.

the class PersistenceGlobalScopeProvider method getScope.

@Override
protected IScope getScope(Resource resource, boolean ignoreCase, EClass type, Predicate<IEObjectDescription> predicate) {
    IScope parentScope = super.getScope(resource, ignoreCase, type, predicate);
    List<IEObjectDescription> descs = new ArrayList<>();
    for (EObject eObj : res.getContents()) {
        if (eObj instanceof Strategy) {
            Strategy strategy = (Strategy) eObj;
            descs.add(EObjectDescription.create(strategy.getName(), strategy));
        }
    }
    return new SimpleScope(parentScope, descs);
}
Also used : SimpleScope(org.eclipse.xtext.scoping.impl.SimpleScope) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) IScope(org.eclipse.xtext.scoping.IScope) Strategy(org.eclipse.smarthome.model.persistence.persistence.Strategy) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

SimpleScope (org.eclipse.xtext.scoping.impl.SimpleScope)11 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)10 IScope (org.eclipse.xtext.scoping.IScope)8 QualifiedName (org.eclipse.xtext.naming.QualifiedName)5 FilteringScope (org.eclipse.xtext.scoping.impl.FilteringScope)3 EClass (org.eclipse.emf.ecore.EClass)2 EObject (org.eclipse.emf.ecore.EObject)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 Grammar (org.eclipse.xtext.Grammar)2 JvmFeature (org.eclipse.xtext.common.types.JvmFeature)2 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)2 IResolvedTypes (org.eclipse.xtext.xbase.typesystem.IResolvedTypes)2 IGeneratorDescriptor (org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor)2 GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)2 AbstractNameFunction (com.avaloq.tools.ddk.xtext.scoping.AbstractNameFunction)1 Function (com.google.common.base.Function)1 ArrayList (java.util.ArrayList)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 EList (org.eclipse.emf.common.util.EList)1