Commit 67164a47 authored by Konstantin Kolosovsky's avatar Konstantin Kolosovsky
Browse files

Do not save/apply tree state specifically for directory changes grouping

Currently it is unnecessary because there is no clear distinction between none and directory groupings as it was before when only 2 groupings were available
parent c1b5aa7f
Showing with 4 additions and 14 deletions
+4 -14
......@@ -76,7 +76,6 @@ public abstract class ChangesTree extends Tree implements DataProvider {
@Nullable private Runnable myInclusionListener;
@NotNull private final CopyProvider myTreeCopyProvider;
private TreeState myDirectoryTreeState;
public ChangesTree(@NotNull Project project,
boolean showCheckboxes,
......@@ -165,8 +164,7 @@ public abstract class ChangesTree extends Tree implements DataProvider {
migrateShowFlattenSetting();
myGroupingSupport
.setGroupingKeysOrSkip(set(notNull(PropertiesComponent.getInstance(myProject).getValues(GROUPING_KEYS), DEFAULT_GROUPING_KEYS)));
//noinspection unchecked
myGroupingSupport.addPropertyChangeListener(e -> changeGrouping((Set<String>)e.getOldValue(), (Set<String>)e.getNewValue()));
myGroupingSupport.addPropertyChangeListener(e -> changeGrouping());
String emptyText = StringUtil.capitalize(DiffBundle.message("diff.count.differences.status.text", 0));
setEmptyText(emptyText);
......@@ -230,19 +228,11 @@ public abstract class ChangesTree extends Tree implements DataProvider {
return myShowCheckboxes;
}
private void changeGrouping(@NotNull Set<String> oldGrouping, @NotNull Set<String> newGrouping) {
PropertiesComponent.getInstance(myProject).setValues(GROUPING_KEYS, toStringArray(newGrouping));
final List<Object> oldSelection = getSelectedUserObjects();
if (myKeepTreeState && oldGrouping.contains(DIRECTORY_GROUPING)) {
myDirectoryTreeState = TreeState.createOn(this, getRoot());
}
private void changeGrouping() {
PropertiesComponent.getInstance(myProject).setValues(GROUPING_KEYS, toStringArray(getGroupingSupport().getGroupingKeys()));
List<Object> oldSelection = getSelectedUserObjects();
rebuildTree();
if (myKeepTreeState && newGrouping.contains(DIRECTORY_GROUPING) && myDirectoryTreeState != null) {
myDirectoryTreeState.applyTo(this, getRoot());
}
setSelectedChanges(oldSelection);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment