diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index 558ac9b3fd29..a0a4c86c87ae 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -272,12 +272,12 @@ public class PropertyParser { if (margin != null) { List children = margin.getChildren(null); - children.add(PropertyTable.extractProperty(properties, "marginLeft")); - children.add(PropertyTable.extractProperty(properties, "marginTop")); - children.add(PropertyTable.extractProperty(properties, "marginRight")); - children.add(PropertyTable.extractProperty(properties, "marginBottom")); - children.add(PropertyTable.extractProperty(properties, "marginStart")); - children.add(PropertyTable.extractProperty(properties, "marginEnd")); + PropertyTable.moveProperty(properties, "marginLeft", children, -1); + PropertyTable.moveProperty(properties, "marginTop", children, -1); + PropertyTable.moveProperty(properties, "marginRight", children, -1); + PropertyTable.moveProperty(properties, "marginBottom", children, -1); + PropertyTable.moveProperty(properties, "marginStart", children, -1); + PropertyTable.moveProperty(properties, "marginEnd", children, -1); if (model != null) { for (Property child : children) { @@ -303,10 +303,10 @@ public class PropertyParser { } }); - PropertyTable.top(properties, "layout:margin"); - PropertyTable.top(properties, "layout:gravity"); - PropertyTable.top(properties, "layout:height"); - PropertyTable.top(properties, "layout:width"); + PropertyTable.moveProperty(properties, "layout:margin", properties, 0); + PropertyTable.moveProperty(properties, "layout:gravity", properties, 0); + PropertyTable.moveProperty(properties, "layout:height", properties, 0); + PropertyTable.moveProperty(properties, "layout:width", properties, 0); } } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java index 7a354b1088ac..5e3dadfe3df4 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java @@ -371,10 +371,15 @@ public final class PropertyTable extends JBTable implements ComponentSelectionLi return -1; } - public static void top(List properties, String name) { - Property property = extractProperty(properties, name); + public static void moveProperty(List source, String name, List destination, int index) { + Property property = extractProperty(source, name); if (property != null) { - properties.add(0, property); + if (index == -1) { + destination.add(property); + } + else { + destination.add(index, property); + } } }