Search in sources :

Example 1 with NodeActionEvent

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

the class WebappNode method loadActions.

@Override
protected void loadActions() {
    addAction(ACTION_STOP, WEB_STOP_ICON, new NodeActionListener() {

        @Override
        public void actionPerformed(NodeActionEvent e) {
            DefaultLoader.getIdeHelper().runInBackground(null, "Stopping Web App", false, true, "Stopping Web App...", new Runnable() {

                @Override
                public void run() {
                    webApp.stop();
                    setIconPath(WEB_STOP_ICON);
                }
            });
        }
    });
    addAction("Start", new NodeActionListener() {

        @Override
        public void actionPerformed(NodeActionEvent e) {
            DefaultLoader.getIdeHelper().runInBackground(null, "Starting Web App", false, true, "Starting Web App...", new Runnable() {

                @Override
                public void run() {
                    webApp.start();
                    setIconPath(WEB_RUN_ICON);
                }
            });
        }
    });
    addAction(ACTION_RESTART, new NodeActionListener() {

        @Override
        public void actionPerformed(NodeActionEvent e) {
            DefaultLoader.getIdeHelper().runInBackground(null, "Restarting Web App", false, true, "Restarting Web App...", new Runnable() {

                @Override
                public void run() {
                    webApp.restart();
                    setIconPath(WEB_RUN_ICON);
                }
            });
        }
    });
    addAction("Delete", new DeleteWebAppAction());
    super.loadActions();
}
Also used : NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent)

Example 2 with NodeActionEvent

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

the class HDInsightHelperImpl method createAddNewHDInsightReaderClusterAction.

@NotNull
public NodeActionListener createAddNewHDInsightReaderClusterAction(@NotNull HDInsightRootModule module, @NotNull ClusterDetail clusterDetail) {
    return new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent nodeActionEvent) throws AzureCmdException {
            AddNewHDInsightReaderClusterForm linkClusterForm = new AddNewHDInsightReaderClusterForm(PluginUtil.getParentShell(), module, clusterDetail);
            linkClusterForm.open();
        }
    };
}
Also used : NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) AddNewHDInsightReaderClusterForm(com.microsoft.azuretools.azureexplorer.forms.AddNewHDInsightReaderClusterForm) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Example 3 with NodeActionEvent

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

the class CosmosSparkClusterRootModuleImpl method loadActions.

@Override
protected void loadActions() {
    super.loadActions();
    addAction("Open Notebook", new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) {
            try {
                Desktop.getDesktop().browse(URI.create(SPARK_NOTEBOOK_LINK));
            } catch (IOException ignore) {
            }
        }
    });
}
Also used : NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) IOException(java.io.IOException)

Example 4 with NodeActionEvent

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

the class BlobExplorerFileEditor method createVirtualNode.

private FileEditorVirtualNode<EditorPart> createVirtualNode(final String name) {
    final FileEditorVirtualNode<EditorPart> node = new FileEditorVirtualNode<EditorPart>(this, name);
    node.addAction(COPY_URL, new WrappedTelemetryNodeActionListener(STORAGE, BLOB_COPYURL, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
            copyURLSelectedFile();
        }
    }));
    node.addAction(SAVE_AS, new WrappedTelemetryNodeActionListener(STORAGE, BLOB_SAVEAS, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
            saveAsSelectedFile();
        }
    }));
    node.addAction(DELETE, new WrappedTelemetryNodeActionListener(STORAGE, BLOB_DELETE, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
            deleteSelectedFile();
        }
    }));
    node.addAction(SEARCH, new WrappedTelemetryNodeActionListener(STORAGE, BLOB_SEARCH, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
            fillGrid();
        }
    }));
    node.addAction(UPLOAD_BLOB, new WrappedTelemetryNodeActionListener(STORAGE, BLOB_UPLOAD, new NodeActionListener() {

        @Override
        protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
            uploadFile();
        }
    }));
    return node;
}
Also used : WrappedTelemetryNodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.WrappedTelemetryNodeActionListener) WrappedTelemetryNodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.WrappedTelemetryNodeActionListener) NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) EditorPart(org.eclipse.ui.part.EditorPart)

