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


Java EObjectDescription类代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.EObjectDescription的典型用法代码示例。如果您正苦于以下问题:Java EObjectDescription类的具体用法?Java EObjectDescription怎么用?Java EObjectDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EObjectDescription类属于org.eclipse.xtext.resource包,在下文中一共展示了EObjectDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSingleLocalElementByName

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
/**
 * Returns description for given element, name is assumed to consist of a single segment containing the simple name
 * of the member. If no subScope contains a member with given name, null is returned. In other error cases (no or
 * wrong access, mixed types etc.), {@link IEObjectDescriptionWithError}, and in particular
 * {@link UnionMemberDescriptionWithError}, will be returned.
 */
@Override
protected IEObjectDescription getSingleLocalElementByName(QualifiedName qualifiedName) {
	String name = qualifiedName.getLastSegment();
	TMember member = getOrCreateComposedMember(name);
	if (member == null) { // no such member, no need for "merging" descriptions, there won't be any
		return null;
	}

	if (isErrorPlaceholder(member)) {
		return createComposedMemberDescriptionWithErrors(EObjectDescription.create(member.getName(), member));
	}

	IEObjectDescription description = getCheckedDescription(name, member);

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:ComposedMemberScope.java

示例2: getCheckedDescription

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
protected IEObjectDescription getCheckedDescription(String name, TMember member) {
	IEObjectDescription description = EObjectDescription.create(member.getName(), member);

	QualifiedName qn = QualifiedName.create(name);
	boolean allDescrWithError = true;
	for (IScope currSubScope : subScopes) {
		IEObjectDescription subDescription = currSubScope.getSingleElement(qn);
		boolean descrWithError = subDescription == null || subDescription instanceof IEObjectDescriptionWithError;
		allDescrWithError &= descrWithError;
	}
	if (allDescrWithError) {
		return createComposedMemberDescriptionWithErrors(description);
	}

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:IntersectionMemberScope.java

示例3: getCheckedDescription

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
protected IEObjectDescription getCheckedDescription(String name, TMember member) {
	IEObjectDescription description = EObjectDescription.create(member.getName(), member);

	QualifiedName qn = QualifiedName.create(name);
	for (IScope currSubScope : subScopes) {
		IEObjectDescription subDescription = currSubScope.getSingleElement(qn);

		boolean descrWithError = subDescription == null || subDescription instanceof IEObjectDescriptionWithError;
		if (descrWithError) {
			return createComposedMemberDescriptionWithErrors(description);
		}
	}

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:UnionMemberScope.java

示例4: getTypes

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
public ArrayList<IEObjectDescription> getTypes(final Extension ext) {
  ArrayList<IEObjectDescription> _xblockexpression = null;
  {
    ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>();
    EList<DataType> _types = ext.getTypes();
    for (final DataType k : _types) {
      res.add(EObjectDescription.create(QualifiedName.create(k.getName()), k));
    }
    EList<Extension> _import = ext.getImport();
    for (final Extension importExtension : _import) {
      EList<DataType> _types_1 = importExtension.getTypes();
      for (final DataType k_1 : _types_1) {
        res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k_1.getName()), k_1));
      }
    }
    _xblockexpression = res;
  }
  return _xblockexpression;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:20,代码来源:OCCIScopeProvider.java

示例5: createFeatureCallSerializationScope

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
public IScope createFeatureCallSerializationScope(EObject context) {
	if (!(context instanceof XAbstractFeatureCall)) {
		return IScope.NULLSCOPE;
	}
	XAbstractFeatureCall call = (XAbstractFeatureCall) context;
	JvmIdentifiableElement feature = call.getFeature();
	// this and super - logical container aware FeatureScopes
	if (feature instanceof JvmType) {
		return getTypeScope(call, (JvmType) feature);
	}
	if (feature instanceof JvmConstructor) {
		return getThisOrSuperScope(call, (JvmConstructor) feature);
	}
	if (feature instanceof JvmExecutable) {
		return getExecutableScope(call, feature);
	}
	if (feature instanceof JvmFormalParameter || feature instanceof JvmField || feature instanceof XVariableDeclaration || feature instanceof XSwitchExpression) {
		return new SingletonScope(EObjectDescription.create(feature.getSimpleName(), feature), IScope.NULLSCOPE);
	}
	return IScope.NULLSCOPE;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:SerializerScopeProvider.java

示例6: doGetTypeScope

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
protected IScope doGetTypeScope(XMemberFeatureCall call, JvmType type) {
	if (call.isPackageFragment()) {
		if (type instanceof JvmDeclaredType) {
			int segmentIndex = countSegments(call);
			String packageName = ((JvmDeclaredType) type).getPackageName();
			List<String> splitted = Strings.split(packageName, '.');
			String segment = splitted.get(segmentIndex);
			return new SingletonScope(EObjectDescription.create(segment, type), IScope.NULLSCOPE);
		}
		return IScope.NULLSCOPE;
	} else {
		if (type instanceof JvmDeclaredType && ((JvmDeclaredType) type).getDeclaringType() == null) {
			return new SingletonScope(EObjectDescription.create(type.getSimpleName(), type), IScope.NULLSCOPE);
		} else {
			XAbstractFeatureCall target = (XAbstractFeatureCall) call.getMemberCallTarget();
			if (target.isPackageFragment()) {
				String qualifiedName = type.getQualifiedName();
				int dot = qualifiedName.lastIndexOf('.');
				String simpleName = qualifiedName.substring(dot + 1);
				return new SingletonScope(EObjectDescription.create(simpleName, type), IScope.NULLSCOPE);
			} else {
				return new SingletonScope(EObjectDescription.create(type.getSimpleName(), type), IScope.NULLSCOPE);	
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:27,代码来源:SerializerScopeProvider.java

示例7: getLocalElementsByName

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
protected List<IEObjectDescription> getLocalElementsByName(QualifiedName name) {
	XAbstractFeatureCall featureCall = getFeatureCall();
	if (featureCall.isExplicitOperationCallOrBuilderSyntax())
		return Collections.emptyList();
	if (rawEnclosingType instanceof JvmDeclaredType && name.getSegmentCount() == 1) {
		String singleSegment = name.getFirstSegment();
		List<String> lookup = Collections.singletonList(singleSegment);
		if (singleSegment.indexOf('$') != -1) {
			lookup = Strings.split(singleSegment, '$');
		}
		JvmType result = findNestedType((JvmDeclaredType)rawEnclosingType, lookup.iterator());
		if (result != null) {
			IEObjectDescription description = EObjectDescription.create(name, result);
			return Collections.<IEObjectDescription>singletonList(new TypeLiteralDescription(description, enclosingType, isVisible(result)));
		}
	}
	return Collections.emptyList();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:NestedTypeLiteralScope.java

示例8: createTypeScope

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
public IScope createTypeScope(EObject context, EReference reference) {
	if (context.eClass() == TypesPackage.Literals.JVM_INNER_TYPE_REFERENCE) {
		JvmInnerTypeReference casted = (JvmInnerTypeReference) context;
		JvmParameterizedTypeReference outerType = casted.getOuter();
		JvmType outerRawType = outerType.getType();
		if (outerRawType instanceof JvmDeclaredType) {
			Iterable<JvmDeclaredType> nestedTypes = ((JvmDeclaredType) outerRawType).getAllNestedTypes();
			List<IEObjectDescription> descriptions = Lists.newArrayList();
			for(JvmDeclaredType nestedType: nestedTypes) {
				descriptions.add(EObjectDescription.create(nestedType.getSimpleName(), nestedType));
			}
			return new SimpleScope(descriptions);
		}
		return IScope.NULLSCOPE;
	} else {
		final IScope delegateScope = getDelegate().getScope(context, reference);
		return delegateScope;
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:TypeScopes.java

示例9: getScope

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的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

示例10: createEObjectDescriptions

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
protected boolean createEObjectDescriptions(IQualifiedNameProvider qualifiedNameProvider, boolean isNsURI,
		EObject eObject, IAcceptor<IEObjectDescription> acceptor) {
	try {
		QualifiedName qualifiedName = qualifiedNameProvider.getFullyQualifiedName(eObject);
		if (qualifiedName != null) {
			Map<String, String> userData = Maps.newHashMapWithExpectedSize(1);
			userData.put(NS_URI_INDEX_ENTRY, Boolean.toString(isNsURI));
			IEObjectDescription description = EObjectDescription.create(qualifiedName, eObject, userData);
			acceptor.accept(description);
			return true;
		}
	} catch (Exception exc) {
		LOG.error(exc.getMessage(), exc);
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:EcoreResourceDescriptionStrategy.java

示例11: getElements

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(EObject object) {
	if (object instanceof JvmConstructor) {
		JvmConstructor constructor = ((JvmConstructor) object);
		String qualifiedNameWithDots = constructor.getQualifiedName('.');
		String qualifiedNameWithDollar = constructor.getQualifiedName();
		if (qualifiedNameWithDollar.equals(qualifiedNameWithDots)) {
			final Set<IEObjectDescription> result = singleton(
					EObjectDescription.create(getQualifiedNameConverter().toQualifiedName(qualifiedNameWithDots), object));
			return result;
		} else {
			return Arrays.asList(
					EObjectDescription.create(getQualifiedNameConverter().toQualifiedName(qualifiedNameWithDots), object),
					EObjectDescription.create(getQualifiedNameConverter().toQualifiedName(qualifiedNameWithDollar), object));
		}
	}
	return emptySet();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractConstructorScope.java

示例12: getElements

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(EObject object) {
	if (object instanceof JvmIdentifiableElement) {
		JvmIdentifiableElement identifiable = ((JvmIdentifiableElement) object);
		String qualifiedNameWithDots = identifiable.getQualifiedName('.');
		String qualifiedNameWithDollar = identifiable.getQualifiedName();
		if (qualifiedNameWithDollar.equals(qualifiedNameWithDots)) {
			final Set<IEObjectDescription> result = singleton(
					EObjectDescription.create(qualifiedNameConverter.toQualifiedName(qualifiedNameWithDots), object));
			return filterResult(result);
		} else {
			return filterResult(Arrays.asList(
					EObjectDescription.create(qualifiedNameConverter.toQualifiedName(qualifiedNameWithDots), object),
					EObjectDescription.create(qualifiedNameConverter.toQualifiedName(qualifiedNameWithDollar), object)));
		}
	}
	return emptySet();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractTypeScope.java

示例13: getElements

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(EObject object) {
	if (object instanceof AbstractRule) {
		Grammar grammar = GrammarUtil.getGrammar(context);
		AbstractRule rule = (AbstractRule) object;
		if (GrammarUtil.getGrammar(rule) == grammar) {
			return Lists.newArrayList(
					EObjectDescription.create(GrammarUtil.getSimpleName(grammar) + "." + rule.getName(), rule),
					EObjectDescription.create(grammar.getName() + "." + rule.getName(), rule));
		}
		List<IEObjectDescription> result = Lists.newArrayList(
				EObjectDescription.create(SUPER + "." + rule.getName(), rule),
				EObjectDescription.create(GrammarUtil.getSimpleName(grammar) + "." + rule.getName(), rule),
				EObjectDescription.create(grammar.getName() + "." + rule.getName(), rule));
		AbstractRule contextRule = GrammarUtil.containingRule(context);
		if (contextRule != null && contextRule.getName().equals(rule.getName())) {
			result.add(0, EObjectDescription.create(SUPER, rule));
		}
		return result;
	}
	return Collections.emptyList();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:SuperCallScope.java

示例14: createScope

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
protected IScope createScope(final Grammar grammar, EClass type, IScope current) {
	if (EcorePackage.Literals.EPACKAGE == type) {
		return createEPackageScope(grammar);
	} else if (AbstractMetamodelDeclaration.class.isAssignableFrom(type.getInstanceClass())) {
		return new SimpleScope(IScope.NULLSCOPE,Iterables.transform(grammar.getMetamodelDeclarations(),
						new Function<AbstractMetamodelDeclaration,IEObjectDescription>(){
							@Override
							public IEObjectDescription apply(AbstractMetamodelDeclaration from) {
								String name = from.getAlias() != null ? from.getAlias() : "";
								return EObjectDescription.create(QualifiedName.create(name), from);
							}
						}));
	}
	final List<Grammar> allGrammars = getAllGrammars(grammar);
	for (int i = allGrammars.size() - 1; i >= 0; i--) {
		current = doCreateScope(allGrammars.get(i), type, current);
	}
	return current;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:XtextScopeProvider.java

示例15: testHasChanges_DifferentTypes

import org.eclipse.xtext.resource.EObjectDescription; //导入依赖的package包/类
@Test public void testHasChanges_DifferentTypes() throws Exception {
	TestResDesc resourceDesc = new TestResDesc();
	resourceDesc.imported.add(FOO);
	resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
	
	TestResDesc resourceDesc2 = new TestResDesc();
	resourceDesc2.imported.add(FOO);
	resourceDesc2.exported.add(new EObjectDescription(BAR, EcorePackage.Literals.EANNOTATION__CONTENTS, Collections.singletonMap("foo", "bar")){
		@Override
		public URI getEObjectURI() {
			return EcoreUtil.getURI(EcorePackage.Literals.EANNOTATION);
		}
	}
	);
	
	assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:DefaultResourceDescriptionDeltaTest.java


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