本文整理汇总了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;
}
示例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;
}
});
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例7: doAdd
import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected void doAdd(EObject object, TargetURIs targetURIs) {
URI uri = EcoreUtil2.getPlatformResourceOrNormalizedURI(object);
targetURIs.addURI(uri);
}