Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Fixing imports
Fixing imports [message #252947] Wed, 23 April 2008 18:31 Go to next message
Eclipse UserFriend
Originally posted by: amracna.vocollect.com

Can anyone point me to the implementation of copy/paste for the JDT? When
pasting a method into a .java file, any type references that are not
declared in the imports but are found on the classpath are automatically
added to the imports. I am generating code and basically need to add a
method to a class. When I add the new IMethod, I also need to be able to
add imports automatically for the types in the method I am adding that are
not already being imported. Copy/Paste does this in the UI and so I'd like
to review that implementation to see how to integrate this capability into
my plugin. Any help is greatly appreciated.
Re: Fixing imports [message #252971 is a reply to message #252947] Thu, 24 April 2008 05:32 Go to previous messageGo to next message
Eclipse UserFriend
Alex Mracna wrote:
> Can anyone point me to the implementation of copy/paste for the JDT?
> When pasting a method into a .java file, any type references that are
> not declared in the imports but are found on the classpath are
> automatically added to the imports. I am generating code and basically
> need to add a method to a class. When I add the new IMethod, I also
> need to be able to add imports automatically for the types in the
> method I am adding that are not already being imported. Copy/Paste
> does this in the UI and so I'd like to review that implementation to
> see how to integrate this capability into my plugin. Any help is
> greatly appreciated.
Copy/paste does not generate the imports. It puts the imports into the
clipboard when copying. The following might help you:
org.eclipse.jdt.core.dom.rewrite.ImportRewrite.

Dani
Re: Fixing imports [message #252974 is a reply to message #252971] Thu, 24 April 2008 10:03 Go to previous message
Eclipse UserFriend
Originally posted by: amracna.vocollect.com

Thanks Daniel. I appreciate the help. That looks exactly like what I was
looking for.
Previous Topic:java parser
Next Topic:How to register a Error Marker for java editor?
Goto Forum:
  


Current Time: Sun Jun 01 21:11:30 EDT 2025

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

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

Back to the top