开发者

Android project Refactor greyed out

开发者 https://www.devze.com 2023-02-12 17:28 出处:网络
I renamed a project in Eclipse via \'Refactor > Rename\' as suggested in this answer. I now want to rename it again, but the Refactor menu has only one menu item now (Android > Extract Android String

I renamed a project in Eclipse via 'Refactor > Rename' as suggested in this answer.

I now want to rename it again, but the Refactor menu has only one menu item now (Android > Extract Android String...) which is also greyed out!

I am using Eclipse 3.6.1 with the latest Android SDK 9.

Why is that and how to I restore this to normal?

Update (1): After following Sankar Ganesh's suggestion (selecting a string), the Refactor menu appeared again. I then selected the Rename... menu item again and I received the following error message box:

Android project Refactor greyed out

This is much better than the previous situation, in which I had no idea why the Refactor menu had been disabled and what to do. Still, I don't understand why this is and what rules I should follow when using the Refactor function. I only wanted to rename a project... that's all. :)

Update (2): I just tried the same exact operation again again (Refactor > Rename while the project is selected in Project Explorer) and it worked! (without issuing the message box shown above).

What's going on?

Must be a bug, because this is开发者_运维知识库 clearly inconsistent.


I was wonder,why you struggling for Renaming a project, if you want to rename your project, then simply you can select your project, then click refactor menu, then Rename, that's it

step1:

Android project Refactor greyed out

Step2: Now see My project name is updated,initally it was friend finder, now friendfinderupdated

Android project Refactor greyed out

Also , you can use Extract Android String for Valid Java Identifiers and not for packages and files, because see window here

Android project Refactor greyed out


Pls select a String in your java code and do that Refactor -> Android -> Extract Android String, now you can see dialog, what i had shown below

Android project Refactor greyed out

and see next image

Android project Refactor greyed out


Mystery solved!

The problem turned out to be that I was trying to 'Refactor > Rename' while in the Resource perspective.

Once I switched to the Java perspective, this (inconsistent) behavior didn't repeat itself and I was even able to check the Update references checkbox.

Wow!

(thanks @Sankar Ganesh for posting the snapshots, because that allowed me to notice that there is an "Update references" checkbox and that the text on your caption bar is different than mine)

0

精彩评论

暂无评论...
验证码 换一张
取 消