use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class OpenCallHierarchyHandler method createHierarchyBuilder.
@Override
protected IHierarchyBuilder createHierarchyBuilder(final EObject target) {
final ArithmeticsCallHierarchyBuilder xtextCallHierarchyBuilder = this._iGlobalServiceProvider.<ArithmeticsCallHierarchyBuilder>findService(target, ArithmeticsCallHierarchyBuilder.class);
xtextCallHierarchyBuilder.setResourceAccess(this.resourceAccess);
xtextCallHierarchyBuilder.setIndexData(this._iGlobalServiceProvider.<IResourceDescriptions>findService(target, IResourceDescriptions.class));
final DeferredHierarchyBuilder deferredHierarchyBuilder = this._iGlobalServiceProvider.<DeferredHierarchyBuilder>findService(target, DeferredHierarchyBuilder.class);
deferredHierarchyBuilder.setHierarchyBuilder(xtextCallHierarchyBuilder);
return deferredHierarchyBuilder;
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class WorkingCopyOwnerProvider method getWorkingCopyOwner.
@Override
public WorkingCopyOwner getWorkingCopyOwner(final IJavaProject javaProject, final ResourceSet resourceSet) {
return new WorkingCopyOwner() {
@Override
public String findSource(String typeName, String packageName) {
if (packageName.startsWith("java"))
return super.findSource(typeName, packageName);
QualifiedName qn = toQualifiedName(packageName, typeName);
final IResourceDescriptions descriptions = descriptionsProvider.getResourceDescriptions(resourceSet);
Iterator<IEObjectDescription> exportedObjects = descriptions.getExportedObjects(TypesPackage.Literals.JVM_DECLARED_TYPE, qn, false).iterator();
while (exportedObjects.hasNext()) {
IEObjectDescription candidate = exportedObjects.next();
URI uri = candidate.getEObjectURI();
if (uri.isPlatformResource() && URI.decode(uri.segment(1)).equals(javaProject.getElementName())) {
IResourceDescription resourceDescription = descriptions.getResourceDescription(uri.trimFragment());
return getSource(typeName, packageName, candidate, resourceSet, resourceDescription);
}
}
return super.findSource(typeName, packageName);
}
/**
* not implemented because we don't have a proper index for Java package names and the very rare cases in which this would
* cause trouble are not worth the general degrade in performance.
*/
@Override
public boolean isPackage(String[] pkg) {
return super.isPackage(pkg);
}
};
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class QueryParticipant method createSearchHelper.
protected JavaSearchHelper createSearchHelper(ISearchRequestor requestor) {
JavaSearchHelper searchHelper = javaSearchHelperProvider.get();
IResourceDescriptions descriptionsToSearch = resourceDescriptionsProvider.get();
if (descriptionsToSearch.isEmpty()) {
waitForBuild();
descriptionsToSearch = resourceDescriptionsProvider.get();
}
searchHelper.init(requestor, descriptionsToSearch);
return searchHelper;
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class AbstractScopeResourceDescriptionsTest method assertExportedObject.
protected void assertExportedObject(Resource resource, String name) {
IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider.getResourceDescriptions(resource);
IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(resource.getURI());
assertNotNull(resourceDescription);
QualifiedName qname = QualifiedName.create(name);
assertFalse(isEmpty(resourceDescription.getExportedObjects(EcorePackage.Literals.EOBJECT, qname, false)));
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class OpenCallHierarchyHandler method createHierarchyBuilder.
@Override
protected IHierarchyBuilder createHierarchyBuilder(final EObject target) {
final XtextCallHierarchyBuilder xtextCallHierarchyBuilder = this._iGlobalServiceProvider.<XtextCallHierarchyBuilder>findService(target, XtextCallHierarchyBuilder.class);
xtextCallHierarchyBuilder.setResourceAccess(this.resourceAccess);
xtextCallHierarchyBuilder.setIndexData(this._iGlobalServiceProvider.<IResourceDescriptions>findService(target, IResourceDescriptions.class));
final DeferredHierarchyBuilder deferredHierarchyBuilder = this._iGlobalServiceProvider.<DeferredHierarchyBuilder>findService(target, DeferredHierarchyBuilder.class);
deferredHierarchyBuilder.setHierarchyBuilder(xtextCallHierarchyBuilder);
return deferredHierarchyBuilder;
}
Aggregations