use of com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode 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();
}
use of com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode in project azure-tools-for-java by Microsoft.
the class ConfirmDialogAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageNode node = (ExternalStorageNode) e.getAction().getNode();
final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) node.getProject());
form.setTitle("Storage Account Key Required");
form.setStorageAccount(node.getClientStorageAccount());
form.setOnFinish(new Runnable() {
@Override
public void run() {
node.getClientStorageAccount().setPrimaryKey(form.getPrimaryKey());
ClientStorageAccount clientStorageAccount = StorageClientSDKManager.getManager().getStorageAccount(node.getClientStorageAccount().getConnectionString());
node.getClientStorageAccount().setPrimaryKey(clientStorageAccount.getPrimaryKey());
node.getClientStorageAccount().setBlobsUri(clientStorageAccount.getBlobsUri());
node.getClientStorageAccount().setQueuesUri(clientStorageAccount.getQueuesUri());
node.getClientStorageAccount().setTablesUri(clientStorageAccount.getTablesUri());
node.load(false);
}
});
form.show();
}
use of com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode in project azure-tools-for-java by Microsoft.
the class AttachExternalStorageAccountAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageAccountForm form = new ExternalStorageAccountForm(PluginUtil.getParentShell(), "Attach External Storage Account");
form.setOnFinish(new Runnable() {
@Override
public void run() {
DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
public void run() {
ClientStorageAccount storageAccount = form.getStorageAccount();
ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
for (ClientStorageAccount clientStorageAccount : ExternalStorageHelper.getList(null)) {
String name = storageAccount.getName();
if (clientStorageAccount.getName().equals(name)) {
DefaultLoader.getUIHelper().showError("Storage account with name '" + name + "' already exists.", "Service Explorer");
return;
}
}
ExternalStorageNode node = new ExternalStorageNode(storageModule, fullStorageAccount);
storageModule.addChildNode(node);
ExternalStorageHelper.add(storageAccount);
}
});
}
});
form.open();
}
use of com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode in project azure-tools-for-java by Microsoft.
the class AttachExternalStorageAccountAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) storageModule.getProject());
form.setTitle("Attach External Storage Account");
form.setOnFinish(new Runnable() {
@Override
public void run() {
ClientStorageAccount storageAccount = form.getStorageAccount();
ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
for (ClientStorageAccount clientStorageAccount : ExternalStorageHelper.getList(storageModule.getProject())) {
String name = storageAccount.getName();
if (clientStorageAccount.getName().equals(name)) {
JOptionPane.showMessageDialog(form.getContentPane(), "Storage account with name '" + name + "' already exists.", "Azure Explorer", JOptionPane.ERROR_MESSAGE);
return;
}
}
ExternalStorageNode node = new ExternalStorageNode(storageModule, fullStorageAccount);
storageModule.addChildNode(node);
ExternalStorageHelper.add(storageAccount);
}
});
form.show();
}
Aggregations