aboutsummaryrefslogtreecommitdiff
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-08-15 16:38:30 -0700
committerTor Norbye <tnorbye@google.com>2011-08-19 16:43:08 -0700
commite287bc8580e19d72a911615475b353790cf000eb (patch)
treeb9fa61fcb0b68f29fdd56359b84bb37aa815c4ab /eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java
parent39f953c53d4388044afdac63629e260b0a1ddce5 (diff)
downloadsdk-e287bc8580e19d72a911615475b353790cf000eb.tar.gz
Layout editor property menu improvements
This changeset adds two forms of view attribute metadata: * First, it records the most commonly used attributes for each view. This was determined by gathering statistics on as many layout files as I could find and then picking those that are used 10% or more. * Second, it records in the attribute metadata which View defines a given attribute. The context menu uses the above information to present the available attributes in several ways: * In the top level menu, where we had "Edit ID", and if applicable "Edit Text", it now lists the top attributes instead. For example, for a RatingBar the first handful of menu options are "Edit ID...", "Edit NumStars...", "Edit StepSize...", "Edit Style..." and "IsIndicator" (a boolean pull-right menu). Incidentally this automatically handles some cases which were manually handled before, so the code in LinearLayoutRule to add an "Orientation" menu is no longer needed; it's just one of the two common attributes handled by the new attribute list. * The "Properties" menu is now called "Other Properties", and instead of showing all properties, it has a new level of menus: * "Recent". This is initially empty, but as you edit other attributes, it gets populated (in most recently used order, kept up to date) with recently edited properties. * One submenu for each defining View super class listing exactly the attributes defined by that view. This is useful for browsing and editing related attributes. If you are looking at a textual view like a Button for example, you can look at the "TextView" menu to find all the text related options (TextColor, TextSize, etc). These menus are listed from the nearest to the further superclass, so for example if you right click on a CalendarView you'll see these menus: Recent > ---------------------------- Defined by CalendarView > Inherited from FrameLayout > Inherited from ViewGroup > Inherited from View > ---------------------------- Layout Parameters > ---------------------------- All By Name > * As you can see from the above, there are two more menus below the inherited menu items. "Layout Parameters" lists all the layout parameters available for the selected nodes (which is defined not by the view itself but the view that it is contained within). And finally there is "All By Name", which is a complete menu containing all available attributes for the view (and this is what the Properties menu used to contain). * The code which computes a display name from an attribute was also tweaked to capitalize not just the first letter but any first word letter, so for example when you look at the possible values for Gravity you now see "Clip Vertical" instead of "Clip vertical". * The edit property dialog for the properties menus now uses @string or @style resource choosers for the text, hint and style attributes (used to just be a plain text box.) Change-Id: I3b30d48b85fd13f0190c760756bf383a47b3f4a5
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java
index 6f58656ef..a761a0ec9 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/resources/platform/AttributeInfo.java
@@ -38,6 +38,8 @@ public class AttributeInfo implements IAttributeInfo {
private String mJavaDoc;
/** Documentation for deprecated attributes. Null if not deprecated. */
private String mDeprecatedDoc;
+ /** The source class defining this attribute */
+ private String mDefinedBy;
/**
* @param name The XML Name of the attribute
@@ -117,4 +119,26 @@ public class AttributeInfo implements IAttributeInfo {
public void setDeprecatedDoc(String deprecatedDoc) {
mDeprecatedDoc = deprecatedDoc;
}
+
+ /**
+ * Sets the name of the class (fully qualified class name) which defined
+ * this attribute
+ *
+ * @param definedBy the name of the class (fully qualified class name) which
+ * defined this attribute
+ */
+ public void setDefinedBy(String definedBy) {
+ mDefinedBy = definedBy;
+ }
+
+ /**
+ * Returns the name of the class (fully qualified class name) which defined
+ * this attribute
+ *
+ * @return the name of the class (fully qualified class name) which defined
+ * this attribute
+ */
+ public String getDefinedBy() {
+ return mDefinedBy;
+ }
}