Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325258 - [type hierarchy] Improve label rendering in Type Hierarchy
Summary: [type hierarchy] Improve label rendering in Type Hierarchy
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Raksha Vasisht CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 10:12 EDT by Deepak Azad CLA
Modified: 2010-10-26 08:11 EDT (History)
3 users (show)

See Also:


Attachments
project (2.58 KB, application/octet-stream)
2010-09-14 10:12 EDT, Deepak Azad CLA
no flags Details
Patch (2.89 KB, patch)
2010-09-16 03:32 EDT, Raksha Vasisht CLA
no flags Details | Diff
Patch (3.05 KB, patch)
2010-09-21 01:45 EDT, Raksha Vasisht CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2010-09-14 10:12:04 EDT
Created attachment 178833 [details]
project

Project structure

Test
-src1
---p
-----A.java
-src2
---p
-----B.java

- Use attached project or create one with the above structure
- Open 'Packages' view
- Open Type hierarchy view on package 'p'
=> the entry in history dropdown is - 'p - Test/src2'
It should either list all source folders the package is found in, or none at all.
Comment 1 Dani Megert CLA 2010-09-14 10:24:40 EDT
>It should either list all source folders the package is found in, or none at
>all.
Agreed. It should look like the label in the status line (see org.eclipse.jdt.internal.ui.browsing.PackagesView.StatusBarUpdater4LogicalPackage).
Comment 2 Markus Keller CLA 2010-09-15 15:14:29 EDT
That's a problem we already had before we supported multiple packages. I'll move this bug to M3. I would even close it as WONTFIX. Too many hacks for a contrived use case.
Comment 3 Dani Megert CLA 2010-09-16 02:38:49 EDT
>Too many hacks for a contrived use case.
Mmh, really? Shouldn't be that many: we only need to do this if all the selected elements are package fragments with the same name and project.
Comment 4 Raksha Vasisht CLA 2010-09-16 03:32:43 EDT
Created attachment 179002 [details]
Patch

(In reply to comment #3)
> >Too many hacks for a contrived use case.
> Mmh, really? Shouldn't be that many: we only need to do this if all the
> selected elements are package fragments with the same name and project.

Nope. The issue is when OTH is invoked on a LP selected from the packages view, it shows the fragments as separate input elements with different qualifiers and when one of them is selected from the PE and the OTH action is invoked, the label shows only that package fragment which cannot be verified as Logical Package easily.

Also the selections can be a LP and other elements in which case the packages forming the LP should be added only once and then label of the next element also needs to be added. 

I had a fix (written for M2) with not too many changes to existing code:
1) disable qualifiers for more than one selection or any selection of packages
2) if multi-selection, check for the packages with same name and project and add label only once
 
Could also be improved by adding special qualifier code only for LP showing all the parent paths.. but again checking whether 2 or more packages form a LP and that they could be anywhere in the selection is what would make too many hacks.
Comment 5 Dani Megert CLA 2010-09-16 04:13:42 EDT
>(In reply to comment #3)
>> >Too many hacks for a contrived use case.
>> Mmh, really? Shouldn't be that many: we only need to do this if all the
>> selected elements are package fragments with the same name and project.
>Nope.
Well I disagree. The only case we want to solve is the selection of a logical package. This can be easily detected. Also, the initial comment 0 is either wrong (not for 'Packages' view but for 'Package Explorer') or the code in HEAD is now different. In addition the rendering in the history menu differs from the history dialog which we definitely need to fix.
Comment 6 Dani Megert CLA 2010-09-16 04:14:24 EDT
We first have to figure out the scenarios and the expected result before we start to discuss how complex a solution is.
Comment 7 Dani Megert CLA 2010-09-16 07:00:21 EDT
We have the following problems which we should fix (nothing else):
1. In the case where we select a single package 'p' in the Package Explorer (PE)
   the Type Hierarchy (TH) shows the types for all packages 'p' in the same
   project. That's old behavior which we won't touch. However, in this case
   we only show the path for the selected package (same bug in 3.6). I think
   the simplest way to fix this is to move the code that collects the logical
   package from the THLifeCycle.createTypeHierarchy(...) to the OpenTHAction.
   This will make sure that all packages are part of the input for the TH and
   automatically rendered like any other multi-selection.

2. The labels in the history drop down and the history dialog don't match if
   more than one element is selected: the menu shows the path while the dialog 
   does not.
Comment 8 Dani Megert CLA 2010-09-16 07:02:42 EDT
Note that after fixing problem 1 from previous comment, it will also show 'p', 'p' in the view's description area, indicating to the user that two packages were used as input.
Comment 9 Raksha Vasisht CLA 2010-09-21 01:45:17 EDT
Created attachment 179291 [details]
Patch

(In reply to comment #7)
> We have the following problems which we should fix (nothing else):
> 1. In the case where we select a single package 'p' in the Package Explorer
> (PE)
>    the Type Hierarchy (TH) shows the types for all packages 'p' in the same
>    project. That's old behavior which we won't touch. However, in this case
>    we only show the path for the selected package (same bug in 3.6). I think
>    the simplest way to fix this is to move the code that collects the logical
>    package from the THLifeCycle.createTypeHierarchy(...) to the OpenTHAction.
>    This will make sure that all packages are part of the input for the TH and
>    automatically rendered like any other multi-selection.> 


Moved code that collects LP to OpenTypeHierarchyAction.java. Shows separate labels for each fragment of a LP everywhere.

> 2. The labels in the history drop down and the history dialog don't match if
>    more than one element is selected: the menu shows the path while the dialog 
>    does not.

Fixed with bug 325250.
Comment 10 Raksha Vasisht CLA 2010-09-21 01:46:29 EDT
.
Comment 11 Raksha Vasisht CLA 2010-09-21 01:47:51 EDT
> Created an attachment (id=179291) [details] [diff]
> Patch
Patch committed to HEAD.
Comment 12 Rajesh CLA 2010-10-26 08:11:39 EDT
Verified in I20101025-1800.