Is there way for extracting string resources in Android project in IntelliJ IDE?
Asked Answered
G

3

15

When I'm working on Android project I would like to use some magic shortcut that would extract my string to strings.xml and also allow me to change the key. Is there any?

If there isn't, is there a way to develop new refactorization methods and extend IntelliJ possibilities?

Gean answered 21/8, 2011 at 21:7 Comment(0)
R
21

Alt+Enter (to invoke intention action menu) on a string, then use Add a string resource action from the menu.

To rename resource use Refactor | Rename while standing on a resource name in Java code, it will rename all the references and the resource itself.

Ret answered 23/8, 2011 at 11:30 Comment(2)
In layout files it works a bit different, you specify new resource name, it gets highlighted in red and there is an intention to create the resource. Extracting string to resource from the layout will be supported in the future updates.Ret
@MichalLevý, here is the feature planned for IDEA 11.1: youtrack.jetbrains.net/issue/IDEA-63248Ret
T
0

There is the Eclipse's option: Source / Externalize strings, which externalizes the strings of a class into a .properties file, but it does not seem to be able to export them directly to strings.xml in the Android way.

Therewith answered 27/8, 2011 at 18:17 Comment(1)
Oh, yes, there is a way: envyandroid.com/archives/261/…Therewith
A
0

If you're using eclipse, you can highlight the string you want extracted to strings.xml, press Alt + Shift + A and in the small pop-up on the lower right of the screen select "Extract Android String"

Axle answered 10/7, 2012 at 10:21 Comment(1)
Yes, but the OP is asking how to do this in IntelliJMaynardmayne

© 2022 - 2024 — McMap. All rights reserved.