use of org.opennms.features.topology.app.internal.DefaultOperationContext in project opennms by OpenNMS.
the class TopologyContextMenu method updateMenu.
public void updateMenu(GraphContainer graphContainer, UI mainWindow, OperationManager operationManager, List<VertexRef> targets) {
final OperationContext operationContext = new DefaultOperationContext(mainWindow, graphContainer, OperationContext.DisplayLocation.CONTEXTMENU);
// Clear Menu
removeAllItems();
// Rebuild menu
MenuBuilder menuBuilder = new MenuBuilder();
for (OperationServiceWrapper operationServiceWrapper : operationManager.getOperationWrappers()) {
if (operationServiceWrapper.getContextMenuPosition() != null) {
MenuItem item = new OperationMenuItem(operationServiceWrapper);
menuBuilder.addMenuItem(item, operationServiceWrapper.getContextMenuPosition().isEmpty() ? null : operationServiceWrapper.getContextMenuPosition().split("\\|"));
}
}
addNavigateToItems(menuBuilder, targets, operationContext);
MenuBar menu = menuBuilder.build(targets, operationContext, this::notifyMenuUpdateListener);
addItems(menu);
}
use of org.opennms.features.topology.app.internal.DefaultOperationContext in project opennms by OpenNMS.
the class TopologyMenuBar method updateMenu.
// Builds the menu
public void updateMenu(GraphContainer graphContainer, UI mainWindow, OperationManager operationManager) {
final DefaultOperationContext operationContext = new DefaultOperationContext(mainWindow, graphContainer, OperationContext.DisplayLocation.MENUBAR);
final ArrayList<VertexRef> targets = new ArrayList<>(graphContainer.getSelectionManager().getSelectedVertexRefs());
// Clear menu
removeItems();
// Build new Menu
MenuBuilder menuBuilder = new MenuBuilder();
menuBuilder.setTopLevelMenuOrder(operationManager.getTopLevelMenuOrder());
menuBuilder.setSubMenuGroupOrder(operationManager.getSubMenuGroupOrder());
for (OperationServiceWrapper operationServiceWrapper : operationManager.getOperationWrappers()) {
if (operationServiceWrapper.getMenuPosition() != null) {
// if menu position is null, there is no place to put it
org.opennms.features.topology.app.internal.menu.MenuItem item = new OperationMenuItem(operationServiceWrapper);
menuBuilder.addMenuItem(item, operationServiceWrapper.getMenuPosition().split("\\|"));
}
}
menuBuilder.apply(this, targets, operationContext, this::notifyMenuUpdateListener);
}
Aggregations