use of com.microsoft.azure.toolkit.lib.storage.service.StorageAccount in project azure-tools-for-java by Microsoft.
the class SettingsStep method retrieveStorageAccounts.
private void retrieveStorageAccounts() {
AzureTaskManager.getInstance().runInBackground("Loading storage accounts...", new Runnable() {
@Override
public void run() {
if (storageAccounts == null) {
List<StorageAccount> accounts = Azure.az(AzureStorageAccount.class).subscription(wizard.getSubscription().getId()).list();
storageAccounts = new TreeMap<String, StorageAccount>();
for (StorageAccount storageAccount : accounts) {
storageAccounts.put(storageAccount.name(), storageAccount);
}
}
fillStorage(null);
}
});
storageComboBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (CREATE_NEW.equals(storageComboBox.getText())) {
showNewStorageForm();
} else if (storageComboBox.getData(storageComboBox.getText()) != null) {
StorageAccount storageAccount = (StorageAccount) storageComboBox.getData(storageComboBox.getText());
wizard.setStorageAccount(storageAccount);
}
}
});
if (storageAccounts == null) {
DefaultLoader.getIdeHelper().invokeAndWait(new Runnable() {
@Override
public void run() {
storageComboBox.setItems(new String[] { CREATE_NEW, LOADING });
}
});
}
}
use of com.microsoft.azure.toolkit.lib.storage.service.StorageAccount in project azure-tools-for-java by Microsoft.
the class IntellijStorageActionsContributor method registerHandlers.
@Override
public void registerHandlers(AzureActionManager am) {
final BiPredicate<Object, AnActionEvent> condition = (r, e) -> r instanceof AzureStorageAccount;
final BiConsumer<Object, AnActionEvent> handler = (c, e) -> CreateStorageAccountAction.createStorageAccount((e.getProject()));
am.registerHandler(ResourceCommonActionsContributor.CREATE, condition, handler);
am.<IAzureResource<?>, AnActionEvent>registerHandler(ResourceCommonActionsContributor.CONNECT, (r, e) -> r instanceof StorageAccount, (r, e) -> AzureTaskManager.getInstance().runLater(() -> {
final ConnectorDialog dialog = new ConnectorDialog(e.getProject());
dialog.setResource(new AzureServiceResource<>(((StorageAccount) r), StorageAccountResourceDefinition.INSTANCE));
dialog.show();
}));
}
use of com.microsoft.azure.toolkit.lib.storage.service.StorageAccount in project azure-tools-for-java by Microsoft.
the class SettingsStep method retrieveStorageAccounts.
private void retrieveStorageAccounts() {
final AzureString title = AzureOperationBundle.title("vm.list_storage_accounts");
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
progressIndicator.setIndeterminate(true);
if (storageAccounts == null) {
List<StorageAccount> accounts = Azure.az(AzureStorageAccount.class).subscription(model.getSubscription().getId()).list();
storageAccounts = new TreeMap<>();
for (StorageAccount storageAccount : accounts) {
storageAccounts.put(storageAccount.name(), storageAccount);
}
}
refreshStorageAccounts(null);
}));
if (storageAccounts == null) {
final DefaultComboBoxModel loadingSAModel = new DefaultComboBoxModel(new String[] { CREATE_NEW, "<Loading...>" }) {
@Override
public void setSelectedItem(Object o) {
if (CREATE_NEW.equals(o)) {
showNewStorageForm();
} else {
super.setSelectedItem(o);
}
}
};
loadingSAModel.setSelectedItem(null);
AzureTaskManager.getInstance().runAndWait(() -> storageComboBox.setModel(loadingSAModel), AzureTask.Modality.ANY);
}
}
Aggregations