OSDN Git Service

Add go to declaration support for styles and embedded text
authorTor Norbye <tnorbye@google.com>
Fri, 18 Mar 2011 18:31:26 +0000 (11:31 -0700)
committerTor Norbye <tnorbye@google.com>
Mon, 21 Mar 2011 19:58:36 +0000 (12:58 -0700)
commit141d3be93d5d0840220cb3f92d87c67711a2bf7e
treee9d0ba600ee211848a35d256e2a8f0d9d5b18969
parent4c05d86f44fd52c93eeff59a11a5595413233c63
Add go to declaration support for styles and embedded text

This changeset adds support to the Go To Declaration code for styles.
Style strings are a bit different from resource URLs - they can have
an @android: prefix, but they don't specify a resource type.  For
example, go to declaration can now jump to the value in the parent
attribute:

   <style name="BrowserTheme" parent="@android:Theme.Black">

This will show the Theme.Black style definition in the SDK's
styles.xml document.

In addition, the hyperlink resolver can now also link to fragments of
an attribute value. In particular, in the above, if you point anywhere
to the left of the ".", only the @android:Theme range will be
selected. This lets you go to parents, since styles inherit from other
styles by adding to them with dots.

Third, the hyperlink resolver can now link to resource urls that is in
the content part of XML documents (e.g. a text node, not an element
name or attribute value). As an example, you can now jump to the color
defined inside this style element:

    <style name="CustomTheme" parent="android:Theme.Light">
        <item name="android:bg">@color/custom_theme_color</item>
    </style>

Finally, this changeset adds unit/plugin tests for the hyperlink
resolver, which asserts the expected list of matches, and the expected
editor context when the default link is opened.

Change-Id: I73757ec78405f7c711e13387d0bb046f698799f1
23 files changed:
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiResourceAttributeNode.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/build/AaptQuickFixTest.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate10.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11a.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate11g.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/manifest-expected-navigate9a.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate1.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate12.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate2.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate3.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-navigate4.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate5.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate6.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate7.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles-expected-navigate8.txt [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigationstyles.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/xml/HyperlinksTest.java [deleted file]
ide_common/src/com/android/ide/common/resources/ResourceResolver.java