From 3e116aaa06dbd3090e37c309c5f4eb84a9c4c019 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Sat, 12 Oct 2019 19:46:35 +0300 Subject: [PATCH] [vcs-log] reformat, optimize imports GitOrigin-RevId: a542f5bce3e3301237ae7a8c78da9b363e5207b7 --- .../intellij/vcs/log/history/FileHistoryDiffPreview.kt | 7 +++---- .../com/intellij/vcs/log/history/FileHistoryPanel.java | 9 ++++++--- .../src/com/intellij/vcs/log/impl/VcsLogTabsWatcher.java | 8 ++++---- .../intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java | 2 -- .../test/com/intellij/vcs/log/TimedCommitParser.java | 1 - .../test/com/intellij/vcs/log/VcsLogUserFilterTest.java | 3 ++- .../intellij/vcs/log/data/VcsLogMultiRepoJoinerTest.java | 1 - .../test/com/intellij/vcs/log/history/FileHistoryTest.kt | 5 +++-- .../com/intellij/vcs/log/impl/HashSerializeTest.java | 1 - 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt index 3af275004129..2d8af3437ff9 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryDiffPreview.kt @@ -6,7 +6,6 @@ import com.intellij.diff.util.DiffPlaces import com.intellij.openapi.Disposable import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vcs.VcsConfiguration import com.intellij.openapi.vcs.changes.Change import com.intellij.openapi.vcs.changes.ChangeViewDiffRequestProcessor import com.intellij.ui.IdeBorderFactory @@ -35,9 +34,9 @@ internal class FileHistoryDiffPreview(project: Project, private val changeGetter override fun selectChange(change: Wrapper) {} - fun updatePreview(state: Boolean) { - updatePreview(state, false) - } + fun updatePreview(state: Boolean) { + updatePreview(state, false) + } override fun getFastLoadingTimeMillis(): Int { return 10 diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java index 4621bb15d844..824520ceb146 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryPanel.java @@ -213,7 +213,8 @@ public class FileHistoryPanel extends JPanel implements DataProvider, Disposable if (Registry.is("show.diff.preview.as.editor.tab")) { if (!state) { FileEditorManager.getInstance(myLogData.getProject()).closeFile(new PreviewDiffVirtualFile(myDiffPreviewProvider)); - } else { + } + else { FileEditorManager.getInstance(myLogData.getProject()).openFile(new PreviewDiffVirtualFile(myDiffPreviewProvider), false, true); } return; @@ -228,8 +229,10 @@ public class FileHistoryPanel extends JPanel implements DataProvider, Disposable FileHistoryDiffPreview diffPreview = new FileHistoryDiffPreview(myLogData.getProject(), () -> myUi.getSelectedChange(), isInEditor, this); ListSelectionListener selectionListener = e -> { - if (!myProperties.get(CommonUiProperties.SHOW_DIFF_PREVIEW)){ - return;}int[] selection = myGraphTable.getSelectedRows(); + if (!myProperties.get(CommonUiProperties.SHOW_DIFF_PREVIEW)) { + return; + } + int[] selection = myGraphTable.getSelectedRows(); ApplicationManager.getApplication().invokeLater(() -> diffPreview.updatePreview(diffPreview.getComponent().isShowing()), o -> !Arrays.equals(selection, myGraphTable.getSelectedRows())); }; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogTabsWatcher.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogTabsWatcher.java index 53abfc4cd965..cffa0d140fdb 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogTabsWatcher.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogTabsWatcher.java @@ -109,14 +109,13 @@ public class VcsLogTabsWatcher implements Disposable { content.putUserData(GraphViewVirtualFile.GraphVirtualFile, (GraphViewVirtualFile)file); } } - else if (VcsLogContentProvider.TAB_NAME.equals(content.getDisplayName()) && VcsLogProjectTabsProperties.MAIN_LOG_ID.equals(logId)) { + else if (VcsLogContentProvider.TAB_NAME.equals(content.getDisplayName()) && + VcsLogProjectTabsProperties.MAIN_LOG_ID.equals(logId)) { content.putUserData(GraphViewVirtualFile.GraphVirtualFile, (GraphViewVirtualFile)file); } } } - } - } private void installLogEditorListeners(Project project) { @@ -303,8 +302,9 @@ public class VcsLogTabsWatcher implements Disposable { private void selectEditorTab(Content content) { GraphViewVirtualFile file = content.getUserData(GraphViewVirtualFile.GraphVirtualFile); - if(file != null) + if (file != null) { MainFrame.openLogEditorTab(file, myProject); + } } @Override diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java index a553183605c9..b2f8fcc154a9 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangeProcessor.java @@ -7,8 +7,6 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.registry.Registry; -import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeViewDiffRequestProcessor; import com.intellij.openapi.vcs.changes.ui.ChangesTree; diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java index 89ceef2025be..b1a4d009c127 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java @@ -55,5 +55,4 @@ public class TimedCommitParser { public static List log(@NotNull String... commits) { return log(Arrays.asList(commits)); } - } diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java index 4781be6a874d..3b07477964c1 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java @@ -195,7 +195,8 @@ public abstract class VcsLogUserFilterTest { private void checkFilter(VcsLogUserFilter userFilter, String filterDescription, @NotNull Collection expectedHashes, - @NotNull List metadata, @NotNull StringBuilder errorMessageBuilder) throws VcsException { + @NotNull List metadata, @NotNull StringBuilder errorMessageBuilder) + throws VcsException { // filter by vcs List actualHashes = getFilteredHashes(userFilter); diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogMultiRepoJoinerTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogMultiRepoJoinerTest.java index f816acb08163..2f6fdc8c4786 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogMultiRepoJoinerTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogMultiRepoJoinerTest.java @@ -26,5 +26,4 @@ public class VcsLogMultiRepoJoinerTest { assertEquals(expected, joined); } - } diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/history/FileHistoryTest.kt b/platform/vcs-log/impl/test/com/intellij/vcs/log/history/FileHistoryTest.kt index 7a10e4e45ad5..aee914f6ed97 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/history/FileHistoryTest.kt +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/history/FileHistoryTest.kt @@ -1,7 +1,6 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.history -import com.intellij.openapi.util.Couple import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.vcs.FilePath import com.intellij.openapi.vcs.LocalFilePath @@ -440,7 +439,9 @@ private class FileNamesDataBuilder(private val path: FilePath) { fun build(): FileHistoryData { return object : FileHistoryData(path) { override fun findRename(parent: Int, child: Int, path: FilePath, isChildPath: Boolean): EdgeData? { - return renamesMap[EdgeData(parent, child)].find { FILE_PATH_HASHING_STRATEGY.equals(if (isChildPath) it.child else it.parent, path) } + return renamesMap[EdgeData(parent, child)].find { + FILE_PATH_HASHING_STRATEGY.equals(if (isChildPath) it.child else it.parent, path) + } } override fun getAffectedCommits(path: FilePath): TIntObjectHashMap> { diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java index 315cc9faca07..9eaea35145ad 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java @@ -38,7 +38,6 @@ public class HashSerializeTest { File file = writeToTempFile(hash1, hash2); List hashes = readFromFile(file); assertEquals(Arrays.asList(hash1, hash2), hashes); - } @NotNull