vcs: Removed unnecessary "AbstractCalledLater" - logic inlined

This commit is contained in:
Konstantin Kolosovsky
2017-01-13 15:23:38 +03:00
parent cd5a3c4809
commit 3b40704cec
4 changed files with 12 additions and 61 deletions
@@ -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);
}
}
@@ -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<CommittedChangeList> list) {
new AbstractCalledLater(myProject, ModalityState.stateForComponent(myBrowser)) {
public void run() {
myBrowser.append(list);
}
}.callMe();
runOrInvokeLaterAboveProgress(() -> myBrowser.append(list), ModalityState.stateForComponent(myBrowser), myProject);
}
};
final BufferedListConsumer<CommittedChangeList> 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");
}
@@ -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);
}
}
@@ -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();