Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Refactor/move
Refactor/move [message #174918] Wed, 25 August 2004 04:40 Go to next message
Eclipse UserFriend
Originally posted by: peter_no_spam_.thisisciberus.dk

Hi

I have a couple of questions about renaming and moving packages in Eclipse
3.0.

If I "rename" a package, for example: rename "dk.pk.mypack" to
"dk.pk.anotherpack", then the only thing that happens is that a new empty
package "dk.pk.anotherpack" is created (and the original "dk.pk.mypack"
stays as it is). Is this behaviour by design?

Is it possible to move entire package structures to elsewhere in the
project? For example, if I have "dk.pk.mypack.subpack", how do I move
"subpack" to "dk.pk.anotherpack", so I end with "dk.pk.anotherpack.subpack"?
When I try to drag "subpack" to "anotherpack" I cannot drop it, and neither
can I do this via the menu "refactor->move".

Thanks,
Peter
Re: Refactor/move [message #174954 is a reply to message #174918] Wed, 25 August 2004 05:47 Go to previous message
Eclipse UserFriend
Peter Kirk wrote:
> If I "rename" a package, for example: rename "dk.pk.mypack" to
> "dk.pk.anotherpack", then the only thing that happens is that a new empty
> package "dk.pk.anotherpack" is created (and the original "dk.pk.mypack"
> stays as it is). Is this behaviour by design?
>
> Is it possible to move entire package structures to elsewhere in the
> project? For example, if I have "dk.pk.mypack.subpack", how do I move
> "subpack" to "dk.pk.anotherpack", so I end with "dk.pk.anotherpack.subpack"?
> When I try to drag "subpack" to "anotherpack" I cannot drop it, and neither
> can I do this via the menu "refactor->move".

The problem here is that packages are not hierarchical in Java, i.e.
dk.pk.mypack.subpack is *not* a "subpackage" of dk.pk.mypack, even though
one package name is a prefix of the other one.

I assume that you wanted to rename the empty package dk.pk.mypack and all
subpackages. This is currently not supported (see the enhancement request
for hierarchical package renaming:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=39260 ). Renaming an empty
package indeed just creates a folder with the new name.

What you can do, is to rename individual packages (e.g. rename
dk.pk.mypack.subpack to dk.pk.anotherpack.subpack). Again, since packages
are not hierarchical, you cannot move one package into another. You can only
move them to another source folder.

Markus
Previous Topic:Newbie Question-Eclipse can't compile
Next Topic:build file visible in package explorer
Goto Forum:
  


Current Time: Tue Jul 15 14:51:10 EDT 2025

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

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

Back to the top