diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangesUtil.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangesUtil.java index dc3455576985..f52397b69f91 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangesUtil.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangesUtil.java @@ -201,13 +201,9 @@ public class ChangesUtil { public static FilePath getLocalPath(@NotNull Project project, FilePath filePath) { // check if the file has just been renamed (IDEADEV-15494) - Change change = ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - @Nullable - public Change compute() { - if (project.isDisposed()) throw new ProcessCanceledException(); - return ChangeListManager.getInstance(project).getChange(filePath); - } + Change change = ApplicationManager.getApplication().runReadAction((Computable)() -> { + if (project.isDisposed()) throw new ProcessCanceledException(); + return ChangeListManager.getInstance(project).getChange(filePath); }); if (change != null) { ContentRevision beforeRevision = change.getBeforeRevision(); @@ -242,20 +238,17 @@ public class ChangesUtil { @Nullable private static VirtualFile getValidParentUnderReadAction(@NotNull FilePath filePath) { - return ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - public VirtualFile compute() { - VirtualFile result = null; - FilePath parent = filePath; - LocalFileSystem lfs = LocalFileSystem.getInstance(); + return ApplicationManager.getApplication().runReadAction((Computable)() -> { + VirtualFile result = null; + FilePath parent = filePath; + LocalFileSystem lfs = LocalFileSystem.getInstance(); - while (result == null && parent != null) { - result = lfs.findFileByPath(parent.getPath()); - parent = parent.getParentPath(); - } - - return result; + while (result == null && parent != null) { + result = lfs.findFileByPath(parent.getPath()); + parent = parent.getParentPath(); } + + return result; }); } @@ -297,13 +290,10 @@ public class ChangesUtil { @NotNull VcsSeparator separator, @NotNull PerVcsProcessor processor) { Map> changesByVcs = ApplicationManager.getApplication().runReadAction( - new NotNullComputable>>() { - @NotNull - @Override - public Map> compute() { - return items.stream().collect(groupingBy(separator::getVcsFor)); - } - }); + (NotNullComputable>>)() -> + items.stream() + .filter(it -> separator.getVcsFor(it) != null) + .collect(groupingBy(separator::getVcsFor))); changesByVcs.forEach((vcs, vcsItems) -> { if (vcs != null) {