Search in sources :

Example 1 with AzureIconSymbol

use of com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol in project azure-tools-for-java by Microsoft.

the class ServerExplorerToolWindowFactory method createMenuItemFromNodeAction.

private JMenuItem createMenuItemFromNodeAction(NodeAction nodeAction) {
    final JMenuItem menuItem = new JMenuItem(nodeAction.getName());
    menuItem.setEnabled(nodeAction.isEnabled());
    AzureIconSymbol iconSymbol = nodeAction.getIconSymbol();
    if (Objects.nonNull(iconSymbol)) {
        menuItem.setIcon(AzureIconLoader.loadIcon(iconSymbol));
    } else if (StringUtils.isNotBlank(nodeAction.getIconPath())) {
        menuItem.setIcon(UIHelperImpl.loadIcon(nodeAction.getIconPath()));
    }
    // delegate the menu item click to the node action's listeners
    menuItem.addActionListener(e -> nodeAction.fireNodeActionEvent());
    return menuItem;
}
Also used : AzureIconSymbol(com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol)

Aggregations

AzureIconSymbol (com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol)1