Search in sources :

Example 1 with CreateArmStorageAccountForm

use of com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm 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)

Example 2 with CreateArmStorageAccountForm

use of com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm in project azure-tools-for-java by Microsoft.

the class SettingsStep method showNewStorageForm.

private void showNewStorageForm() {
    final CreateArmStorageAccountForm form = new CreateArmStorageAccountForm(PluginUtil.getParentShell(), wizard.getSubscription(), wizard.getRegion());
    form.setOnCreate(new Runnable() {

        @Override
        public void run() {
            StorageAccountConfig newStorageAccount = form.getStorageAccount();
            if (newStorageAccount != null) {
                wizard.setNewStorageAccount(newStorageAccount);
                wizard.setWithNewStorageAccount(true);
                wizard.setStorageAccount(null);
                AzureTaskManager.getInstance().runLater(() -> {
                    storageComboBox.add(newStorageAccount.getName() + " (New)", 0);
                    storageComboBox.select(0);
                });
            }
        }
    });
    form.open();
}
Also used : CreateArmStorageAccountForm(com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm) StorageAccountConfig(com.microsoft.azure.toolkit.lib.storage.model.StorageAccountConfig)

Aggregations

StorageAccountConfig (com.microsoft.azure.toolkit.lib.storage.model.StorageAccountConfig)2 CreateArmStorageAccountForm (com.microsoft.azuretools.azureexplorer.forms.CreateArmStorageAccountForm)2 Azure (com.microsoft.azure.toolkit.lib.Azure)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 AzureStorageAccount (com.microsoft.azure.toolkit.lib.storage.service.AzureStorageAccount)1 StorageAccount (com.microsoft.azure.toolkit.lib.storage.service.StorageAccount)1 Draft (com.microsoft.azuretools.azureexplorer.forms.common.Draft)1 SignInCommandHandler (com.microsoft.azuretools.core.handlers.SignInCommandHandler)1 Messages (com.microsoft.azuretools.core.utils.Messages)1 PluginUtil (com.microsoft.azuretools.core.utils.PluginUtil)1 CREATE_STORAGE_ACCOUNT (com.microsoft.azuretools.telemetry.TelemetryConstants.CREATE_STORAGE_ACCOUNT)1 STORAGE (com.microsoft.azuretools.telemetry.TelemetryConstants.STORAGE)1 EventUtil (com.microsoft.azuretools.telemetrywrapper.EventUtil)1 Name (com.microsoft.tooling.msservices.helpers.Name)1 NodeActionEvent (com.microsoft.tooling.msservices.serviceexplorer.NodeActionEvent)1 NodeActionListener (com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener)1 StorageModule (com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageModule)1