This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 44269 - Copy&Paste doesn't change package declaration
Summary: Copy&Paste doesn't change package declaration
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2004-06-03 11:03 UTC by Lukas Hasik
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Hasik 2004-06-03 11:03:13 UTC
[200406021800]

Copy class from one package to another package.

Package declaration isn't changed (as it was
before refactoring merge) 
It isn't possible to easily copy classes between
packages...
Comment 1 Lukas Hasik 2004-06-14 15:35:08 UTC
explorer or java issue?
Comment 2 Marian Mirilovic 2004-06-14 15:46:59 UTC
.. same result after rename class file ....

This is very anooying, especially if you've wroked with NB3.6 or
earlier, where after renaming classfile constructors within class are
renamed too.
Comment 3 Jan Becicka 2004-06-14 18:31:37 UTC
Lukasi: Why should copy/paste of files change it's contents?
Try Refactoring | Move Class if you want to move class to another package.

Mariane: You want to say, that you tried to rename java file and
Rename Refactoring was not invoked? It is a bug, but it works for me.

Comment 4 Lukas Hasik 2004-06-15 16:08:10 UTC
It used to change package declaration after Copy&Paste in 3.6
I'd expect this behaviour even in 4.0.
I don't want to 'Move' the class I want copy it...

'Rename' is different story - try rename on package, it definitely
doesn't works for me
Comment 5 Jan Becicka 2004-06-15 16:24:56 UTC
What about competitive IDEs? Do they change package declarations after
copy/paste?

Changing package declaration after copy paste is not implementation
problem. I can do it. But it will have significant performance impact.
All copy/pasted files would have to be parsed.

Do you have a use case, that this functionality is needed?

According to rename: please file an issue.
Comment 6 Lukas Hasik 2004-06-15 17:05:13 UTC
I don't know how it should behave - probably it should be covered be
some UI spec but as longtime netbeans user I noticed that it behaves
differently, well and I filled bug (and REGRESSION)

I really don't know how the others IDE treat to copy&pasting.

And the best solution ? From my point of view it could be a dialog
(like after cut&paste=move class) asking 'Do you wanna change package
declaration' after pasting of class... But probably we need HIE decision.
Comment 7 Marian Mirilovic 2004-06-16 14:28:05 UTC
Honza ,
I filed separate issue for rename action , see issue 44999 ....
Comment 8 Martin Matula 2004-06-16 20:04:41 UTC
Guys, I don't think this is P1. Workaround exists and the rename issue
is also a P2. Originally, not changing the package declaration was
intentional, since it most likely does not make the code compilable
anyway (there may be some broken references, etc.) - so it is a
pseudo-refactoring and we considered it of a low value. Since this was
not properly communicated with the community, we probably have to
implement it so there is no regression. But I am lowering the priority
to P2.
Comment 9 Jan Becicka 2004-06-17 08:33:36 UTC
Fixed.

Checking in JavaDataObject.java;
/cvs/java/src/org/netbeans/modules/java/JavaDataObject.java,v  <-- 
JavaDataObject.java
new revision: 1.181; previous revision: 1.180
done
Comment 10 Lukas Hasik 2004-06-23 13:52:07 UTC
it works in 200406230100

verified