This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes source > add import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "source > add import" Watch "source > add import" New topic
Author

source > add import

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
Hi,
is there anyway, where when i add a CLASS TYPE eclipse automatically loads the class in the import statement ie. suppose i added (ResultSet set = stmt.executeQuery()), i want Eclipse to add ResultSet class automatically in the import statement. I tried to add missing import statement by going to source > add import but it didnt do anything, do i have to setup anything before i can use this property.

pls help.
Thanks
aziz dhanani.
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Hi,


suppose i added (ResultSet set = stmt.executeQuery()), i want Eclipse to add ResultSet class automatically in the import statement.


When you write ResultSet, instead write java.sql.ResultSet, I mean, when you type . after java, you should see a popup from where you can select another interface or class, here you will select sql and then type . and again you should see another popup to select ResultSet. After this last selection, you should see ResultSet import statement and ResultSet without its qualified name.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
If I remember correctly, "add import" only adds an import for the class your text cursor is positioned in. To add imports for all classes in the current editor, use "organize imports" (ctrl-shift-o).


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: source > add import
 
Similar Threads
JDBC Eclipse mySQL
importing packages
servlets and xml
Puzzled
ThreadPoolExecutor.DiscardPolicy cannot be resolved