Reputation: 9825
I know that Eclipse working sets are very flexible and customizable. They are made of elements which implement IAdaptable
Which can be anything. However, in many (most) cases, working sets are used to define a set of resources.
In case these elements can be seen as resources (e.g. IJavaProject
), is there a universal (or formal) way to programatically translate these elements to resources?
Eventually, I need to determine whether a given resource is in a working set, so an answer in that direction is acceptable as well.
Upvotes: 1
Views: 133
Reputation: 1473
Unfortunately I don't think there's any way around the IAdaptable
route. You can do something like this, given an IWorkingSet ws
:
List<IResource> resources = new ArrayList(); // or LinkedList
for (IAdaptable adaptable: ws.getElements()) {
IResource r = (IResource) adaptable.getAdapter(IResource.class);
if (r != null) resources.add(r);
}
Upvotes: 1