Example 5 with NodeActionEvent

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

the class CreateArmStorageAccountAction method actionPerformed.

@Override
public void actionPerformed(NodeActionEvent e) {
    SignInCommandHandler.requireSignedIn(PluginUtil.getParentShell(), () -> {
        CreateArmStorageAccountForm createStorageAccountForm = new CreateArmStorageAccountForm(PluginUtil.getParentShell(), null, null);
        createStorageAccountForm.setOnCreate(() -> {
            AzureTaskManager.getInstance().runInBackground("Creating storage account " + createStorageAccountForm.getStorageAccount().getName() + "...", new Runnable() {

                @Override
                public void run() {
                    EventUtil.executeWithLog(STORAGE, CREATE_STORAGE_ACCOUNT, (operation) -> {
                        createStorageAccount(createStorageAccountForm.getStorageAccount());
                        storageModule.load(false);
                    }, (e) -> AzureTaskManager.getInstance().runLater(() -> PluginUtil.displayErrorDialog(PluginUtil.getParentShell(), Messages.err, "An error occurred while creating the storage account: " + e.getMessage())));
                }
            });
        });
        createStorageAccountForm.open();
    });
}
Also used : NodeActionListener(com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener) Azure(com.microsoft.azure.toolkit.lib.Azure) Messages(com.microsoft.azuretools.core.utils.Messages) AzureStorageAccount(com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount) Name(com.microsoft.tooling.msservices.helpers.Name) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup) StorageAccountConfig(com.microsoft.azure.toolkit.lib.storage.model.StorageAccountConfig) CREATE_STORAGE_ACCOUNT(com.microsoft.azuretools.telemetry.TelemetryConstants.CREATE_STORAGE_ACCOUNT) SignInCommandHandler(com.microsoft.azuretools.core.handlers.SignInCommandHandler) AzureTelemetry(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry) Draft(com.microsoft.azuretools.azureexplorer.forms.common.Draft) CreateArmStorageAccountForm(com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm) StorageModule(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageModule) PluginUtil(com.microsoft.azuretools.core.utils.PluginUtil) AzureGroup(com.microsoft.azure.toolkit.lib.resource.AzureGroup) StorageAccount(com.microsoft.azure.toolkit.lib.storage.service.StorageAccount) STORAGE(com.microsoft.azuretools.telemetry.TelemetryConstants.STORAGE) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) NodeActionEvent(com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) CreateArmStorageAccountForm(com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm)

Aggregations

NodeActionEvent (com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent)14 NodeActionListener (com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener)14 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)3 EditorPart (org.eclipse.ui.part.EditorPart)3 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)2 WrappedTelemetryNodeActionListener (com.microsoft.tooling.msservices.serviceexplorer.WrappedTelemetryNodeActionListener)2 ClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.ClusterDetail)1 EmulatorClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.EmulatorClusterDetail)1 HDInsightAdditionalClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.HDInsightAdditionalClusterDetail)1 IClusterDetail (com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail)1 AddNewHDInsightReaderClusterForm (com.microsoft.azure.hdinsight.serverexplore.ui.AddNewHDInsightReaderClusterForm)1 Azure (com.microsoft.azure.toolkit.lib.Azure)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)1 AzureTaskManager (com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager)1 AzureTelemetry (com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetry)1 AzureGroup (com.microsoft.azure.toolkit.lib.resource.AzureGroup)1 StorageAccountConfig (com.microsoft.azure.toolkit.lib.storage.model.StorageAccountConfig)1 AzureStorageAccount (com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount)1 StorageAccount (com.microsoft.azure.toolkit.lib.storage.service.StorageAccount)1