use of com.intellij.ide.projectView.actions.MoveModulesToSubGroupAction 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()]);
}
use of com.intellij.ide.projectView.actions.MoveModulesToSubGroupAction in project intellij-community by JetBrains.
the class MoveModuleToGroupTopLevel 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 moduleModel = LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(e.getDataContext());
ModuleGrouper grouper = ModuleGrouper.instanceFor(project, moduleModel);
List<String> topLevelGroupNames = new ArrayList<>(getTopLevelGroupNames(grouper));
Collections.sort(topLevelGroupNames);
List<AnAction> result = new ArrayList<>();
result.add(new MoveModulesOutsideGroupAction());
result.add(new MoveModulesToSubGroupAction(null));
result.add(Separator.getInstance());
for (String name : topLevelGroupNames) {
result.add(new MoveModuleToGroup(new ModuleGroup(Collections.singletonList(name))));
}
return result.toArray(new AnAction[result.size()]);
}
Aggregations