Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323690

Summary: [call hierarchy] Refresh view when selection is empty
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: UIAssignee: Raksha Vasisht <raksha.vasisht>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.6Flags: markus.kell.r: review+
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch
markus.kell.r: review-
Screen shot of empty selection hierarchy viewer context menu
none
Patch update none

Description Marvin Fröhlich CLA 2010-08-26 05:35:14 EDT
Build Identifier: 20100617-1415

If I open the call hierarchy for a given method by placing the caret on the method and then pressing Ctrl+Alt+H, it can still happen, that the resulting tree is empty. In Eclipse 3.5 I could then simply press F5 3 or 4 times to refresh the tree until it show the actual result.

Now in 3.6 the call hierarchy refreshes only, if it is non-empty.

Pressing Ctrl+Alt+H again after the call hierarchy opened and the selection is on the requested method does it though. But F5 should also work, since I don'T have to worry about the selection then.

Reproducible: Always
Comment 1 Dani Megert CLA 2010-08-26 08:26:51 EDT
Can you please provide a concrete example.
Comment 2 Markus Keller CLA 2010-08-27 06:50:35 EDT
In 3.6, F5 was changed to refresh only the selected elements. To refresh the whole view, click "Refresh View" in the view toolbar.

Raksha, could you please enhance the behavior so that F5 refreshes the whole view when the selection is empty? That's what we also do in other views (e.g. Package Explorer). Make sure the action also shows up in the context menu.

Marvin, we would still be interested in steps to reproduce the empty call hierarchy view. That should never happen after you pressed Ctrl+Alt+H, and I've never seen that so far.
Comment 3 Marvin Fröhlich CLA 2010-08-27 11:25:29 EDT
There is no conrete example. It just happens occasonally every third or fourth time. This behavior exists since 3.3 or 3.4 (don't remember exactly) and on both Windows and Linux.

Maybe I am using the feature in a different way than you do. I use it the way, I described in my initial post.
Comment 4 Raksha Vasisht CLA 2010-08-31 03:03:49 EDT
Created attachment 177809 [details]
Patch

(In reply to comment #2)
> In 3.6, F5 was changed to refresh only the selected elements. To refresh the
> whole view, click "Refresh View" in the view toolbar.
> 
> Raksha, could you please enhance the behavior so that F5 refreshes the whole
> view when the selection is empty? That's what we also do in other views (e.g.
> Package Explorer). Make sure the action also shows up in the context menu.
> 
> Marvin, we would still be interested in steps to reproduce the empty call
> hierarchy view. That should never happen after you pressed Ctrl+Alt+H, and I've
> never seen that so far.

I have never seen this behavior either, even if I try to place the caret at various places, I could not reproduce the problem. I could somewhat test the fix by removing all the elements from the view and then refreshing the view to bring back the removed elements. But this can always be done by Refresh View action in the toolbar. However, I have enabled RefreshSingleElement (F5) action for empty selection in the context menu.

Marvin, could you attach some sample code where you see this behaviour?
Comment 5 Markus Keller CLA 2010-08-31 10:51:58 EDT
Comment on attachment 177809 [details]
Patch

This patch only enables the action in the location pane, and only if something is selected in the main pane.

Please make sure F5 and the context menu item are enabled in all cases where the selection is empty in any pane.
Comment 6 Raksha Vasisht CLA 2010-09-01 15:53:55 EDT
(In reply to comment #5)
> (From update of attachment 177809 [details] [diff])
> This patch only enables the action in the location pane, and only if something
> is selected in the main pane.
> 
> Please make sure F5 and the context menu item are enabled in all cases where
> the selection is empty in any pane.

For me it works with empty selection on either of the panes.. this is how I tested it:

1) invoke CH on some method 
2) remove it from the view (right click -> Remove from View)
3) right click on empty hierarchy viewer or empty location viewer 
=> I see F5 active on both panes and refreshes the view. Am I missing something?
Comment 7 Raksha Vasisht CLA 2010-09-01 15:57:57 EDT
Created attachment 178002 [details]
Screen shot of empty selection hierarchy viewer context menu

Here I see 'Refresh F5' action and it brings back all the removed elements. Similarly in location pane as well.
Comment 8 Markus Keller CLA 2010-09-02 05:31:01 EDT
Seems to work when the whole view is empty, but does not work when the *selection* is empty (e.g. Ctrl+Click the selected element).
Comment 9 Marvin Fröhlich CLA 2010-09-02 07:40:15 EDT
I have a concrete code example, where the bug occurs. Though I believe, that this doesn't depend on the code, but can happen anywhere and depends on something else.

I downloaded the source code of the free version of http://www.javadocx.com and added it to our local SVN repository for easier distribution. I am using Subclipse.

It is one of the ugliest and most dilettantish pieces of source code, that I have ever seen, but I have to deal with it and it shows our eclipse bug.

In the class cCreateFontTable I put the caret on the method fGenerateFONT(String) somewhere at the center of the method name and pressed Shift+Ctrl+H. The call tree was empty and was filled after two or three refreshes.
Comment 10 Raksha Vasisht CLA 2010-09-02 10:01:07 EDT
Created attachment 178044 [details]
Patch update

(In reply to comment #8)
> Seems to work when the whole view is empty, but does not work when the
> *selection* is empty (e.g. Ctrl+Click the selected element).

Ah okay.. I was not aware of ctrl+click mechanism. Thanks Markus, I have made the corrections in the new patch.
Comment 11 Markus Keller CLA 2010-09-03 14:19:08 EDT
Raksha, can you please try to reproduce comment 9? (Without your patch.)
Comment 12 Markus Keller CLA 2010-09-08 14:49:44 EDT
(In reply to comment #10)
> Created an attachment (id=178044) [details] [diff]

Looks good.
Comment 13 Raksha Vasisht CLA 2010-09-09 10:51:41 EDT
(In reply to comment #11)
> Raksha, can you please try to reproduce comment 9? (Without your patch.)

I downloaded the javadocx code and still could not reproduce the problem :( I also dont see how this could happen in the code. Keeping this bug for enabling refresh action for empty selection. Marvin, if you still face the empty CH view issue and have concrete steps to reproduce, pls open a new bug.

(In reply to comment #12)
> (In reply to comment #10)
> > Created an attachment (id=178044) [details] [diff] [details] [diff]
> 
> Looks good.

Committed to HEAD.
Comment 14 Dani Megert CLA 2010-09-14 07:04:32 EDT
Verified in I20100914-0100.
Comment 15 Marvin Fröhlich CLA 2010-09-15 07:30:47 EDT
(In reply to comment #14)
> Verified in I20100914-0100.

Really? You verified the empty CH? How did you do it? And did you find a way to always reproduce it?
Comment 16 Dani Megert CLA 2010-09-15 07:44:55 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > Verified in I20100914-0100.
> 
> Really? You verified the empty CH? How did you do it? And did you find a way to
> always reproduce it?
What's the point of those questions? We fixed the refresh case but probably not your specific scenario as you were not able to provide the steps for it. What I verified is that refresh is triggered if the view is either empty or has no selection.