|
|
Re: Refactoring broken? [message #502402 is a reply to message #502301] |
Tue, 08 December 2009 01:34 |
Walter Harley Messages: 847 Registered: July 2009 |
Senior Member |
|
|
alexandra wrote:
> I have several string class attributes I'd like to move to a different
> class. However, when I highlight the attribute (in the source file),
> select Refactor->Move, then select a class in the SAME PACKAGE, Eclipse
> reports "the selected element cannot be the destination for this
> operation" (ReorgPolicyFactory_doesnotexist0).
> I never had problems refactoring the locations of attributes between
> classes before (and there is absolutely nothing special about these two).
>
> Is this a bug?
>
> Eclipse Galileo
> Windows XP SP3
> Java version 1.6.0_07
Adding 'eclipse.tools.jdt' to newsgroup list, and setting followup-to.
I can reproduce what I think you're seeing.
I create a new Java project;
add a new package p and new classes p.A and p.B;
add a public String x1 to p.A;
and then highlight x1 and select Refactor -> Move.
When I click B.java, I see an error message saying "The selected element cannot
be the destination for this operation."
However, if I expand the B.java item, under it I see sub-items for the package p
and for the class B. If I select the *class* B, I am able to refactor successfully.
Note that B.java can contain multiple top-level declarations, including multiple
class declarations (though only one of them can be "class B"). So in a sense,
what it's saying is true; you can't move a field into the top level of a .java
file, that is, outside the scope of a class.
But in the 95% likely case, where the .java file contains only a single
top-level class, the intent is very clear and I think this is a usability bug.
I didn't see anything about it in Bugzilla, so you might want to enter a
Bugzilla feature request.
I didn't check to see whether this is a regression, i.e., whether it worked
differently in previous releases.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03280 seconds