public Iterable<IEObjectDescription> apply(IResourceDescription from) { return from.getExportedObjects(); } }));
protected Collection<QualifiedName> getImportedNames(IResourceDescription candidate) { return Sets.newHashSet(candidate.getImportedNames()); }
public CopiedResourceDescription(IResourceDescription original) { this.uri = original.getURI(); this.exported = ImmutableList.copyOf(Iterables.transform(original.getExportedObjects(), new Function<IEObjectDescription, IEObjectDescription>() { public IEObjectDescription apply(IEObjectDescription from) { if (from.getEObjectOrProxy().eIsProxy()) { return from; } InternalEObject result = (InternalEObject) EcoreUtil.create(from.getEClass()); result.eSetProxyURI(from.getEObjectURI()); Map<String, String> userData = null; for (final String key : from.getUserDataKeys()) { if (userData == null) { userData = Maps.newHashMapWithExpectedSize(2); } userData.put(key, from.getUserData(key)); } return EObjectDescription.create(from.getName(), result, userData); } })); }
/** * Collect the URIs of resources, that are referenced by the given description. * @return the list of referenced URIs. Never <code>null</code>. */ public Set<URI> collectOutgoingReferences(IResourceDescription description) { URI resourceURI = description.getURI(); Set<URI> result = null; for(IReferenceDescription reference: description.getReferenceDescriptions()) { URI targetResource = reference.getTargetEObjectUri().trimFragment(); if (!resourceURI.equals(targetResource)) { if (result == null) result = Sets.newHashSet(targetResource); else result.add(targetResource); } } if (result != null) return result; return Collections.emptySet(); }
@Override public void findReferencesInDescription(final TargetURIs targetURIs, final IResourceDescription resourceDescription, final IReferenceFinder.IResourceAccess resourceAccess, final IReferenceFinder.Acceptor acceptor, final IProgressMonitor monitor) { if ((resourceAccess == null)) { return; } final Set<QualifiedName> names = this.declarators.getDeclaratorData(targetURIs, resourceAccess).getDeclaratorNames(); boolean _isCanceled = monitor.isCanceled(); if (_isCanceled) { throw new OperationCanceledException(); } final Set<QualifiedName> importedNames = IterableExtensions.<QualifiedName>toSet(resourceDescription.getImportedNames()); final Function1<QualifiedName, Boolean> _function = (QualifiedName it) -> { return Boolean.valueOf(importedNames.contains(it)); }; boolean _exists = IterableExtensions.<QualifiedName>exists(names, _function); if (_exists) { final IUnitOfWork<Object, ResourceSet> _function_1 = (ResourceSet it) -> { this.findReferences(targetURIs, it.getResource(resourceDescription.getURI(), true), acceptor, monitor); return null; }; resourceAccess.<Object>readOnly(resourceDescription.getURI(), _function_1); } }
public Iterable<IReferenceDescription> getReferenceDescriptions() { // find references was triggered - use up-to-date reference descriptions // the content of this copied description is updated as soon as the exported // objects of a resource change thus the default algorithm of the find // references UI for the display string should work IResourceDescription snapShot = snapShotProvider.get(); if (snapShot != null) return snapShot.getReferenceDescriptions(); return Collections.emptyList(); }
@Override public Iterable<IEObjectDescription> getExportedObjectsByObject(EObject object) { URI resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(object).trimFragment(); IResourceDescription description = getResourceDescription(resourceURI); if (description == null) return Collections.emptyList(); return description.getExportedObjectsByObject(object); }
@Override public Iterable<IEObjectDescription> getExportedObjectsByType(EClass type) { Iterable<IEObjectDescription> added = description.getExportedObjectsByType(type); Iterable<IEObjectDescription> delegated = delegate.getExportedObjectsByType(type); return Iterables.concat(added, delegated); }
for (Iterator<ReferenceSearchViewTreeNode> i = rootNodes.iterator(); i.hasNext();) { ReferenceSearchViewTreeNode rootNode = i.next(); if (((IResourceDescription) rootNode.getDescription()).getURI().equals(delta.getUri())) { if (delta.getNew() == null) { i.remove(); } else { Iterable<IReferenceDescription> newReferenceDescriptions = delta.getNew() .getReferenceDescriptions(); List<ReferenceSearchViewTreeNode> removedReferenceNodes = Lists.newArrayList(); for (ReferenceSearchViewTreeNode referenceNode : rootNode.getChildren()) {
public static void copyReferenceDescriptions(IResourceDescription from, ResourceDescriptionImpl result) { Iterator<IReferenceDescription> sourceReferenceDescriptions = from.getReferenceDescriptions().iterator(); if (sourceReferenceDescriptions.hasNext()) { InternalEList<IReferenceDescription> targetReferenceDescriptions = (InternalEList<IReferenceDescription>) result.getReferenceDescriptions(); do { targetReferenceDescriptions.addUnique(BuilderStateUtil.create(sourceReferenceDescriptions.next())); } while(sourceReferenceDescriptions.hasNext()); } }
@Override public Iterable<IEObjectDescription> getExportedObjectsByObject(final EObject object) { URI resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(object).trimFragment(); IResourceDescription description = getResourceDescription(resourceURI); if (description == null) return Collections.emptyList(); return description.getExportedObjectsByObject(object); }
public Iterable<IEObjectDescription> apply(IDirtyResource from) { if (from != null) return from.getDescription().getExportedObjectsByType(type); return Collections.emptyList(); } }));
public URI apply(IResourceDescription from) { return from.getURI(); } }
public Iterable<IEObjectDescription> apply(IResourceDescription from) { if (from != null) { return from.getExportedObjects(type, qualifiedName, ignoreCase); } return Collections.emptyList(); } }));
public Iterable<QualifiedName> getImportedNames() { IResourceDescription snapShot = snapShotProvider.get(); if (snapShot != null) return snapShot.getImportedNames(); return Collections.emptyList(); }
/** * @since 2.4 */ public void findReferences(Set<URI> targetURIs, IResourceDescription resourceDescription, IAcceptor<IReferenceDescription> acceptor, IProgressMonitor monitor, ILocalResourceAccess localResourceAccess) { for (IReferenceDescription referenceDescription : resourceDescription.getReferenceDescriptions()) { if (targetURIs.contains(referenceDescription.getTargetEObjectUri())) { acceptor.accept(referenceDescription); } } } }
public Iterable<IEObjectDescription> getExportedObjectsByObject(EObject object) { URI resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(object).trimFragment(); IDirtyResource dirtyResource = getDirtyResource(resourceURI); if (dirtyResource != null) { return dirtyResource.getDescription().getExportedObjectsByObject(object); } return Collections.emptyList(); }
public URI apply(IResourceDescription from) { return from.getURI(); } });
private boolean isFiltered(QualifiedName name) { Iterable<IEObjectDescription> exportedObjects = filterDescription.getExportedObjects(TypesPackage.Literals.JVM_TYPE, name, false); return !Iterables.isEmpty(exportedObjects); }