blob: 591303a892bf0fe8d5c3e9b6e14a667d637d31ba [file] [log] [blame]
package org.eclipse.osbp.xtext.oxtype.scoping
import com.google.common.collect.Lists
import java.util.List
import org.eclipse.osbp.xtext.oxtype.oxtype.OXImportDeclaration
import org.eclipse.xtext.scoping.impl.ImportNormalizer
import org.eclipse.xtext.xtype.XImportDeclaration
import org.eclipse.xtext.xtype.XImportSection
import org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider
@SuppressWarnings("restriction")
class OXImportSectionNamespaceScopeProvider extends XImportSectionNamespaceScopeProvider{
override List<ImportNormalizer> getImportedNamespaceResolvers(XImportSection importSection, boolean ignoreCase) {
val List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
val List<ImportNormalizer> result = Lists.newArrayListWithExpectedSize(importDeclarations.size());
for (XImportDeclaration imp : importDeclarations) {
if (!imp.isStatic()) {
val OXImportDeclaration decl = imp as OXImportDeclaration;
var String value = decl.getImportedFullyQualifiedName();
if (value === null)
value = imp.getImportedNamespace();
if (value === null)
value = imp.getImportedTypeName();
val ImportNormalizer resolver = createImportedNamespaceResolver(value, ignoreCase);
if (resolver !== null)
result.add(resolver);
}
}
return result;
}
}