diff options
author | Tor Norbye <tnorbye@google.com> | 2014-05-20 20:21:34 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-05-21 18:05:07 -0700 |
commit | 446ab3bd70206f5f43d6314daeb6263cf8b7e738 (patch) | |
tree | efca718ab7e6b285c8c55596e1e1d2c288d5c067 /android/testData/rename | |
parent | e3e9f8f651ac5600f833013f5f7b088850f314d5 (diff) | |
download | idea-446ab3bd70206f5f43d6314daeb6263cf8b7e738.tar.gz |
Handle id property edits as renaming, and fix @+id resolution
This changeset fixes two problems related to id attributes:
- First, it fixes the handling of inline id declarations, such as
android:labelFor="@+id/user_name", such that the @+id attribute is
handled correctly as both a declaration as well as a reference --
and in particular go to declaration will work from that reference
now, and similarly find usages and resource renaming will properly
update it.
- Second, it improves the handling of the id attributes in the layout
editor. First, the id property now has a custom property editor
which hides the @+id/ prefix when rendering and editing the
property, and which puts it back after a new value has been edited.
Also, *if* an id is being edited and there are references to this
id, not just within the current layout but for example from an
activity class, then the IDE will pop up a yes/no dialog asking the
user whether they want to just change this definition of the id, or
to treat it as a refactoring where all usages are updated as
well. This fixes several bugs filed against the layout editor where
users complained that they changed an id and didn't expect it to
update references. (The previous implementation always updated
usages, but only usages within the current layout and not for
example from activity code, which could lead to uncompileable
projects). The Yes/No dialog also has a "Do not ask me again this
session" checkbox so that you don't have to keep getting asked if
you are changing multiple items and you know you want one type of
behavior in general.
Change-Id: I1f7f42f8d3819099fac7448231961b171d70d52a
Diffstat (limited to 'android/testData/rename')
-rw-r--r-- | android/testData/rename/layout15.xml | 29 | ||||
-rw-r--r-- | android/testData/rename/layout15_after.xml | 29 |
2 files changed, 58 insertions, 0 deletions
diff --git a/android/testData/rename/layout15.xml b/android/testData/rename/layout15.xml new file mode 100644 index 00000000000..c329db8b869 --- /dev/null +++ b/android/testData/rename/layout15.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + tools:ignore="HardcodedText"> + + <TextView + android:id="@+id/first" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="First" /> + + <Button + android:id="@+id/se<caret>cond" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/first" + android:text="Second" /> + + <TextView + android:id="@+id/textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/second" + android:labelFor="@id/second" + android:text="Third" /> +</RelativeLayout> diff --git a/android/testData/rename/layout15_after.xml b/android/testData/rename/layout15_after.xml new file mode 100644 index 00000000000..512cc73773f --- /dev/null +++ b/android/testData/rename/layout15_after.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + tools:ignore="HardcodedText"> + + <TextView + android:id="@+id/first" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="First" /> + + <Button + android:id="newname" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/first" + android:text="Second" /> + + <TextView + android:id="@+id/textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/newname" + android:labelFor="@id/newname" + android:text="Third" /> +</RelativeLayout> |