From c8b3f5d9b2b15ecb5059460e557bcd88eb821917 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Sun, 22 Apr 2012 19:52:29 +0400 Subject: [PATCH] Tree selection --- .../componentTree/TreeEditableArea.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeEditableArea.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeEditableArea.java index e1d546084779..2911bb720fb3 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeEditableArea.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/componentTree/TreeEditableArea.java @@ -126,35 +126,38 @@ public final class TreeEditableArea implements EditableArea, FeedbackTreeLayer, return myTreeBuilder.getSelectedElements(RadComponent.class); } - public void setRawSelection(@Nullable Object value, final @Nullable Runnable globalDone) { + public void setRawSelection(final @Nullable Object value, final @Nullable Runnable globalDone) { mySelectionMode = true; final int selectionOperation = ++mySelectionOperation; - myTreeBuilder.queueUpdate(); - - Runnable localDone = new Runnable() { + myTreeBuilder.queueUpdate().doWhenDone(new Runnable() { @Override public void run() { - if (selectionOperation == mySelectionOperation) { - mySelectionMode = false; - fireSelectionChanged(); + Runnable localDone = new Runnable() { + @Override + public void run() { + if (selectionOperation == mySelectionOperation) { + mySelectionMode = false; + fireSelectionChanged(); - if (globalDone != null) { - globalDone.run(); + if (globalDone != null) { + globalDone.run(); + } + } } + }; + + if (value == null) { + myTreeBuilder.select(ArrayUtil.EMPTY_OBJECT_ARRAY, localDone); + } + else if (value instanceof RadComponent) { + myTreeBuilder.select(value, localDone); + } + else { + myTreeBuilder.select(((Collection)value).toArray(), localDone); } } - }; - - if (value == null) { - myTreeBuilder.select(ArrayUtil.EMPTY_OBJECT_ARRAY, localDone); - } - else if (value instanceof RadComponent) { - myTreeBuilder.select(value, localDone); - } - else { - myTreeBuilder.select(((Collection)value).toArray(), localDone); - } + }); } //////////////////////////////////////////////////////////////////////////////////////////