diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/AbstractCalledLater.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/AbstractCalledLater.java deleted file mode 100644 index dfa447e6f488..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/AbstractCalledLater.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.vcs.changes.committed; - -import com.intellij.openapi.application.ModalityState; -import com.intellij.openapi.project.Project; -import com.intellij.util.WaitForProgressToShow; - -import java.awt.*; - -public abstract class AbstractCalledLater implements Runnable { - private final Project myProject; - private final ModalityState myState; - - protected AbstractCalledLater(final Project project, final ModalityState modalityState) { - myProject = project; - myState = modalityState; - } - - protected AbstractCalledLater(Project project, Component component) { - myProject = project; - myState = ModalityState.stateForComponent(component); - } - - public void callMe() { - WaitForProgressToShow.runOrInvokeLaterAboveProgress(this, myState, myProject); - } -} diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java index 2c06564bb609..03531473af9a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesPanel.java @@ -43,7 +43,6 @@ import com.intellij.ui.LightColors; import com.intellij.util.AsynchConsumer; import com.intellij.util.BufferedListConsumer; import com.intellij.util.Consumer; -import com.intellij.util.WaitForProgressToShow; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -60,6 +59,8 @@ import java.util.List; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import static com.intellij.util.WaitForProgressToShow.*; + public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvider, Disposable { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.committed.CommittedChangesPanel"); @@ -169,11 +170,7 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide } public void consume(final List list) { - new AbstractCalledLater(myProject, ModalityState.stateForComponent(myBrowser)) { - public void run() { - myBrowser.append(list); - } - }.callMe(); + runOrInvokeLaterAboveProgress(() -> myBrowser.append(list), ModalityState.stateForComponent(myBrowser), myProject); } }; final BufferedListConsumer bufferedListConsumer = new BufferedListConsumer<>(30, appender, -1); @@ -193,7 +190,7 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide } catch (final VcsException e) { LOG.info(e); - WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { + runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myProject, "Error refreshing view: " + StringUtil.join(e.getMessages(), "\n"), "Committed Changes"); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesTreeBrowser.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesTreeBrowser.java index b1329fe78dcd..390e3f7f4980 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesTreeBrowser.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesTreeBrowser.java @@ -69,6 +69,7 @@ import java.util.List; import static com.intellij.openapi.vcs.changes.ChangesUtil.getAfterRevisionsFiles; import static com.intellij.openapi.vcs.changes.ChangesUtil.getNavigatableArray; +import static com.intellij.util.WaitForProgressToShow.runOrInvokeLaterAboveProgress; /** * @author yole @@ -572,10 +573,6 @@ public class CommittedChangesTreeBrowser extends JPanel implements TypeSafeDataP } public void setLoading(final boolean value) { - new AbstractCalledLater(myProject, ModalityState.NON_MODAL) { - public void run() { - myChangesTree.setPaintBusy(value); - } - }.callMe(); + runOrInvokeLaterAboveProgress(() -> myChangesTree.setPaintBusy(value), ModalityState.NON_MODAL, myProject); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java index 6711323e7646..312835d227b0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java @@ -31,7 +31,6 @@ import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.changes.committed.AbstractCalledLater; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.util.EventDispatcher; import com.intellij.util.SystemProperties; @@ -59,6 +58,8 @@ import java.io.IOException; import java.net.*; import java.util.*; +import static com.intellij.util.WaitForProgressToShow.runOrInvokeLaterAboveProgress; + /** * @author alex */ @@ -1072,13 +1073,10 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im }; if (myInteraction.promptInAwt()) { - new AbstractCalledLater(myProject, getCurrent()) { - @Override - public void run() { - saveOnce[0] = Boolean.TRUE.equals(prompt.get()); - ApplicationManager.getApplication().executeOnPooledThread(actualSave); - } - }.callMe(); + runOrInvokeLaterAboveProgress(() -> { + saveOnce[0] = Boolean.TRUE.equals(prompt.get()); + ApplicationManager.getApplication().executeOnPooledThread(actualSave); + }, getCurrent(), myProject); } else { saveOnce[0] = Boolean.TRUE.equals(prompt.get()); actualSave.run();