Bug 25822 - "Organize Imports" becomes unusable...
Summary: "Organize Imports" becomes unusable...
Status: RESOLVED DUPLICATE of bug 25875
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-07 09:07 EST by Xavier CLA
Modified: 2002-11-12 08:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier CLA 2002-11-07 09:07:04 EST
I just tried moving from build 2.0.1 (200208291828) to 2.1 (200210181211) and I 
had the surprise that when I do "Organize Imports" on my code the imports are 
now exploded (because they are longer than 80 cars):

Example, the following import statement:
import 
com.xxxxxx.yyyyy.zzzzzzzcenter.ui.administration.data.model.communication.Commun
icationManager;

becomes:
import com
    .xxxxxx
    .yyyyy
    .zzzzzzzcenter
    .ui
    .administration
    .data
    .model
    .communication
    .CommunicationManager;

This was not the behaviour in 2.0.1, the import was not exploded like that and 
it was perfect !

What do you think of that ?
Did I miss something ?

Thank you,
Xavier Donat.
Comment 1 Dani Megert CLA 2002-11-07 10:57:09 EST
As far as I can see nothing exploded, it simply formatted your code and wrapped
the imports.

You might figure out that there's a preference for this:
Window->Preferences->Java->Code Formatter->Line Splitting
Comment 2 Xavier CLA 2002-11-08 03:17:22 EST
Thank you for considering my request.
I was 99% sure you were going to answer that the line splitting
was not a bug but a feature ;-)

My comment on that is that the formatting should not be applied
when calling "Organize Imports". It should be done only when the
user chooses to "Format" the code.

This would allow the user to choose whether to apply line splitting
on imports or not. Give the choice to the user is VERY important.

The other thing that disturbs me is the way the import are split.
The "Rolls Royce" would be to have the choice between two king of
split:
- the current one (split before each dot)
- the following one:
import com.xxxxxx.yyyyy.zzzzzzzcenter.ui.administration.data.model
    .communication.CommunicationManager;

Once again the idea is to let the user choose.

Thank you,
Xavier Donat
Comment 3 Dani Megert CLA 2002-11-08 03:43:52 EST
Martin,

as you remember I also stumbled across this. I suggest you add a preference to
the "Organize Import" preference page:
[ ] Use Code Formatter

Note: The same option is available for templates:
Comment 4 Xavier CLA 2002-11-08 03:58:43 EST
This would be great !
Comment 5 Martin Aeschlimann CLA 2002-11-12 08:17:08 EST
I prefer this would be done by the formatter. If not, I remove the feature and 
do no formatting on imports.

*** This bug has been marked as a duplicate of 25875 ***