This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 242739 - Hide common package prefix
Summary: Hide common package prefix
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 8.0
Hardware: PC Linux
: P4 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 242740 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-03-10 12:34 UTC by rveldpau
Modified: 2017-01-04 19:35 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rveldpau 2014-03-10 12:34:03 UTC
Often when working on a Java project there is a chain of package identifiers that don't provide any use to navigation since they are common to all packages. For example, I can work a project for my company, which in our standards we also include our division, so every package starts with
   com.mycompany.division
So my product package would be
   com.mycompany.division.product

In navigation the "com.mycompany.division" provides no benefit, since every package starts with it (arguably, within the context of the project, product provides no benefit either); in fact "com.mycompany.division" decreases usability by forcing users to scroll right to see the full package names. Instead of the following list in navigation:
 - com.mycompany.division.product.packagea
 - com.mycompany.division.product.packagea.packageb
 - com.mycompany.division.product.packagea.packagec
 - com.mycompany.division.product.packaged
 - com.mycompany.division.product.packaged.packagee.packagef
I would prefer to see
 - ...product.packagea
 - ...product.packagea.packageb
 - ...product.packagea.packagec
 - ...product.packaged
 - ...product.packaged.packagee.packagef

The ellipses would indicates that there is more to the package.

I think there's two ways to go about implementing this enhancement.

1) Automatically determine which packages have members and don't show any common packages that share common names with all packages and no members. The problem with this approach is that if you enable it by default it will undoubtedly confuse users. Secondly, when you're first creating a project this could be confusing as it might automatically collapse things that you don't expect, just because you're in the middle of creation.

2) Create a project option to specify the part of the package name you would like to hide. The downside of this approach is that the user has to know about the option and because of that it's usage would be limited. It also requires more work for the user, but is the safer option for a user experience point of view.
Comment 1 Jiri Prox 2014-03-10 12:36:30 UTC
Have you tried Reduced View mode in the project view? (right click at free space in project view and select View Java Packages As -> Reduced Tree)
Comment 2 Jiri Prox 2014-03-10 12:37:31 UTC
*** Bug 242740 has been marked as a duplicate of this bug. ***
Comment 3 rveldpau 2014-03-10 12:44:57 UTC
The reduced tree can be used, but either shows too much, or too little.

For example, if I have the following packages and classes

com.mycompany.division.product.packagea
com.mycompany.division.product.packageb
com.mycompany.division.product.packageb.packagec
com.mycompany.division.product.packageb.packaged
com.mycompany.division.product.packageb.Class1
com.mycompany.division.product.packageb.Class2
com.mycompany.division.product.packageb.Class3

If you the reduced tree and expand so I can see all the packages I would have to expand packageb which would mean I also see the Classes in navigation. If I did not want to see those classes I would also not see the packagec or packaged.

So, in this case, just to have it clarified, when collapsed I would want to see:

...product.packagea
...product.packageb
...product.packageb.packagec
...product.packageb.packaged
Comment 4 markiewb 2015-03-28 11:45:43 UTC
FYI: See also
https://netbeans.org/bugzilla/show_bug.cgi?id=201404#c2
(-J-Dorg.netbeans.spi.java.project.support.ui.packageView.TRUNCATE_PACKAGE_NAMES=true)