aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2010-11-23 10:27:45 -0800
committerAndroid Code Review <code-review@android.com>2010-11-23 10:27:45 -0800
commit7f4453b2612d3af04cceccac1fd3c492fe740cb0 (patch)
treee9744ee965e6f89130d7a0552b3c5e780a7028d8 /eclipse/plugins/com.android.ide.eclipse.adt/src/com
parentce78f1d3018ba4a4c3d70413359323caecd43d1c (diff)
parentc4f75630aa293ec4027216ae0bfd2d9e6782e209 (diff)
downloadsdk-7f4453b2612d3af04cceccac1fd3c492fe740cb0.zip
sdk-7f4453b2612d3af04cceccac1fd3c492fe740cb0.tar.gz
sdk-7f4453b2612d3af04cceccac1fd3c492fe740cb0.tar.bz2
Merge "Fix live manipulation of <include> elements"
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java26
2 files changed, 23 insertions, 5 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java
index 500c8ba..2021533 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java
@@ -314,7 +314,7 @@ public final class LayoutDescriptors implements IDescriptorProvider {
// Create the include descriptor
ViewElementDescriptor desc = new ViewElementDescriptor(xml_name, // xml_name
xml_name, // ui_name
- null, // canonical class name, we don't have one
+ VIEW_INCLUDE, // "class name"; the GLE only treats this as an element tag
"Lets you statically include XML layouts inside other XML layouts.", // tooltip
null, // sdk_url
attributes.toArray(new AttributeDescriptor[attributes.size()]),
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
index a78da12..b57901f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
@@ -1370,10 +1370,16 @@ public class UiElementNode implements IPropertySource {
// Add or replace an attribute
Document doc = element.getOwnerDocument();
if (doc != null) {
- Attr attr = doc.createAttributeNS(attrNsUri, attrLocalName);
+ Attr attr;
+ if (attrNsUri != null && attrNsUri.length() > 0) {
+ attr = doc.createAttributeNS(attrNsUri, attrLocalName);
+ attr.setPrefix(lookupNamespacePrefix(element, attrNsUri));
+ attrMap.setNamedItemNS(attr);
+ } else {
+ attr = doc.createAttribute(attrLocalName);
+ attrMap.setNamedItem(attr);
+ }
attr.setValue(newValue);
- attr.setPrefix(lookupNamespacePrefix(element, attrNsUri));
- attrMap.setNamedItemNS(attr);
return true;
}
}
@@ -1529,8 +1535,11 @@ public class UiElementNode implements IPropertySource {
// Try with all internal attributes
UiAttributeNode uiAttr = setInternalAttrValue(
getInternalUiAttributes().values(), attrXmlName, attrNsUri, value, override);
+ if (uiAttr != null) {
+ return uiAttr;
+ }
- // Look at existing unknown (aka custom) attributes
+ // Look at existing unknown (a.k.a. custom) attributes
uiAttr = setInternalAttrValue(
getUnknownUiAttributes(), attrXmlName, attrNsUri, value, override);
@@ -1539,6 +1548,7 @@ public class UiElementNode implements IPropertySource {
// in which case we just create a new custom one.
uiAttr = addUnknownAttribute(attrXmlName, attrXmlName, attrNsUri);
+ // FIXME: The will create the attribute, but not actually set the value on it...
}
return uiAttr;
@@ -1550,6 +1560,14 @@ public class UiElementNode implements IPropertySource {
String attrNsUri,
String value,
boolean override) {
+
+ // For namespace less attributes (like the "layout" attribute of an <include> tag
+ // we may be passed "" as the namespace (during an attribute copy), and it
+ // should really be null instead.
+ if (attrNsUri != null && attrNsUri.length() == 0) {
+ attrNsUri = null;
+ }
+
for (UiAttributeNode uiAttr : attributes) {
AttributeDescriptor uiDesc = uiAttr.getDescriptor();