public void registerActions()

in PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib/src/main/java/com/microsoft/azure/toolkit/intellij/connector/ResourceConnectionActionsContributor.java [72:227]


    public void registerActions(AzureActionManager am) {
        new Action<>(REFRESH_MODULE)
            .withLabel("Refresh")
            .withIcon(AzureIcons.Action.REFRESH.getIconPath())
            .withHandler((module, e) -> {
                Optional.ofNullable(module.getDefaultProfile()).ifPresent(Profile::reload);
                AzureEventBus.emit("connector.refreshed.module_root", module);
            })
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(REFRESH_MODULE_CONNECTIONS)
            .withLabel("Refresh")
            .withIcon(AzureIcons.Action.REFRESH.getIconPath())
            .withHandler((connectionManager, e) -> {
                connectionManager.reload();
                AzureEventBus.emit("connector.module_connections_changed", connectionManager);
            })
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(REFRESH_MODULE_TARGETS)
            .withLabel("Refresh")
            .withIcon(AzureIcons.Action.REFRESH.getIconPath())
            .withHandler((targetManager, e) -> {
                targetManager.reload();
                AzureEventBus.emit("connector.module_targets_changed", targetManager);
            })
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(REFRESH_ENVIRONMENT_VARIABLES)
            .withLabel("Refresh")
            .withIcon(AzureIcons.Action.REFRESH.getIconPath())
            .withHandler((targetManager, e) -> AzureEventBus.emit("connector.connection_environment_variables_changed", targetManager))
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(HIDE_AZURE)
            .withLabel("Hide 'Azure' Node")
            .withIcon(AzureIcons.Common.HIDE.getIconPath())
            .withHandler((module, e) -> {
                if (module.getProject().isDisposed()) {
                    return;
                }
                final PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
                properties.setValue(module.getModule().getName() + ".azure", "hide");
                Optional.of(module.getProject())
                    .map(ProjectView::getInstance)
                    .map(ProjectView::getCurrentProjectViewPane)
                    .ifPresent(p -> p.updateFromRoot(true));
            })
            .withAuthRequired(false)
            .register(am);

        new Action<>(CONNECT_TO_MODULE)
            .withLabel("Connect Azure Resource...")
            .withIcon(AzureIcons.Connector.CONNECT.getIconPath())
            .withHandler((target, e) -> {
                if (target instanceof AzureModule module) {
                    AzureTaskManager.getInstance().runLater(() -> ModuleConnectorAction.connectModuleToAzureResource(module.getModule()));
                } else if (target instanceof ConnectionManager cm) {
                    AzureTaskManager.getInstance().runLater(() -> ModuleConnectorAction.connectModuleToAzureResource(cm.getProfile().getModule().getModule()));
                }
            })
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(REFRESH_CONNECTIONS)
            .withLabel("Refresh")
            .withIcon(AzureIcons.Action.REFRESH.getIconPath())
            .withHandler((project, e) -> refreshConnections((AnActionEvent) e))
            .withShortcut(am.getIDEDefaultShortcuts().refresh())
            .withAuthRequired(false)
            .register(am);

        new Action<>(ADD_CONNECTION)
            .withLabel("Add")
            .withIcon(AzureIcons.Action.ADD.getIconPath())
            .visibleWhen(m -> m instanceof AzureModule)
            .withHandler((m) -> openDialog(null, new ModuleResource(m.getName()), m.getProject()))
            .withShortcut(am.getIDEDefaultShortcuts().add())
            .withAuthRequired(false)
            .register(am);

        new Action<>(EDIT_CONNECTION)
            .withLabel("Edit")
            .withIcon(AzureIcons.Action.EDIT.getIconPath())
            .visibleWhen(m -> m instanceof Connection<?, ?>)
            .withHandler((c, e) -> openDialog(c, ((AnActionEvent) e).getProject()))
            .withShortcut(am.getIDEDefaultShortcuts().edit())
            .withAuthRequired(false)
            .register(am);

        new Action<>(EDIT_ENV_FILE_IN_EDITOR)
            .withLabel("Open In Editor")
            .withIcon(AzureIcons.Action.EDIT.getIconPath())
            .visibleWhen(m -> m instanceof Connection<?, ?>)
            .withHandler((c, e) -> AzureTaskManager.getInstance().runLater(() -> editEnvInEditor(c, ((AnActionEvent) e).getProject())))
            .withAuthRequired(false)
            .register(am);

        new Action<>(FIX_CONNECTION)
                .withLabel("Edit Connection...")
                .withIcon(AzureIcons.Action.EDIT.getIconPath())
                .visibleWhen(m -> m instanceof Connection<?, ?>)
                .withHandler((c, e) -> fixResourceConnection(c, ((AnActionEvent) e).getProject()))
                .withAuthRequired(false)
                .register(am);

        new Action<>(REMOVE_CONNECTION)
            .withLabel("Remove Resource Connection")
            .withIcon(AzureIcons.Action.REMOVE.getIconPath())
            .visibleWhen(m -> m instanceof Connection<?, ?>)
            .withHandler((c, e) -> ResourceConnectionActionsContributor.removeConnection(c, (AnActionEvent) e))
            .withShortcut(am.getIDEDefaultShortcuts().delete())
            .withAuthRequired(false)
            .register(am);

        new Action<>(COPY_ENV_KEY)
            .withIcon(AzureIcons.Action.COPY.getIconPath())
            .withLabel("Copy Key")
            .withHandler((s, e) -> {
                am.getAction(ResourceCommonActionsContributor.COPY_STRING).handle(s.getKey(), e);
                AzureMessager.getMessager().success(AzureString.format("Environment variable key is copied into clipboard."));
            })
            .withAuthRequired(false)
            .register(am);
        new Action<>(COPY_ENV_PAIR)
            .withIcon(AzureIcons.Action.COPY.getIconPath())
            .withLabel("Copy")
            .withHandler((pair, e) -> {
                am.getAction(ResourceCommonActionsContributor.COPY_STRING).handle(String.format("%s=%s", pair.getKey(), pair.getValue()), e);
                AzureMessager.getMessager().success(AzureString.format("Environment variable key/value pair is copied into clipboard."));
            })
            .withShortcut(am.getIDEDefaultShortcuts().copy())
            .withAuthRequired(false)
            .register(am);
        new Action<>(COPY_ENV_VARS)
            .withIcon(AzureIcons.Action.COPY.getIconPath())
            .withLabel("Copy All")
            .withHandler((c, e) -> {
                final List<Pair<String, String>> variables = c.getGeneratedEnvironmentVariables();
                final String str = variables.stream().map(v -> String.format("%s=%s", v.getKey(), v.getValue())).collect(Collectors.joining(System.lineSeparator()));
                am.getAction(ResourceCommonActionsContributor.COPY_STRING).handle(str, e);
                AzureMessager.getMessager().success(AzureString.format("Environment variables are copied into clipboard."));
            })
            .withShortcut(am.getIDEDefaultShortcuts().copy())
            .withAuthRequired(false)
            .register(am);
    }