use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class MySQLCreationAdvancedPanel method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof Subscription) {
final Subscription subscription = (Subscription) e.getItem();
this.resourceGroupComboBox.setSubscription(subscription);
this.serverNameTextField.setSubscriptionId(subscription.getId());
this.regionComboBox.setSubscription(subscription);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class SubscriptionStep method loadSubscriptions.
private void loadSubscriptions() {
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
/*
* if (manager.authenticated()) { String upn =
* manager.getUserInfo().getUniqueName();
* userInfoLabel.setText("Signed in as: " + (upn.contains("#") ?
* upn.split("#")[1] : upn)); } else { userInfoLabel.setText(""); }
*/
List<Subscription> Subscriptions = AuthMethodManager.getInstance().getAzureManager().getSelectedSubscriptions();
for (Subscription subscription : Subscriptions) {
if (subscription.isSelected()) {
subscriptionComboBox.add(subscription.getName());
subscriptionComboBox.setData(subscription.getName(), subscription);
}
}
if (!Subscriptions.isEmpty()) {
subscriptionComboBox.select(0);
wizard.setSubscription((Subscription) subscriptionComboBox.getData(subscriptionComboBox.getText()));
}
setPageComplete(!Subscriptions.isEmpty());
} catch (Exception ex) {
DefaultLoader.getUIHelper().logError("An error occurred when trying to load Subscriptions\n\n" + ex.getMessage(), ex);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class SubscriptionStep method createSubscriptionCombo.
private void createSubscriptionCombo(Composite container) {
Composite composite = new Composite(container, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = GridData.BEGINNING;
gridData.grabExcessHorizontalSpace = true;
composite.setLayout(gridLayout);
composite.setLayoutData(gridData);
this.subscriptionLabel = new Label(composite, SWT.LEFT);
this.subscriptionLabel.setText("Choose the subscription to use when creating the new virtual machine:");
this.subscriptionComboBox = new Combo(composite, SWT.READ_ONLY);
gridData = new GridData();
// gridData.widthHint = 182;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
subscriptionComboBox.setLayoutData(gridData);
subscriptionComboBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (subscriptionComboBox.getText() != null && !(subscriptionComboBox.getText().length() == 0)) {
wizard.setSubscription((Subscription) subscriptionComboBox.getData(subscriptionComboBox.getText()));
}
}
});
loadSubscriptions();
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class SelectImageStep method fillRegions.
private void fillRegions() {
regionComboBox.removeAll();
Subscription subs = wizard.getSubscription();
List<Region> locations = Azure.az(AzureAccount.class).listRegions(subs.getId());
for (Region location : locations) {
regionComboBox.add(location.getLabel());
regionComboBox.setData(location.getLabel(), location);
}
if (locations.size() > 0) {
regionComboBox.select(0);
selectRegion();
}
regionComboBox.setEnabled(true);
validateNext();
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class PublishWebAppOnLinuxDialog method renderSubscriptionList.
@Override
public void renderSubscriptionList(List<Subscription> list) {
subscriptionList = list;
cpNew.cbSubscription.removeAll();
for (Subscription sub : subscriptionList) {
cpNew.cbSubscription.add(sub.getName());
}
if (cpNew.cbSubscription.getItemCount() > 0) {
cpNew.cbSubscription.select(0);
}
onSubscriptionSelection();
}
Aggregations