Refactor a class programatically [message #197656] |
Fri, 04 March 2005 15:46  |
Eclipse User |
|
|
|
I want to be able to refactor a java class programmatically, and this could
consist of both moving the class to a different package and renaming the
class.
I've figured out how to get the ICompilationUnit from the IFile object, and
I see that there is a move function on the ICompilationUnit object.
The first argument is an IJavaElement container, which I assume is the new
package. Do I have to create this package first, or will it be created as
part of the move operation? If I have to create the package first, how do I
do that?
|
|
|
Re: Refactor a class programatically [message #197827 is a reply to message #197656] |
Mon, 07 March 2005 10:02  |
Eclipse User |
|
|
|
Yes, the package fragment has to exist before the move. You can create
it using IPackageFragmentRoot#createPackageFragment(...)
Jerome
Shawn L. Pecze wrote:
> I want to be able to refactor a java class programmatically, and this could
> consist of both moving the class to a different package and renaming the
> class.
>
> I've figured out how to get the ICompilationUnit from the IFile object, and
> I see that there is a move function on the ICompilationUnit object.
>
> The first argument is an IJavaElement container, which I assume is the new
> package. Do I have to create this package first, or will it be created as
> part of the move operation? If I have to create the package first, how do I
> do that?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03543 seconds