use of io.github.kings1990.plugin.fastrequest.action.CheckBoxFilterAction in project fast-request by dromara.
the class AllApisNavToolWindow method initActionBar.
private void initActionBar() {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new RefreshApiAction());
group.add(CommonActionsManager.getInstance().createExpandAllAction(apiTree, apiTree));
group.add(CommonActionsManager.getInstance().createCollapseAllAction(apiTree, apiTree));
Module[] modules = ModuleManager.getInstance(myProject).getModules();
List<String> moduleList = Arrays.stream(modules).map(Module::getName).sorted().collect(Collectors.toList());
moduleFilter = new CheckBoxFilterAction.Filter<>(moduleList, module -> module, module -> null, FastRequestSearchEverywhereConfiguration.getInstance());
group.add(new CheckBoxFilterAction<>("Filter Module", "Filter module", AllIcons.Actions.GroupByModule, moduleFilter, this::refresh));
List<String> methodNameList = Constant.METHOD_TYPE_LIST.stream().map(MethodType::getName).collect(Collectors.toList());
Map<String, Icon> iconMap = Constant.METHOD_TYPE_LIST.stream().collect(Collectors.toMap(MethodType::getName, MethodType::getIcon));
methodTypeFilter = new CheckBoxFilterAction.Filter<>(methodNameList, methodName -> methodName, iconMap::get, FastRequestSearchEverywhereConfiguration.getInstance());
group.add(new CheckBoxFilterAction<>("Filter Method", "Filter Method", AllIcons.Actions.GroupByMethod, methodTypeFilter, this::refresh));
ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLWINDOW_CONTENT, group, false);
actionToolbar.setTargetComponent(panel);
JComponent toolbarComponent = actionToolbar.getComponent();
Border border = IdeBorderFactory.createBorder(SideBorder.BOTTOM);
actionToolbar.getComponent().setBorder(border);
setToolbar(toolbarComponent);
}
Aggregations