Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Refactoring broken?(Can't refactor location of class attributes to another class)
Refactoring broken? [message #502301] Mon, 07 December 2009 16:04 Go to next message
alexandra  is currently offline alexandra
Messages: 2
Registered: December 2009
Junior Member
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
Re: Refactoring broken? [message #502343 is a reply to message #502301] Mon, 07 December 2009 18:36 Go to previous messageGo to next message
Del Myers is currently offline Del Myers
Messages: 82
Registered: July 2009
Member
You would probably get a better response to this question if you posted to the
eclipse.tools.jdt newsgroup.

Del

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
Re: Refactoring broken? [message #502402 is a reply to message #502301] Tue, 08 December 2009 01:34 Go to previous messageGo to next message
Walter Harley is currently offline 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.
Re: Refactoring broken? [message #502476 is a reply to message #502402] Tue, 08 December 2009 13:16 Go to previous message
Alexandra Stehman is currently offline Alexandra Stehman
Messages: 8
Registered: July 2009
Junior Member
Thank you! I didn't even think to try this.

(In previous versions I think the behavior was different?)

Alexx
Previous Topic:Error opening schema via link in PDE
Next Topic:Change presentation dynamically
Goto Forum:
  


Current Time: Tue Sep 30 19:54:27 GMT 2014

Powered by FUDForum. Page generated in 0.03593 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software