当前位置: 首页>>代码示例>>Java>>正文


Java MapBasedScope类代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseWithAnnotationsBatchScopeProvider.java

示例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);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:STextGlobalScopeProvider.java

示例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);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:ScriptScopeProvider.java

示例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);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:RulesScopeProvider.java


注:本文中的org.eclipse.xtext.scoping.impl.MapBasedScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。