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


Java EcoreUtil2.getPlatformResourceOrNormalizedURI方法代码示例

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


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

示例1: referenceHasBeenFound

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private boolean referenceHasBeenFound(Predicate<URI> targetURIs, URI refURI, EObject instanceOrProxy) {
	boolean result = false;
	// If the EObject is a composed member, we compare the target URIs with the URIs of the constituent members.
	if (instanceOrProxy instanceof TMember && ((TMember) instanceOrProxy).isComposed()) {
		TMember member = (TMember) instanceOrProxy;
		if (member.isComposed()) {
			for (TMember constituentMember : member.getConstituentMembers()) {
				URI constituentReffURI = EcoreUtil2
						.getPlatformResourceOrNormalizedURI(constituentMember);
				result = result || targetURIs.apply(constituentReffURI);
			}
		}
	} else {
		// Standard case
		result = targetURIs.apply(refURI);
	}
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:ConcreteSyntaxAwareReferenceFinder.java

示例2: getExportedObjectsByObject

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public Iterable<IEObjectDescription> getExportedObjectsByObject(final EObject object) {
	if (allDescriptions.isEmpty())
		return Collections.emptyList();
	final URI uri = EcoreUtil2.getPlatformResourceOrNormalizedURI(object);
	return Iterables.filter(allDescriptions, new Predicate<IEObjectDescription>() {
		@Override
		public boolean apply(IEObjectDescription input) {
			if (input.getEObjectOrProxy() == object)
				return true;
			if (uri.equals(input.getEObjectURI())) {
				return true;
			}
			return false;
		}
	});
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:EObjectDescriptionLookUp.java

示例3: DefaultReferenceDescription

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
public DefaultReferenceDescription(EObject from, EObject to, EReference eReference, int i, URI containerEObjectURI) {
	this.sourceEObjectUri = EcoreUtil2.getPlatformResourceOrNormalizedURI(from);
	this.targetEObjectUri = EcoreUtil2.getPlatformResourceOrNormalizedURI(to);
	this.eReference = eReference;
	this.indexInList = i;
	this.containerEObjectURI = containerEObjectURI;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:DefaultReferenceDescription.java

示例4: serializeCrossRef

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public String serializeCrossRef(EObject semanticObject, CrossReference crossref, EObject target, INode node,
		Acceptor errors) {
	if ((target == null || target.eIsProxy()) && node != null)
		return tokenUtil.serializeNode(node);

	final EReference ref = GrammarUtil.getReference(crossref, semanticObject.eClass());
	final IScope scope = scopeProvider.getScope(semanticObject, ref);
	if (scope == null) {
		if (errors != null)
			errors.accept(diagnostics.getNoScopeFoundDiagnostic(semanticObject, crossref, target));
		return null;
	}
	
	if (target != null && target.eIsProxy()) {
		target = handleProxy(target, semanticObject, ref);
	}

	if (target != null && node != null) {
		String text = linkingHelper.getCrossRefNodeAsString(node, true);
		QualifiedName qn = qualifiedNameConverter.toQualifiedName(text);
		URI targetURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(target);
		for (IEObjectDescription desc : scope.getElements(qn)) {
			if (targetURI.equals(desc.getEObjectURI()))
				return tokenUtil.serializeNode(node);
		}
	}

	return getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:31,代码来源:CrossReferenceSerializer.java

示例5: getElements

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(final EObject object) {
	final URI uri = EcoreUtil2.getPlatformResourceOrNormalizedURI(object);
	Iterable<IEObjectDescription> localElements = getLocalElementsByEObject(object, uri);
	Iterable<IEObjectDescription> parentElements = getParentElements(new Provider<Iterable<IEObjectDescription>>() {
		@Override
		public Iterable<IEObjectDescription> get() {
			return getParent().getElements(object);
		}
	});
	Iterable<IEObjectDescription> result = Iterables.concat(localElements, parentElements);
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:AbstractScope.java

示例6: getTargetURIs

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
/**
 * Here, we add overridden/overriding members or super/subclasses if needed depending on user preferences when
 * finding references.
 */
@Override
protected Iterable<URI> getTargetURIs(EObject primaryTarget) {
	@SuppressWarnings("restriction")
	Iterable<URI> originalResult = super.getTargetURIs(primaryTarget);
	List<URI> newResult = Lists.newArrayList(originalResult);

	if (primaryTarget instanceof LiteralOrComputedPropertyName) {
		primaryTarget = primaryTarget.eContainer();
	}

	// Handling for various configurations e.g. consider overriden members
	List<EObject> realTargets = new ArrayList<>();
	if (primaryTarget instanceof TMember && ((TMember) primaryTarget).isComposed()) {
		// In case of composed member, add the constituent members instead.
		List<TMember> constituentMembers = ((TMember) primaryTarget).getConstituentMembers();
		for (TMember constituentMember : constituentMembers) {
			realTargets.add(constituentMember);
		}
	} else {
		// Standard case
		realTargets.add(primaryTarget);
	}

	for (EObject realTarget : realTargets) {
		if (N4JSReferenceQueryExecutor.considerOverridenMethods) {
			// Add overriden members
			if (realTarget instanceof N4MemberDeclaration
					// Only consider members within a classifier.Ignore TStructMember.
					|| (realTarget instanceof TMember && realTarget.eContainer() instanceof TClassifier)) {
				TMember tmember;
				if (primaryTarget instanceof N4MemberDeclaration) {
					tmember = ((N4MemberDeclaration) primaryTarget).getDefinedTypeElement();
				} else {
					tmember = (TMember) primaryTarget;
				}
				for (TMember inheritedOrImplementedMember : getInheritedAndImplementedMembers(tmember)) {
					URI uri = EcoreUtil2.getPlatformResourceOrNormalizedURI(inheritedOrImplementedMember);
					newResult.add(uri);
				}
			}
		}
	}

	return newResult;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:50,代码来源:N4JSReferenceQueryExecutor.java

示例7: doAdd

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected void doAdd(EObject object, TargetURIs targetURIs) {
	URI uri = EcoreUtil2.getPlatformResourceOrNormalizedURI(object);
	targetURIs.addURI(uri);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:TargetURICollector.java


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