diff options
author | Tor Norbye <tnorbye@google.com> | 2012-11-26 13:14:13 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-11-26 13:14:13 -0800 |
commit | 00c724b87b61fb575d7b0f7e0fcdc1fd22848ef8 (patch) | |
tree | 03b931abc872d9db4c4611b7683e60f3d39a0972 /eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java | |
parent | fd3fb3d73dec09585c52a310019095877c2b2167 (diff) | |
download | sdk-00c724b87b61fb575d7b0f7e0fcdc1fd22848ef8.tar.gz |
40368: Support a root vertical LinearLayout in graphical editor
Change-Id: I7b156f1f8b8f939f9f940962e50c34595b9fa3b7
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java index 4b6b803b8..6f8aef37f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java @@ -19,6 +19,7 @@ package com.android.ide.eclipse.adt.internal.editors.layout.gle2; import com.android.SdkConstants; import com.android.annotations.NonNull; import com.android.annotations.Nullable; +import com.android.ide.common.api.IDragElement.IDragAttribute; import com.android.ide.common.api.INode; import com.android.ide.common.api.Margins; import com.android.ide.common.api.Point; @@ -1579,16 +1580,16 @@ public class LayoutCanvas extends Canvas { * This is invoked by * {@link MoveGesture#drop(org.eclipse.swt.dnd.DropTargetEvent)}. * - * @param rootFqcn A non-null non-empty FQCN that must match an existing - * {@link ViewElementDescriptor} to add as root to the current - * empty XML document. + * @param root A non-null descriptor of the root element to create. */ - void createDocumentRoot(String rootFqcn) { + void createDocumentRoot(final @NonNull SimpleElement root) { + String rootFqcn = root.getFqcn(); // Need a valid empty document to create the new root final UiDocumentNode uiDoc = mEditorDelegate.getUiRootNode(); if (uiDoc == null || uiDoc.getUiChildren().size() > 0) { - debugPrintf("Failed to create document root for %1$s: document is not empty", rootFqcn); + debugPrintf("Failed to create document root for %1$s: document is not empty", + rootFqcn); return; } @@ -1620,6 +1621,16 @@ public class LayoutCanvas extends Canvas { SdkConstants.NS_RESOURCES, true /*override*/); + IDragAttribute[] attributes = root.getAttributes(); + if (attributes != null) { + for (IDragAttribute attribute : attributes) { + String uri = attribute.getUri(); + String name = attribute.getName(); + String value = attribute.getValue(); + uiNew.setAttributeValue(name, uri, value, false /*override*/); + } + } + // Adjust the attributes DescriptorsUtils.setDefaultLayoutAttributes(uiNew, false /*updateLayout*/); |