use of com.intellij.ide.projectView.actions.MoveModulesToGroupAction in project intellij-community by JetBrains.
the class MoveModuleToGroup method getChildren.
@Override
@NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e == null)
return EMPTY_ARRAY;
Project project = getEventProject(e);
if (project == null)
return EMPTY_ARRAY;
ModifiableModuleModel modifiableModuleModel = LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(e.getDataContext());
List<AnAction> result = new ArrayList<>();
result.add(new MoveModulesToGroupAction(myModuleGroup, IdeBundle.message("action.move.module.to.this.group")));
result.add(new MoveModulesToSubGroupAction(myModuleGroup));
result.add(Separator.getInstance());
ModuleGrouper grouper = ModuleGrouper.instanceFor(project, modifiableModuleModel);
result.addAll(myModuleGroup.childGroups(grouper).stream().sorted((moduleGroup1, moduleGroup2) -> {
assert moduleGroup1.getGroupPath().length == moduleGroup2.getGroupPath().length;
return moduleGroup1.toString().compareToIgnoreCase(moduleGroup2.toString());
}).map(MoveModuleToGroup::new).collect(Collectors.toList()));
return result.toArray(new AnAction[result.size()]);
}
Aggregations