diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/DirectoryHistoryDialog.java b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/DirectoryHistoryDialog.java index d41f69d77f9d..7f94bc29f1fb 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/DirectoryHistoryDialog.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/DirectoryHistoryDialog.java @@ -44,7 +44,6 @@ import javax.swing.event.DocumentEvent; import javax.swing.tree.DefaultTreeModel; import java.awt.*; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Set; @@ -128,7 +127,7 @@ public class DirectoryHistoryDialog extends HistoryDialog createChangesTree() { - return new ChangesTreeList(myProject, Collections.emptyList(), false, false, null, null) { + return new ChangesTreeList(myProject, false, false) { @Override protected DefaultTreeModel buildTreeModel(List cc, ChangeNodeDecorator changeNodeDecorator) { return TreeModelBuilder.buildFromChanges(myProject, isShowFlatten(), cc, changeNodeDecorator); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java index 2f7b7d8fc1cf..03a223fecb98 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java @@ -83,28 +83,33 @@ public abstract class ChangesTreeList extends Tree implements TypeSafeDataPro @NonNls private final static String FLATTEN_OPTION_KEY = "ChangesBrowser.SHOW_FLATTEN"; - @Nullable private final Runnable myInclusionListener; + @Nullable private Runnable myInclusionListener; @Nullable private ChangeNodeDecorator myChangeDecorator; @NotNull private final CopyProvider myTreeCopyProvider; private TreeState myNonFlatTreeState; public ChangesTreeList(@NotNull Project project, @NotNull Collection initiallyIncluded, - final boolean showCheckboxes, - final boolean highlightProblems, - @Nullable final Runnable inclusionListener, - @Nullable final ChangeNodeDecorator decorator) { + boolean showCheckboxes, + boolean highlightProblems, + @Nullable Runnable inclusionListener, + @Nullable ChangeNodeDecorator decorator) { + this(project, showCheckboxes, highlightProblems); + myIncludedChanges.addAll(initiallyIncluded); + myInclusionListener = inclusionListener; + myChangeDecorator = decorator; + } + + public ChangesTreeList(@NotNull Project project, + boolean showCheckboxes, + boolean highlightProblems) { super(ChangesBrowserNode.createRoot(project)); myProject = project; myShowCheckboxes = showCheckboxes; myHighlightProblems = highlightProblems; - myInclusionListener = inclusionListener; - myChangeDecorator = decorator; myAlwaysExpandList = true; myCheckboxWidth = new JCheckBox().getPreferredSize().width; - myIncludedChanges.addAll(initiallyIncluded); - setHorizontalAutoScrollingEnabled(false); setRootVisible(false); setShowsRootHandles(true); @@ -192,7 +197,7 @@ public abstract class ChangesTreeList extends Tree implements TypeSafeDataPro getEmptyText().setText(emptyText); } - public void addSelectionListener(final Runnable runnable) { + public void addSelectionListener(@NotNull Runnable runnable) { addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { @@ -201,6 +206,10 @@ public abstract class ChangesTreeList extends Tree implements TypeSafeDataPro }); } + public void setInclusionListener(@Nullable Runnable runnable) { + myInclusionListener = runnable; + } + public void setChangeDecorator(@Nullable ChangeNodeDecorator changeDecorator) { myChangeDecorator = changeDecorator; } @@ -221,6 +230,10 @@ public abstract class ChangesTreeList extends Tree implements TypeSafeDataPro return myShowFlatten; } + public boolean isShowCheckboxes() { + return myShowCheckboxes; + } + /** * Does nothing as ChangesTreeList is currently not wrapped in JScrollPane by default. * Left not to break API (used in several plugins).