aboutsummaryrefslogtreecommitdiffstats
path: root/rule_api
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-04-04 18:41:06 -0700
committerTor Norbye <tnorbye@google.com>2012-04-05 11:41:36 -0700
commit9bd06947302ca6ca3e0b90eef894e553c6c3e067 (patch)
tree0a3b6a6f1f0b137906da6e45b3d439bab55e8c73 /rule_api
parent60b85b4ced380973f627a5882b4faae0771f0d0b (diff)
downloadsdk-9bd06947302ca6ca3e0b90eef894e553c6c3e067.zip
sdk-9bd06947302ca6ca3e0b90eef894e553c6c3e067.tar.gz
sdk-9bd06947302ca6ca3e0b90eef894e553c6c3e067.tar.bz2
Add support for the WindowBuilder Property Sheet
This reverts commit 27dac06bfc4297dc9a018edc534f44ecf96cd724. Change-Id: I6708bd4091f0cb677484669479357d479b9db5fa
Diffstat (limited to 'rule_api')
-rw-r--r--rule_api/src/com/android/ide/common/api/IAttributeInfo.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
index 7fd253c..997eeb4 100644
--- a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
+++ b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java
@@ -18,6 +18,7 @@ package com.android.ide.common.api;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
+import com.android.resources.ResourceType;
import com.google.common.annotations.Beta;
import java.util.EnumSet;
@@ -90,6 +91,39 @@ public interface IAttributeInfo {
return EnumSet.of(this);
}
}
+
+ /** Returns the corresponding resource type for this attribute info,
+ * or null if there is no known or corresponding resource type (such as for
+ * enums and flags)
+ *
+ * @return the corresponding resource type, or null
+ */
+ @Nullable
+ public ResourceType getResourceType() {
+ switch (this) {
+ case STRING:
+ return ResourceType.STRING;
+ case BOOLEAN:
+ return ResourceType.BOOL;
+ case COLOR:
+ return ResourceType.COLOR;
+ case DIMENSION:
+ return ResourceType.DIMEN;
+ case FRACTION:
+ return ResourceType.FRACTION;
+ case INTEGER:
+ return ResourceType.INTEGER;
+
+ // No direct corresponding resource type
+ case ENUM:
+ case FLAG:
+ case FLOAT:
+ case REFERENCE:
+ return null;
+ }
+
+ return null;
+ }
}
/** Returns the XML Name of the attribute */