Bug 96313 - Empty inplace xref when select a comment which comes before the aspect declaration
Summary: Empty inplace xref when select a comment which comes before the aspect declar...
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 1.2.0 RC1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.2.1   Edit
Assignee: Helen Beeken CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 107005
Blocks:
  Show dependency tree
 
Reported: 2005-05-23 11:36 EDT by Helen Beeken CLA
Modified: 2012-04-03 14:05 EDT (History)
0 users

See Also:


Attachments
patch containing fix for this bug (5.95 KB, patch)
2005-08-16 12:01 EDT, Helen Beeken CLA
andrew.eisenberg: iplog+
Details | Diff
visual test for this bug (8.91 KB, patch)
2005-08-16 12:02 EDT, Helen Beeken CLA
andrew.eisenberg: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helen Beeken CLA 2005-05-23 11:36:18 EDT
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.
Comment 1 Helen Beeken CLA 2005-08-12 09:39:40 EDT
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.
Comment 2 Helen Beeken CLA 2005-08-15 06:53:00 EDT
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. 
Comment 3 Helen Beeken CLA 2005-08-16 12:01:52 EDT
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.
Comment 4 Helen Beeken CLA 2005-08-16 12:02:38 EDT
Created attachment 26155 [details]
visual test for this bug

This contains a visual test for this bug.
Comment 5 Helen Beeken CLA 2005-08-16 12:06:47 EDT
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.
Comment 6 Matt Chapman CLA 2005-11-07 09:58:20 EST
Helen, can these patches now be applied?
Comment 7 Helen Beeken CLA 2005-11-10 11:23:34 EST
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.
Comment 8 Helen Beeken CLA 2005-11-10 11:28:42 EST
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.