public void registerActions()

in Utils/azure-toolkit-ide-hdinsight-libs/azure-toolkit-ide-cosmos-spark-lib/src/main/java/com/microsoft/azure/toolkit/ide/cosmos/spark/SparkOnCosmosActionsContributor.java [44:143]


    public void registerActions(AzureActionManager am) {
        new Action<>(GROUP_CREATE_SOC_SERVICE)
                .withLabel("Apache Spark on Cosmos")
                .withIdParam(AzResource::getName)
                .visibleWhen(s -> s instanceof ResourceGroup)
                .enableWhen(s -> true)
                .register(am);

        new Action<>(OPEN_NOTEBOOK)
                .withLabel("Open Notebook")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .withHandler(resource -> {
                    try {
                        Desktop.getDesktop().browse(URI.create(SPARK_NOTEBOOK_LINK));
                    } catch (IOException ignore) {
                    }
                })
                .register(am);

        new Action<>(PROVISION_CLUSTER)
                .withLabel("Provision Spark Cluster")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .register(am);

        new Action<>(SUBMIT_SOC_SERVERLESS_JOB)
                .withLabel("Submit Apache Spark on Cosmos Serverless Job")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .register(am);

        new Action<>(VIEW_SOC_SERVERLESS_JOB)
                .withLabel("View Apache Spark on Cosmos Serverless Jobs")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .register(am);

        new Action<>(DELETE_CLUSTER)
                .withLabel("Delete")
                .enableWhen(s -> s.getRemote().isRunning())
                .withAuthRequired(false)
                .withHandler(r->{})
                .register(am);

        new Action<>(OPEN_SPARK_HISTORY_UI)
                .withLabel("Open Spark History UI")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .withHandler(r->{
                    try {
                        AzureSparkCosmosCluster remote = r.getRemote();
                        SparkOnCosmosClusterModule module = (SparkOnCosmosClusterModule) r.getModule();
                        SparkOnCosmosADLAccountNode adlAccountNode = module.getAdlAccountNode();
                        AzureSparkServerlessAccount adlAccount = adlAccountNode.getRemote();
                        String suffix = "/?adlaAccountName=" + adlAccount.getName();
                        Desktop.getDesktop().browse(URI.create(String.valueOf(remote.getSparkHistoryUiUri() + suffix)));
                    } catch (IOException ignore) {
                    }
                })
                .register(am);

        new Action<>(OPEN_SPARK_MASTER_UI)
                .withLabel("Open Spark Master UI")
                .enableWhen(s -> true)
                .withAuthRequired(false)
                .withHandler(r->{
                    try {
                        AzureSparkCosmosCluster remote = r.getRemote();
                        SparkOnCosmosClusterModule module = (SparkOnCosmosClusterModule) r.getModule();
                        SparkOnCosmosADLAccountNode adlAccountNode = module.getAdlAccountNode();
                        AzureSparkServerlessAccount adlAccount = adlAccountNode.getRemote();
                        String suffix = "/?adlaAccountName=" + adlAccount.getName();
                        Desktop.getDesktop().browse(URI.create(String.valueOf(remote.getSparkMasterUiUri() + suffix)));
                    } catch (IOException ignore) {
                    }
                })
                .register(am);

        new Action<>(VIEW_CLUSTER_STATUS)
                .withLabel("View Cluster Status")
                .enableWhen(s -> s.getRemote().isRunning())
                .withAuthRequired(false)
                .withHandler(r->{})
                .register(am);

        new Action<>(SUBMIT_CLUSTER_JOB)
                .withLabel("Submit Job")
                .enableWhen(s -> s.getRemote().isStable())
                .withAuthRequired(false)
                .withHandler(r->{})
                .register(am);

        new Action<>(UPDATE_CLUSTER)
                .withLabel("Update")
                .enableWhen(s -> s.getRemote().isStable())
                .withAuthRequired(false)
                .withHandler(r->{})
                .register(am);
    }