aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2010-12-17 08:55:56 -0800
committerTor Norbye <tnorbye@google.com>2010-12-21 15:48:33 -0800
commita5d2bf173d15b74a6bcf57220c4e73b971bd09ab (patch)
tree54144bf77a04ae9f38f7da5ef8f44606681e7149 /eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
parent18284d7b4da35a990268f51cdab0abc3a8e6e061 (diff)
downloadsdk-a5d2bf173d15b74a6bcf57220c4e73b971bd09ab.zip
sdk-a5d2bf173d15b74a6bcf57220c4e73b971bd09ab.tar.gz
sdk-a5d2bf173d15b74a6bcf57220c4e73b971bd09ab.tar.bz2
Rewrite Outline drag & drop handler
Rewrite the drag source and drop target listeners for the Outline. The drop target listener now uses the SWT Tree support for drag & drop (such that you for example get drop position feedback lines between siblings). You can now drag items within the outline to do precise reordering, as well as target particular positions during drops, either within the outline or from the canvas or the palette. This changeset also fixes a number of other issues I ran into at the same time: - Fix keyboard shortcuts such that they map to the same context as the canvas (e.g. when you activate the outline it shows the same undo context as if you click in the associated canvas) - Fix a bug with context menu code when none of the options are selected in the XML - Fix selection dispatch. If you had two side by side canvases, selecting items in the Outline would show highlights in both canvases; it now only causes selection syncing with the associated canvas. Change-Id: I00c3c38fabf3711c826a3bc527356cbc77ad4a7e
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java31
1 files changed, 1 insertions, 30 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
index 995d206..c098e00 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
@@ -41,7 +41,6 @@ import com.android.ide.common.api.IViewMetadata.FillPreference;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
/**
* An {@link IViewRule} for android.widget.LinearLayout and all its derived
@@ -383,35 +382,7 @@ public class LinearLayoutRule extends BaseLayoutRule {
LinearDropData data = (LinearDropData) feedback.userData;
final int initialInsertPos = data.getInsertPos();
-
- // Collect IDs from dropped elements and remap them to new IDs
- // if this is a copy or from a different canvas.
- final Map<String, Pair<String, String>> idMap = getDropIdMap(targetNode, elements,
- feedback.isCopy || !feedback.sameCanvas);
-
- targetNode.editXml("Add elements to LinearLayout", new INodeHandler() {
-
- public void handle(INode node) {
- // Now write the new elements.
- int insertPos = initialInsertPos;
- for (IDragElement element : elements) {
- String fqcn = element.getFqcn();
-
- INode newChild = targetNode.insertChildAt(fqcn, insertPos);
-
- // insertPos==-1 means to insert at the end. Otherwise
- // increment the insertion position.
- if (insertPos >= 0) {
- insertPos++;
- }
-
- // Copy all the attributes, modifying them as needed.
- addAttributes(newChild, element, idMap, DEFAULT_ATTR_FILTER);
-
- addInnerElements(newChild, element, idMap);
- }
- }
- });
+ insertAt(targetNode, elements, feedback.isCopy || !feedback.sameCanvas, initialInsertPos);
}
@Override