From b7ee82ab84a8f79af88bfa59410fd6404dd2e94a Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Thu, 23 Mar 2017 22:49:22 +0300 Subject: [PATCH] [vcs-log] inline runInBackground method that is used only once Remove catching VcsException since it is not thrown in the code. --- .../com/intellij/vcs/log/data/VcsLogData.java | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogData.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogData.java index 6ee8cebccd6f..18781a4976e8 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogData.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogData.java @@ -30,7 +30,6 @@ import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; -import com.intellij.util.ThrowableConsumer; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.*; import com.intellij.vcs.log.data.index.VcsLogIndex; @@ -175,16 +174,21 @@ public class VcsLogData implements Disposable, VcsLogDataProvider { } public void initialize() { - final StopWatch initSw = StopWatch.start("initialize"); + StopWatch initSw = StopWatch.start("initialize"); myDataLoaderQueue.clear(); - runInBackground(indicator -> { - resetState(); - readCurrentUser(); - DataPack dataPack = myRefresher.readFirstBlock(); - fireDataPackChangeEvent(dataPack); - initSw.report(); - }); + Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Loading History...", false) { + @Override + public void run(@NotNull ProgressIndicator indicator) { + indicator.setIndeterminate(true); + resetState(); + readCurrentUser(); + DataPack dataPack = myRefresher.readFirstBlock(); + fireDataPackChangeEvent(dataPack); + initSw.report(); + } + }; + myDataLoaderQueue.run(backgroundable, null, myRefresher.getProgress().createProgressIndicator()); } private void readCurrentUser() { @@ -241,22 +245,6 @@ public class VcsLogData implements Disposable, VcsLogDataProvider { return myContainingBranchesGetter; } - private void runInBackground(@NotNull ThrowableConsumer task) { - Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Loading History...", false) { - @Override - public void run(@NotNull ProgressIndicator indicator) { - indicator.setIndeterminate(true); - try { - task.consume(indicator); - } - catch (VcsException e) { - throw new RuntimeException(e); // TODO - } - } - }; - myDataLoaderQueue.run(backgroundable, null, myRefresher.getProgress().createProgressIndicator()); - } - /** * Refreshes specified roots. * Does not re-read all log but rather the most recent commits.