blob: e2045fed5d0042daedfabe1f47376c172e2b64c7 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), 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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Florian Pirchner - Initial implementation
*
* This copyright notice shows up in the generated Java code
*
*/
package org.eclipse.osbp.xtext.oxtype.scoping.jvmtype
import java.util.Set
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.common.types.xtext.AbstractTypeScope
import org.eclipse.xtext.naming.QualifiedName
import org.eclipse.xtext.resource.IEObjectDescription
import org.eclipse.xtext.scoping.IScope
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
class RecordingTypeScope extends AbstractTypeScope {
private final AbstractTypeScope typeScope;
private final Set<QualifiedName> importedNames;
new(AbstractTypeScope typeScope, Set<QualifiedName> importedNames) {
super(null, null, null);
this.typeScope = typeScope;
this.importedNames = importedNames;
}
override IEObjectDescription getSingleElement(QualifiedName name, boolean binary) {
importedNames.add(name.toLowerCase());
return typeScope.getSingleElement(name, binary);
}
override IEObjectDescription getSingleElement(QualifiedName name) {
importedNames.add(name.toLowerCase());
return typeScope.getSingleElement(name);
}
override Iterable<IEObjectDescription> getElements(EObject object) {
return typeScope.getElements(object);
}
override Iterable<IEObjectDescription> getAllElements() {
throw new UnsupportedOperationException();
}
override Iterable<IEObjectDescription> getElements(QualifiedName name) {
return typeScope.getElements(name);
}
override IScope getParent() {
throw new UnsupportedOperationException();
}
override IEObjectDescription getSingleElement(EObject object) {
return typeScope.getSingleElement(object);
}
}