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

Bug 37512

Summary: Cleaning up ugly code: Turning FQN's into imports as appropriate
Product: [Eclipse Project] JDT Reporter: Missing name <analogue>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Missing name CLA 2003-05-12 14:19:05 EDT
It would be nice if Eclipse had a way to removed fully qualified class names 
from a source file by turning them into fully qualified import statements 
instead. Fully qualified class names littered throughout the souce have a way of 
making the source code look busy and unreadable IMO. Below you will find a 
before are after scenario. You may be thinking people don't code this way; let 
me assure you that they do and they've written millions of lines of code thats 
just asking for this feature to be added to Eclipse.




======================== BEFORE =================================


public void foo()


{


    javax.swing.Label label = new javax.swing.Label("Bar");


    label.setText(new java.lang.String("blah"));


    javax.swing.table.DefaultTableModel model = 


        new javax.swing.table.DefaultTableModel();


}


======================== AFTER =================================


import javax.swing.Label;


import javax.swing.table.DefaultTableModel;




public void foo()


{


    Label label = new Label("Bar");


    label.setText(new String("blah"));


    DefaultTableModel model = new DefaultTableModel();


}


===============================================================
Comment 1 Dirk Baeumer CLA 2003-05-13 04:36:58 EDT

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