Search in sources :

Example 1 with StorageModule

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

the class ModifyExternalStorageAccountAction method actionPerformed.

@Override
public void actionPerformed(NodeActionEvent e) {
    final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) storageNode.getProject());
    form.setTitle("Modify External Storage Account");
    for (ClientStorageAccount account : ExternalStorageHelper.getList(storageNode.getProject())) {
        if (account.getName().equals(storageNode.getClientStorageAccount().getName())) {
            form.setStorageAccount(account);
        }
    }
    form.setOnFinish(new Runnable() {

        @Override
        public void run() {
            ClientStorageAccount oldStorageAccount = storageNode.getClientStorageAccount();
            ClientStorageAccount storageAccount = StorageClientSDKManager.getManager().getStorageAccount(form.getStorageAccount().getConnectionString());
            ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
            StorageModule parent = (StorageModule) storageNode.getParent();
            parent.removeDirectChildNode(storageNode);
            parent.addChildNode(new ExternalStorageNode(parent, fullStorageAccount));
            ExternalStorageHelper.detach(oldStorageAccount);
            ExternalStorageHelper.add(form.getStorageAccount());
        }
    });
    form.show();
}
Also used : StorageModule(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageModule) ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount) ExternalStorageAccountForm(com.microsoft.intellij.forms.ExternalStorageAccountForm) ExternalStorageNode(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode)

Aggregations

ExternalStorageAccountForm (com.microsoft.intellij.forms.ExternalStorageAccountForm)1 ClientStorageAccount (com.microsoft.tooling.msservices.model.storage.ClientStorageAccount)1 ExternalStorageNode (com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode)1 StorageModule (com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageModule)1