diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.java b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.java index 96db7f6f4ca5..b1143a77086f 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.java @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.history.integration; import com.intellij.history.*; import com.intellij.history.core.*; -import com.intellij.history.core.tree.RootEntry; import com.intellij.history.integration.ui.models.DirectoryHistoryDialogModel; import com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel; import com.intellij.history.integration.ui.models.HistoryDialogModel; @@ -26,10 +24,10 @@ import com.intellij.history.utils.LocalHistoryLog; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.ShutDownTracker; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.registry.Registry; @@ -38,7 +36,6 @@ import com.intellij.openapi.vfs.VirtualFileListener; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; -import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; @@ -156,7 +153,7 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone return label(myVcs.putUserLabel(name, getProjectId(p))); } - private String getProjectId(Project p) { + private static String getProjectId(Project p) { return p.getLocationHash(); } @@ -180,13 +177,7 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone @Override public ByteContent getByteContent(final String path) { - return ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - public ByteContent compute() { - RootEntry root = myGateway.createTransientRootEntryForPathOnly(path); - return impl.getByteContent(root, path); - } - }); + return ReadAction.compute(() -> impl.getByteContent(myGateway.createTransientRootEntryForPathOnly(path), path)); } }; } @@ -196,12 +187,7 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone public byte[] getByteContent(final VirtualFile f, final FileRevisionTimestampComparator c) { if (!isInitialized()) return null; if (!myGateway.areContentChangesVersioned(f)) return null; - return ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - public byte[] compute() { - return new ByteContentRetriever(myGateway, myVcs, f, c).getResult(); - } - }); + return ReadAction.compute(() -> new ByteContentRetriever(myGateway, myVcs, f, c).getResult()); } @Override @@ -214,7 +200,6 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone } @Override - @NonNls @NotNull public String getComponentName() { return "Local History"; @@ -247,4 +232,4 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone throw new LocalHistoryException(String.format("Couldn't revert %s to local history label.", f.getName()), e); } } -} +} \ No newline at end of file