aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common/src/com/android
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-03-18 11:31:26 -0700
committerTor Norbye <tnorbye@google.com>2011-03-21 12:58:36 -0700
commit141d3be93d5d0840220cb3f92d87c67711a2bf7e (patch)
treee9d0ba600ee211848a35d256e2a8f0d9d5b18969 /ide_common/src/com/android
parent4c05d86f44fd52c93eeff59a11a5595413233c63 (diff)
downloadsdk-141d3be93d5d0840220cb3f92d87c67711a2bf7e.zip
sdk-141d3be93d5d0840220cb3f92d87c67711a2bf7e.tar.gz
sdk-141d3be93d5d0840220cb3f92d87c67711a2bf7e.tar.bz2
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
Diffstat (limited to 'ide_common/src/com/android')
-rw-r--r--ide_common/src/com/android/ide/common/resources/ResourceResolver.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
index 9493c35..e3c93b7 100644
--- a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
+++ b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
@@ -29,11 +29,11 @@ import java.util.Map;
public class ResourceResolver extends RenderResources {
private final static String REFERENCE_STYLE = ResourceType.STYLE.getName() + "/";
- private final static String PREFIX_ANDROID_RESOURCE_REF = "@android:";
- private final static String PREFIX_RESOURCE_REF = "@";
- private final static String PREFIX_ANDROID_THEME_REF = "?android:";
- private final static String PREFIX_THEME_REF = "?";
- private final static String PREFIX_ANDROID = "android:";
+ public final static String PREFIX_ANDROID_RESOURCE_REF = "@android:";
+ public final static String PREFIX_RESOURCE_REF = "@";
+ public final static String PREFIX_ANDROID_THEME_REF = "?android:";
+ public final static String PREFIX_THEME_REF = "?";
+ public final static String PREFIX_ANDROID = "android:";
private final Map<ResourceType, Map<String, ResourceValue>> mProjectResources;