Community
Participate
Working Groups
We have many usecases where we need only the direct Resources in Scope of an object, but the transitive hull. (E.g., if we have project dependencies A->B->C) and we want "allResourcesInScope" on A, it should return all resources from A, B and C. (not only A and B). We have a helper class draft, but it might make sense to put something like this in ScopingResourceSet? (Helper class operates on IProject, please adjust to your needs). public static List<Resource> getAllResourcesInScope(IProject project) { TransactionalEditingDomain editingDomain = SphinxUtil.getEditingDomain(project); // Not needed if moving to Scoping Resource Set ResourceSet resourceSet = editingDomain.getResourceSet(); if (resourceSet instanceof ScopingResourceSet) { ScopingResourceSet srs = (ScopingResourceSet) resourceSet; LinkedHashSet<Resource> hashSet = new LinkedHashSet<Resource>(srs.getResourcesInScope(project)); boolean modified = true; while(modified) { modified = false; List<Resource> nextRun = new ArrayList<Resource>(); for(Resource r : hashSet ) { nextRun.addAll(srs.getResourcesInScope(r)); } modified = hashSet.addAll(nextRun); } return new ArrayList<Resource>(hashSet); } else { return resourceSet.getResources(); } }
another small contribution (in attachement), is a content tree iterator that takes scoping into account.
Created attachment 251681 [details] ScopingAwareContentTreeIterator An implementation of a content tree iterator that is aware of the (transitive) scopes.
Closed stale issue before migration