[vcs-log] reformat, optimize imports

GitOrigin-RevId: a542f5bce3e3301237ae7a8c78da9b363e5207b7
This commit is contained in:
Julia Beliaeva
2019-10-12 19:31:18 +00:00
committed by intellij-monorepo-bot
parent 212c83cdd8
commit 3e116aaa06
9 changed files with 18 additions and 19 deletions
@@ -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
@@ -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()));
};
@@ -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
@@ -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;
@@ -55,5 +55,4 @@ public class TimedCommitParser {
public static List<TimedVcsCommit> log(@NotNull String... commits) {
return log(Arrays.asList(commits));
}
}
@@ -195,7 +195,8 @@ public abstract class VcsLogUserFilterTest {
private void checkFilter(VcsLogUserFilter userFilter,
String filterDescription,
@NotNull Collection<String> expectedHashes,
@NotNull List<? extends VcsCommitMetadata> metadata, @NotNull StringBuilder errorMessageBuilder) throws VcsException {
@NotNull List<? extends VcsCommitMetadata> metadata, @NotNull StringBuilder errorMessageBuilder)
throws VcsException {
// filter by vcs
List<String> actualHashes = getFilteredHashes(userFilter);
@@ -26,5 +26,4 @@ public class VcsLogMultiRepoJoinerTest {
assertEquals(expected, joined);
}
}
@@ -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<FilePath>? {
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<TIntObjectHashMap<VcsLogPathsIndex.ChangeKind>> {
@@ -38,7 +38,6 @@ public class HashSerializeTest {
File file = writeToTempFile(hash1, hash2);
List<HashImpl> hashes = readFromFile(file);
assertEquals(Arrays.asList(hash1, hash2), hashes);
}
@NotNull