diff options
author | Tor Norbye <tnorbye@google.com> | 2012-11-09 13:29:24 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-11-26 17:30:22 -0800 |
commit | a96737ef1ee717e322c87a8ef391440b2aaf03b6 (patch) | |
tree | 602b312ed80c22e7274b75e2df9a978049b4ca5d /eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout | |
parent | c88485c606173a591f15d7f24c4b37133ac24ac8 (diff) | |
download | sdk-a96737ef1ee717e322c87a8ef391440b2aaf03b6.zip sdk-a96737ef1ee717e322c87a8ef391440b2aaf03b6.tar.gz sdk-a96737ef1ee717e322c87a8ef391440b2aaf03b6.tar.bz2 |
Add resource renaming support
This changeset adds support for renaming resources.
There are several new hooks for initiating a resource rename:
(1) You can use the same keybinding as in Java files from XML files to
initiate refactoring; for example, place the caret somewhere in
@+id/foo or @string/bar and hit the refactoring keybinding, and a
rename resource refactoring dialog shows up.
(2) Invoking Quick Assistant in an XML file (Ctrl/Cmd 1) will offer to
rename the resource, if the caret is over a resource name.
(3) Renaming an XML or bitmap resource file, such as
res/drawable-hdpi/foo.png, will now initiate the same XML resource
naming machinery as above to update all resource references, plus
it will also update all the other versions of the same file
(e.g. in res/drawable-mdpi, res/drawable-xhdpi, etc.). Assuming an
R field exists (e.g. the project has been built), it will also
optionally update all Java field references.
(4) Invoking renaming in the layout editor (via the rename keybinding,
or via the context menu, or via the property sheet's "..." button)
will also initiate id resource refactoring. Editing the id
directly in the inline editor for the id will pop up a dialog
asking whether to update references as well, along with a "Do not
ask again" checkbox.
(5) Finally, there is a renaming participant registered which will
discover whether an R field is renamed, so if you go and rename
R.layout.foo from Java, this will also kick in all of the above
machinery - renaming layout files, updating resource references,
etc.
If the renamed resource is in a library project, the refactoring
will also look at all the including projects and offer to update
references there as well.
Finally, this CL goes and fixes a few bugs in the existing refactoring
operations; in particular, making sure that they not only look at
files in layout/ but in all folder configurations containing layout
files. It also adds refactoring unit tests.
Change-Id: Ie88511a571b414fdc5be048e781fe29a34063cbf
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java index f006ba9..d0d2cd2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/LayoutTestBase.java @@ -353,6 +353,12 @@ public class LayoutTestBase extends TestCase { fail("Not supported in tests yet"); return null; } + + @Override + public boolean rename(INode node) { + fail("Not supported in tests yet"); + return false; + } } public void testDummy() { |