Is it possible to copy packages?

If I select a package in the project window, the Refactor | Copy menu item is disabled.

Similarly, if I select more than one class in the project window, Copy is disabled.

So, is it possible to copy a package, or multiple classes, in IDEA?

8 comments

Haven't tried copying packages, but you can copy multiple files: select
them all (with shift/control+mouse click) and then invoke the copy
command.

0

I think you can copy files, but you can't copy Java classes.

0

I copy java classes (files) all the time.

The refactoring is smart enough to rename every reference in code of
the old class name inside the copied file to the new class name.

It isn't smart enough to do the same in text/comments.

0

Sorry - I should have said that you can't copy multiple Java classes.
i.e. if you select multiple Java classes in the Project window, Copy is disabled.

0

if you select multiple Java classes in the Project
window, Copy is disabled.


Ah, you're right. Hadn't noticed it. Cut is enabled but Copy is
disabled.

I wonder why copy is disabled? I see no problem in copying multiple
files from one package to another.

0

Probably because you would get the new name dialog multiple times, which
might be a bit confusing?

Just a thought,
Andrei

I wonder why copy is disabled? I see no problem in copying multiple
files from one package to another.

>


0

Normally copy paste should call ur attention that if u really need inheritance or something like that. I think that might be 1 of the reasons they do not supply such a function.

0

Andrei Oprea wrote:

Probably because you would get the new name dialog multiple times,
which might be a bit confusing?


While copying multiple files to a different package, there would be no
name asking ;)

But I agree that copying multiple files mantaining the same names is
not done very often so this being disabled is no great thing.

0

Please sign in to leave a comment.