Search in sources :

Example 1 with Strategy

use of org.eclipse.smarthome.model.persistence.persistence.Strategy 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

ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 Strategy (org.eclipse.smarthome.model.persistence.persistence.Strategy)1 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)1 IScope (org.eclipse.xtext.scoping.IScope)1 SimpleScope (org.eclipse.xtext.scoping.impl.SimpleScope)1