Project: JDT
Bug 80909 ReorgMove reorders members on drag'n'drop to another member [reorg]
Reported: 2004-12-14 03:58:09 | Status: resolved fixed

I200412081200, probably introduced with rev. 1.53 of ReorgPolicyFactory. I thought we had a testcase for this, but obviously we don't (or a wrong one). class Source { int field1; int field2; int field3; void method1() {} void method2() {} } class Target { int targetField; } Select all members of Source in the Outline and drag them onto targetField. Expected: Members are inserted into Target in the original order. Was: Members order is reversed. Works correctly when dropping onto the type Target. The easiest fix is probably to reverse the for-loop over javaElements in ReorgPolicyFactory.CopySubCuElementsPolicy#createChange(..) and ReorgPolicyFactory.MoveSubCuElementsPolicy#createChange(..).

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java