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

Bug 231440

Summary: [render] Hide prefix of package names in package explorer
Product: [Eclipse Project] JDT Reporter: Markus Gaisbauer <markus.gaisbauer>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: deepakazad, martinae, remy.suen
Version: 3.4Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Markus Gaisbauer CLA 2008-05-10 13:53:02 EDT
Package names can already be abbreviated by abbreviating all parts of the name.

I propose to add an option to completely hide a prefix.

Example
===============================================
Prefix: "com.company.product"

Original: "com.company.product"
Abbreviated: "."

Original: "com.company.product.componentA"
Abbreviated: "componentA"

Original: "com.company.product.componentA.packageA"
Abbreviated: "componentA.packageA"
Comment 1 Remy Suen CLA 2008-05-10 14:49:59 EDT
There is actually a similar functionality in JDT that might meet your needs.

1. Window > Preferences > Java > Appearance
2. Configure 'Compress all package name segments, except the final segment'.
Comment 2 Markus Gaisbauer CLA 2008-05-10 17:17:06 EDT
Thanks. I know about the "Compress all package name segments, except the final segment" feature. However, if I am not mistaken, I can't use this to express something like the proposed feature.

Maybe we could even use normal regular expressions instead of those compression patterns: 

Original: "org.eclipse.jdt"

Abbreviated: "..jdt"
Compression pattern: "."
Regexp: "/[^.]+\././"

Abbreviated: "jdt"
Compression pattern: "0"
Regexp: "/[^.]+\.//"

Abbreviated: "org~.ecl~.jdt"
Compression pattern: "3~"
Regexp: "/([^.]{3})[^.]*\./$1~./"

Abbreviated: "eclipse.jdt"
Compression pattern: ?
Regexp: "/^org.//"
Comment 3 Martin Aeschlimann CLA 2008-05-13 06:58:37 EDT
This is not an area with priority to us. Help in the form of a simple patch would be most welcome.
Comment 4 Deepak Azad CLA 2010-06-04 05:45:29 EDT
(In reply to comment #0)
> I propose to add an option to completely hide a prefix.
> 
> Example
> ===============================================
> Prefix: "com.company.product"
> 
> Original: "com.company.product"
> Abbreviated: "."
> 
> Original: "com.company.product.componentA"
> Abbreviated: "componentA"
> 
> Original: "com.company.product.componentA.packageA"
> Abbreviated: "componentA.packageA"

This can be done now with the new 'Abbreviate Package names' feature with a rule like
"com.company.product="
(note that the right hand side is blank)