[hg] access dialog elements from AWT.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Thu, 14 Apr 2011 12:58:40 +0000 (16:58 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 18 Apr 2011 09:15:03 +0000 (13:15 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgIntegrateDialog.java

index 3d7cc84e25e8b1daa52f5f767a3afcaeb824cc10..3684a310fb9c735578e7d16e774cca6a1cd257ca 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vcs.FilePath;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.Consumer;
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.Nls;
 import org.zmlx.hg4idea.HgRevisionNumber;
 import org.zmlx.hg4idea.HgVcsMessages;
@@ -139,8 +140,13 @@ public class HgIntegrateDialog implements Configurable {
   private void loadBranches(VirtualFile root) {
     new HgTagBranchCommand(project, root).listBranches(new Consumer<List<HgTagBranch>>() {
       @Override
-      public void consume(List<HgTagBranch> branches) {
-        branchSelector.setModel(new DefaultComboBoxModel(branches.toArray()));
+      public void consume(final List<HgTagBranch> branches) {
+        UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+          @Override
+          public void run() {
+            branchSelector.setModel(new DefaultComboBoxModel(branches.toArray()));
+          }
+        });
       }
     });
   }
@@ -148,8 +154,13 @@ public class HgIntegrateDialog implements Configurable {
   private void loadTags(VirtualFile root) {
     new HgTagBranchCommand(project, root).listTags(new Consumer<List<HgTagBranch>>() {
       @Override
-      public void consume(List<HgTagBranch> tags) {
-        tagSelector.setModel(new DefaultComboBoxModel(tags.toArray()));
+      public void consume(final List<HgTagBranch> tags) {
+        UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+          @Override
+          public void run() {
+            tagSelector.setModel(new DefaultComboBoxModel(tags.toArray()));
+          }
+        });
       }
     });
   }