Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to config import-updating when refactor/paste/type to "package.*" instead of "pac(code style)
icon5.gif  How to config import-updating when refactor/paste/type to "package.*" instead of "pac [message #659907] Wed, 16 March 2011 04:19 Go to next message
Liu Yan is currently offline Liu Yan
Messages: 6
Registered: March 2011
Location: China
Junior Member
Hi everyone:

When editing(typing, pasting, refactoring) Java code, Eclipse can automatically update import, it's very convenient, but the code style is not what I wanted, I'd like all import statement seems like this:
import java.io.*;
import java.util.*;


not the heavy
import java.io.File;
import java.io.IOException;
import java.io.InputSteam;
import java.io.OutputSteam;
//...

import java.util.List;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
// ....

I know import package.* CAN cause class name collision (java.util.Date vs java.sql.Date), but it's not a big deal, and it can be easily handled.

Is there a way to configure this?
Re: How to config import-updating when refactor/paste/type to "package.*" instead of " [message #659911 is a reply to message #659907] Wed, 16 March 2011 06:06 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam Kandula
Messages: 444
Registered: July 2009
Senior Member
Go to Preferences->Java Code Style->Organize Imports and for "Number of imports needed for .*", use 1.
icon14.gif  Re: How to config import-updating when refactor/paste/type to "package.*" instead of & [message #660148 is a reply to message #659911] Thu, 17 March 2011 04:35 Go to previous message
Liu Yan is currently offline Liu Yan
Messages: 6
Registered: March 2011
Location: China
Junior Member
Satyam Kandula wrote on Wed, 16 March 2011 14:06
Go to Preferences->Java Code Style->Organize Imports and for "Number of imports needed for .*", use 1.

Thank you Satyam!

I've noticed this config before, but I misunderstood it, I thought it's "max lines of import statements". oh my poor English... Dead
Previous Topic:how to use a refactoring function in my Java program
Next Topic:What is the "Javadoc command"?
Goto Forum:
  


Current Time: Sun Oct 26 08:49:42 GMT 2014

Powered by FUDForum. Page generated in 0.01705 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software