From 38cfbf7ed4ee923b346ec4abe2474c18684bc2e2 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Wed, 2 Mar 2016 14:45:11 +0300 Subject: [PATCH] [hg]: remove unnecessary pool thread creation in PullDialog listener * we do not execute any external hg command, just read already cached information --- .../src/org/zmlx/hg4idea/ui/HgPullDialog.java | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java index 15d2f7122baa..be657d4c41e2 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java @@ -12,7 +12,6 @@ // limitations under the License. package org.zmlx.hg4idea.ui; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.project.Project; @@ -20,7 +19,6 @@ import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.EditorComboBox; -import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.repo.HgRepository; @@ -97,25 +95,14 @@ public class HgPullDialog extends DialogWrapper { } private void onChangeRepository() { - ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { - @Override - public void run() { - final VirtualFile repo = hgRepositorySelector.getRepository().getRoot(); - final String defaultPath = HgUtil.getRepositoryDefaultPath(project, repo); - if (!StringUtil.isEmptyOrSpaces(defaultPath)) { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - addPathsFromHgrc(repo); - myRepositoryURL.setText(HgUtil.removePasswordIfNeeded(defaultPath)); - myCurrentRepositoryUrl = defaultPath; - } - }); - - onChangePullSource(); - } - } - }); + final VirtualFile repo = hgRepositorySelector.getRepository().getRoot(); + final String defaultPath = HgUtil.getRepositoryDefaultPath(project, repo); + if (!StringUtil.isEmptyOrSpaces(defaultPath)) { + addPathsFromHgrc(repo); + myRepositoryURL.setText(HgUtil.removePasswordIfNeeded(defaultPath)); + myCurrentRepositoryUrl = defaultPath; + onChangePullSource(); + } } private void onChangePullSource() {