use of org.metaborg.core.menu.IMenuItem in project spoofax by metaborg.
the class MenuService method menuItems.
@Override
public Iterable<IMenuItem> menuItems(ILanguageImpl language) {
final Iterable<ActionFacet> facets = language.facets(ActionFacet.class);
final List<IMenuItem> menuItems = Lists.newLinkedList();
for (ActionFacet facet : facets) {
Iterables.addAll(menuItems, facet.menuItems);
}
if (menuItems.size() == 1) {
final IMenuItem item = menuItems.get(0);
if (item instanceof IMenu) {
final IMenu menu = (IMenu) item;
return menu.items();
}
}
return menuItems;
}
Aggregations