mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs log: cleanup
This commit is contained in:
+2
-2
@@ -110,7 +110,7 @@ public class BranchFilterPopupComponent extends MultipleValueFilterPopupComponen
|
||||
@NotNull
|
||||
@Override
|
||||
public AnAction createAction(@NotNull String name) {
|
||||
return new PredefinedValueAction(Collections.singletonList(name)) {
|
||||
return new PredefinedValueAction(name) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
myFilterModel.setFilter(myFilterModel.createFilter(myValues)); // does not add to recent
|
||||
@@ -126,7 +126,7 @@ public class BranchFilterPopupComponent extends MultipleValueFilterPopupComponen
|
||||
@NotNull
|
||||
@Override
|
||||
protected AnAction createCollapsedAction(String actionName) {
|
||||
return createPredefinedValueAction(Collections.singletonList(actionName)); // adds to recent
|
||||
return new PredefinedValueAction(actionName); // adds to recent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +127,7 @@ public abstract class BranchPopupBuilder {
|
||||
private static void putActionsForReferences(List<RefGroup> references, Groups actions) {
|
||||
for (final RefGroup refGroup : references) {
|
||||
if (refGroup instanceof SingletonRefGroup) {
|
||||
String name = refGroup.getName();
|
||||
if (!actions.singletonGroups.contains(name)) {
|
||||
actions.singletonGroups.add(name);
|
||||
}
|
||||
actions.singletonGroups.add(refGroup.getName());
|
||||
}
|
||||
else if (refGroup.isExpanded()) {
|
||||
addToGroup(refGroup, actions.expandedGroups);
|
||||
@@ -142,20 +139,9 @@ public abstract class BranchPopupBuilder {
|
||||
}
|
||||
|
||||
private static void addToGroup(final RefGroup refGroup, TreeMap<String, TreeSet<String>> groupToAdd) {
|
||||
TreeSet<String> existingGroup = groupToAdd.get(refGroup.getName());
|
||||
|
||||
TreeSet<String> actions = new TreeSet<>();
|
||||
TreeSet<String> groupActions = groupToAdd.computeIfAbsent(refGroup.getName(), key -> new TreeSet<>());
|
||||
for (VcsRef ref : refGroup.getRefs()) {
|
||||
actions.add(ref.getName());
|
||||
}
|
||||
|
||||
if (existingGroup == null) {
|
||||
groupToAdd.put(refGroup.getName(), actions);
|
||||
}
|
||||
else {
|
||||
for (String action : actions) {
|
||||
existingGroup.add(action);
|
||||
}
|
||||
groupActions.add(ref.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -84,11 +84,6 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
|
||||
return StringUtil.join(values, ", ");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected AnAction createPredefinedValueAction(@NotNull List<String> values) {
|
||||
return new PredefinedValueAction(values);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected AnAction createSelectMultipleValuesAction() {
|
||||
return new SelectMultipleValuesAction();
|
||||
@@ -105,6 +100,10 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
|
||||
|
||||
@NotNull protected final List<String> myValues;
|
||||
|
||||
public PredefinedValueAction(@NotNull String value) {
|
||||
this(Collections.singletonList(value));
|
||||
}
|
||||
|
||||
public PredefinedValueAction(@NotNull List<String> values) {
|
||||
super(null, tooltip(values), null);
|
||||
getTemplatePresentation().setText(displayableText(values), false);
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class UserFilterPopupComponent extends MultipleValueFilterPopupComponent<VcsLogU
|
||||
group.add(createAllAction());
|
||||
group.add(createSelectMultipleValuesAction());
|
||||
if (!myLogData.getCurrentUser().isEmpty()) {
|
||||
group.add(createPredefinedValueAction(Collections.singletonList(VcsLogUserFilterImpl.ME)));
|
||||
group.add(new PredefinedValueAction(VcsLogUserFilterImpl.ME));
|
||||
}
|
||||
group.addAll(createRecentItemsActionGroup());
|
||||
return group;
|
||||
|
||||
Reference in New Issue
Block a user