[vcs-log] move selected filter up in the recent list

This commit is contained in:
Julia Beliaeva
2018-07-04 19:54:16 +03:00
parent 11512e4e67
commit c7a2689683
3 changed files with 7 additions and 13 deletions
@@ -107,9 +107,7 @@ public class VcsLogProjectTabsProperties implements PersistentStateComponent<Vcs
stateField.put(filterName, recentGroups);
}
RecentGroup group = new RecentGroup(values);
if (recentGroups.contains(group)) {
return;
}
recentGroups.remove(group);
recentGroups.add(0, group);
while (recentGroups.size() > RECENTLY_FILTERED_VALUES_LIMIT) {
recentGroups.remove(recentGroups.size() - 1);
@@ -118,7 +118,7 @@ public class BranchFilterPopupComponent extends MultipleValueFilterPopupComponen
@Override
protected void createFavoritesAction(@NotNull DefaultActionGroup actionGroup, @NotNull List<String> favorites) {
actionGroup.add(new PredefinedValueAction("Favorites", favorites));
actionGroup.add(new PredefinedValueAction("Favorites", favorites, false));
}
private class BranchFilterAction extends PredefinedValueAction {
@@ -128,7 +128,7 @@ public class BranchFilterPopupComponent extends MultipleValueFilterPopupComponen
private boolean myIsFavorite;
public BranchFilterAction(@NotNull String value, @NotNull Collection<VcsRef> references) {
super(value, true);
super(value);
myReferences = references;
myIcon = new LayeredIcon(AllIcons.Nodes.Favorite, EmptyIcon.ICON_16);
myHoveredIcon = new LayeredIcon(AllIcons.Nodes.FavoriteOnHover, AllIcons.Nodes.NotFavoriteOnHover);
@@ -104,23 +104,19 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
@NotNull protected final List<String> myValues;
private boolean myAddToRecent;
public PredefinedValueAction(@NotNull String value, boolean addToRecent) {
this(Collections.singletonList(value));
myAddToRecent = addToRecent;
}
public PredefinedValueAction(@NotNull String value) {
this(value, true);
this(Collections.singletonList(value));
}
public PredefinedValueAction(@NotNull List<String> values) {
this(displayableText(values), values);
this(displayableText(values), values, true);
}
public PredefinedValueAction(@NotNull String name, @NotNull List<String> values) {
public PredefinedValueAction(@NotNull String name, @NotNull List<String> values, boolean addToRecent) {
super(null, tooltip(values), null);
getTemplatePresentation().setText(name, false);
myValues = values;
myAddToRecent = addToRecent;
}
@Override