From 0a0c40ce6d76e2ff0799378ce348826f76b9bb60 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Wed, 22 Feb 2017 16:33:36 +0300 Subject: [PATCH] [vcs-log] when filters change, recalculate columns size When filters change, commits with author with longer names can become visible. This often leads to author column being too small. So need to recalculate preferred size in this case. This of course creates a new problem: if user resizes a column, it should not be automatically adjusted. This is going to be fixed in later commits. --- .../vcs/log/ui/table/VcsLogGraphTable.java | 14 ++++++++++---- .../com/intellij/vcs/log/util/VcsLogUiUtil.java | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java index c29a13956932..7b1a79c91fee 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java @@ -153,6 +153,8 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, public void updateDataPack(@NotNull VisiblePack visiblePack, boolean permGraphChanged) { VcsLogGraphTable.Selection previousSelection = getSelection(); + boolean filtersChanged = !getModel().getVisiblePack().getFilters().equals(visiblePack.getFilters()); + getModel().setVisiblePack(visiblePack); previousSelection.restore(visiblePack.getVisibleGraph(), true, permGraphChanged); for (VcsLogHighlighter highlighter : myHighlighters) { @@ -160,12 +162,11 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, } setPaintBusy(false); - doLayout(); + reLayout(filtersChanged); } - @Override - public void doLayout() { - if (!myColumnsSizeInitialized) { + public void reLayout(boolean recalculatePreferredSize) { + if (!myColumnsSizeInitialized || recalculatePreferredSize) { myColumnsSizeInitialized = initFixedColumnsPreferredSize(); } updateCommitColumnWidth(); @@ -173,6 +174,11 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, super.doLayout(); } + @Override + public void doLayout() { + reLayout(false); + } + private boolean initFixedColumnsPreferredSize() { Font tableFont = getTableFont(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUiUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUiUtil.java index a4ab650c90f2..069148200a86 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUiUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUiUtil.java @@ -68,7 +68,7 @@ public class VcsLogUiUtil { @NotNull VcsLogData logData, @NotNull Disposable disposableParent) { Runnable miniDetailsLoadedListener = () -> { - graphTable.doLayout(); + graphTable.reLayout(false); graphTable.repaint(); }; Runnable containingBranchesListener = () -> {