本文整理汇总了Java中org.eclipse.xtext.scoping.impl.MapBasedScope类的典型用法代码示例。如果您正苦于以下问题:Java MapBasedScope类的具体用法?Java MapBasedScope怎么用?Java MapBasedScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapBasedScope类属于org.eclipse.xtext.scoping.impl包,在下文中一共展示了MapBasedScope类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScope
import org.eclipse.xtext.scoping.impl.MapBasedScope; //导入依赖的package包/类
@Override
public IScope getScope(EObject context, EReference reference) {
if (reference == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) {
XAnnotation annotation = EcoreUtil2.getContainerOfType(context, XAnnotation.class);
JvmType annotationType = annotation.getAnnotationType();
if (annotationType == null || annotationType.eIsProxy() || !(annotationType instanceof JvmAnnotationType)) {
return IScope.NULLSCOPE;
}
Iterable<JvmOperation> operations = ((JvmAnnotationType) annotationType).getDeclaredOperations();
Iterable<IEObjectDescription> descriptions = transform(operations, new Function<JvmOperation, IEObjectDescription>() {
@Override
public IEObjectDescription apply(JvmOperation from) {
return EObjectDescription.create(QualifiedName.create(from.getSimpleName()), from);
}
});
return MapBasedScope.createScope(IScope.NULLSCOPE, descriptions);
}
return super.getScope(context, reference);
}
示例2: getScope
import org.eclipse.xtext.scoping.impl.MapBasedScope; //导入依赖的package包/类
/**
* Overidden to avoid scope nesting which is not required and slows down because
* of shadowing testing.
*/
@Override
protected IScope getScope(Resource resource, boolean ignoreCase, EClass type,
Predicate<IEObjectDescription> filter) {
final LinkedHashSet<URI> uniqueImportURIs = getImportedUris(resource);
IResourceDescriptions descriptions = getResourceDescriptions(resource, uniqueImportURIs);
List<URI> urisAsList = Lists.newArrayList(uniqueImportURIs);
Collections.reverse(urisAsList);
List<IEObjectDescription> objectDescriptions = new ArrayList<IEObjectDescription>();
for (URI uri : urisAsList) {
IScope scope = createLazyResourceScope(IScope.NULLSCOPE, uri, descriptions, type, filter, ignoreCase);
Iterables.addAll(objectDescriptions, scope.getAllElements());
}
return MapBasedScope.createScope(IScope.NULLSCOPE, objectDescriptions);
}
示例3: createSimpleFeatureCallScope
import org.eclipse.xtext.scoping.impl.MapBasedScope; //导入依赖的package包/类
@Override
public IScope createSimpleFeatureCallScope(EObject context,
EReference reference, Resource resource,
boolean includeCurrentBlock, int idx) {
IScope parent = super.createSimpleFeatureCallScope(context, reference, resource,
includeCurrentBlock, idx);
List<IEObjectDescription> descriptions = new ArrayList<IEObjectDescription>();
descriptions.addAll(createItemFeatures(resource.getResourceSet()));
descriptions.addAll(createTypeFeatures(resource.getResourceSet()));
return MapBasedScope.createScope(parent, descriptions);
}
示例4: createLocalVarScope
import org.eclipse.xtext.scoping.impl.MapBasedScope; //导入依赖的package包/类
@Override
protected IScope createLocalVarScope(IScope parentScope,
LocalVariableScopeContext scopeContext) {
if(scopeContext.getContext() instanceof Rule) {
IScope parent = super.createLocalVarScope(parentScope, scopeContext);
List<IEObjectDescription> descriptions = new ArrayList<IEObjectDescription>();
descriptions.addAll(createVarFeatures(scopeContext.getContext().eResource()));
descriptions.addAll(createTriggerSpecificVars((Rule) scopeContext.getContext()));
return MapBasedScope.createScope(parent, descriptions);
} else {
return super.createLocalVarScope(parentScope, scopeContext);
}
}