Community
Participate
Working Groups
I20031203 Now that we use jobs more often and can use IResources for fine grained looking we have the need to use IJavaElement as scheduling rules as well (especially in the upcoming refactoring processor/participant work).
Dirk - the best we could do is to provide a #getSchedulingRule() API on IJavaElement. We cannot simply have IJavaElement implement ISchedulingRule as it would not combine nicely with IResource implementation. Would this work for you still ? Alternatively, you could simply use #getResource () in most cases.
This would work for me as well. However I don't fully understand why this is easier for you given that getSchedulingRule doesn't return null.
It is easier because we don't control the IResource's implementation of ISchedulingRule. This implementation doesn't know about IJavaElement and thus would return false to contains(...) when the Java element is really contained in a resource. Thus the implementation of getSchedulingRule() will return an IResource in most cases (we will handle special cases where the element doesn't have a resource)
Added IJavaElement.getSchedulingRule() and added regression test JavaModelTests.getSchedulingRule1() to getSchedulingRule4()
Verified for 3.0M7