Search in sources :

Example 1 with IMenuItem

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;
}
Also used : IMenu(org.metaborg.core.menu.IMenu) ActionFacet(org.metaborg.spoofax.core.action.ActionFacet) IMenuItem(org.metaborg.core.menu.IMenuItem)

Aggregations

IMenu (org.metaborg.core.menu.IMenu)1 IMenuItem (org.metaborg.core.menu.IMenuItem)1 ActionFacet (org.metaborg.spoofax.core.action.ActionFacet)1