Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325103

Summary: [reorg] Copy & Paste a package with subpackages
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: annanyearian, markus.kell.r
Version: 3.6Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Marvin Fröhlich CLA 2010-09-13 07:40:02 EDT
Build Identifier: 20100617-1415

When I select a certain package and press Ctrl+C, then select a completely different package and press Ctrl+V, I expect the package with all its contents (of course including sub packages) to be pasted into this package. So

select "com.mycomp.p1" (containing some classes and sub packages)
press Ctrl+C
select "com.mycomp.p2"
press Ctrl+V

Then there should be a new package "com.mycomp.p1.p2" containing a copy of all the contents of the original "com.mycomp.p1".

What actually happens is, that regardless of the second selection, Eclipse wants to insert the copy by the original name and because of the naturally generated conflict asks me t o type a new name and suggests "com.mycomp.p1.copy".

It would be nice, if this behavior was changed to the expected one or at least there was a preferences setting.

Reproducible: Always
Comment 1 Markus Keller CLA 2010-09-14 05:35:39 EDT
We won't choose the new name automatically, but I agree that the proposed name could be improved in this situation.

But in your example, you're pasting p1 into p2, so the proposed name should be "com.mycomp.p2.p1" (not ...p1.p2). In general:
"<destination_package_name>.<source_package_name_without_common_prefix>".

A good quality patch would speed up the resolution of this bug. See org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory.NewNameProposer.createNewName(IPackageFragment, IPackageFragmentRoot).
Comment 2 Marvin Fröhlich CLA 2010-09-14 07:43:10 EDT
You're right about "com.mycomp.p2.p1".

I will see, if I can find the time to checkout the eclipse source and provide a patch.
Comment 3 Eclipse Genie CLA 2020-06-14 14:36:38 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Marvin Fröhlich CLA 2020-06-15 00:45:45 EDT
Nothing has changed here. Bug still persists.
Comment 5 Eclipse Genie CLA 2022-06-10 15:19:28 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Annan Yearian CLA 2022-12-15 04:06:19 EST
Nothing has changed here. Bug still persists.