make global 'Expand All'/'Collapse All' actions work in Local Changes tree (for IDEA-192073)

This commit is contained in:
Dmitry Batrak
2018-06-27 13:01:03 +03:00
parent 2404a9c990
commit 5803867015
2 changed files with 12 additions and 0 deletions
@@ -153,6 +153,8 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi
myContentManager.addToolWindowTitleAction(expandAll);
myContentManager.addToolWindowTitleAction(collapseAll);
myView.setTreeExpander(expander);
scheduleRefresh();
myProject.getMessageBus().connect().subscribe(RemoteRevisionsCache.REMOTE_VERSION_CHANGED,
() -> ApplicationManager.getApplication().invokeLater(() -> refreshView(), ModalityState.NON_MODAL, myProject.getDisposed()));
@@ -1,6 +1,7 @@
// 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.openapi.vcs.changes.ui;
import com.intellij.ide.TreeExpander;
import com.intellij.ide.dnd.DnDAware;
import com.intellij.ide.util.PsiNavigationSupport;
import com.intellij.ide.util.treeView.TreeState;
@@ -50,6 +51,8 @@ public class ChangesListView extends ChangesTree implements DataProvider, DnDAwa
@NonNls public static final DataKey<List<FilePath>> MISSING_FILES_DATA_KEY = DataKey.create("ChangeListView.MissingFiles");
@NonNls public static final DataKey<List<LocallyDeletedChange>> LOCALLY_DELETED_CHANGES = DataKey.create("ChangeListView.LocallyDeletedChanges");
private TreeExpander myTreeExpander;
public ChangesListView(@NotNull Project project) {
super(project, false, true);
setDragEnabled(true);
@@ -179,6 +182,9 @@ public class ChangesListView extends ChangesTree implements DataProvider, DnDAwa
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return HELP_ID;
}
if (PlatformDataKeys.TREE_EXPANDER.is(dataId) && myTreeExpander != null) {
return myTreeExpander;
}
return super.getData(dataId);
}
@@ -399,4 +405,8 @@ public class ChangesListView extends ChangesTree implements DataProvider, DnDAwa
return seen.add(change);
}
}
public void setTreeExpander(TreeExpander expander) {
myTreeExpander = expander;
}
}