Community
Participate
Working Groups
If you select somewhere in a comment which comes before the aspect declaration statement, for example, somewhere in the copyright statement, or class/aspect description, then the inplace xref view is empty. The xref view, however, shows the xrefs for the entire file. This is what the inplace version should show. The same also happens if you select outside of the final "}" of the aspect.
Currently the behaviour is the same for both the inplace and xref view. If you select anywhere which isn't a package statement, import statement, aspect/class declaration or inside the "{}" of the aspect/class then neither view has any contents.
The reason this is happening is partly due to the fix for bug 98319. In this case the call XRefUtils.getElementAt(..) returns null since the IJavaElement no longer exists (because in the case of bug 98319 there were compilation errors). However, in the case of this bug (96313) there also isn't an IJavaElement for the current selection.
Created attachment 26154 [details] patch containing fix for this bug This is a patch containing a fix for this bug. Apply directly to the XRefUIUtils file. Essentially it adds an extra check in the case where the IJavaElement for the given position is null. If there are compilation errors in the file then we return null, otherwise we assume that we're ok and can return anything in the file. Then, when we come to calculate the xrefs, we calculate them for the entire file.
Created attachment 26155 [details] visual test for this bug This contains a visual test for this bug.
I've added a patch and testcase to this bug rather than committing them because the fix is affected by bug 107005. In other words, we can't rely on the information coming out of <compilation unit>.getChildren() which causes a regression of bug 92895. If you save too quickly after fixing a compilation error then the aspect contents doesn't appear in the getChildren() call. This means that the xref views aren't populated correctly. Therefore, waiting to commit this fix until bug 107005 has been fixed.
Helen, can these patches now be applied?
I've applied the patches.....with minor changes to the visual test patch. The fix broke visual tests XReferenceViewBuildingTest.testLinkingDisabledAndUpdating4 XReferenceViewBuildingTest.testLinkingIsDisabledAndUpdatingOtherEditor2 However, this was because the tests assumed the contents of the xref view was empty until we navigated to the correct place (because the first selection was at the top of the file which until the fix for this bug was integrated, meant the xref view was empty). I've made a couple of changes to these tests to be more specific in what they're waiting for in the xref view. Note, that there may be other timing problems like these tests in other xref visual tests which don't show up on my machine. Waiting for clean builds of AJDT 1.2 and 1.3 before closing this bug.
fix available in AJDT 1.3: BUILD COMPLETE - build.181 Date of build: 11/10/2005 13:38:12 Time to build: 31 minutes 13 seconds Last changed: 11/10/2005 13:22:49 therefore, closing this bug.