use of org.uberfire.workbench.model.menu.MenuItemCommand in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorMenusTest method checkMenuStructure.
@Test
public void checkMenuStructure() {
presenter.getMenus(menus -> {
final AtomicInteger i = new AtomicInteger(0);
final MenuVisitor visitor = new MenuVisitor() {
@Override
public boolean visitEnter(final Menus menus) {
return true;
}
@Override
public void visitLeave(final Menus menus) {
}
@Override
public boolean visitEnter(final MenuGroup menuGroup) {
assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuGroup.getIdentifier());
return true;
}
@Override
public void visitLeave(final MenuGroup menuGroup) {
}
@Override
public void visit(final MenuItemPlain menuItemPlain) {
assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemPlain.getIdentifier());
}
@Override
public void visit(final MenuItemCommand menuItemCommand) {
assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemCommand.getIdentifier());
}
@Override
public void visit(final MenuItemPerspective menuItemPerspective) {
assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuItemPerspective.getIdentifier());
}
@Override
public void visit(final MenuCustom<?> menuCustom) {
assertEquals(menuItemIdentifiers[i.getAndIncrement()], menuCustom.getIdentifier());
}
};
menus.accept(visitor);
});
}
use of org.uberfire.workbench.model.menu.MenuItemCommand in project kie-wb-common by kiegroup.
the class NewResourcesMenuTest method testMenuItemCommand.
@Test
public void testMenuItemCommand() {
final List<MenuItem> menus = menu.getMenuItems();
assertNotNull(menus);
assertEquals(1, menus.size());
final MenuItem mi = menus.get(0);
assertTrue(mi.isEnabled());
assertTrue(mi instanceof MenuItemCommand);
final MenuItemCommand miu = (MenuItemCommand) mi;
assertNotNull(miu.getCommand());
miu.getCommand().execute();
verify(command, times(1)).execute();
}
Aggregations