Search in sources :

Example 56 with Subscription

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);
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 57 with 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);
    }
}
Also used : AzureManager(com.microsoft.azuretools.sdkmanage.AzureManager) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 58 with Subscription

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();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 59 with Subscription

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();
}
Also used : Region(com.microsoft.azure.toolkit.lib.common.model.Region) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 60 with Subscription

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();
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Aggregations

Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)130 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)26 Region (com.microsoft.azure.toolkit.lib.common.model.Region)18 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)18 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)15 ArrayList (java.util.ArrayList)14 IOException (java.io.IOException)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Project (com.intellij.openapi.project.Project)8 Azure (com.microsoft.azure.toolkit.lib.Azure)8 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)8 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)8 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)8 HashMap (java.util.HashMap)8 List (java.util.List)8 StringUtils (org.apache.commons.lang3.StringUtils)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 Point (org.eclipse.swt.graphics.Point)8 GridData (org.eclipse.swt.layout.GridData)8 Combo (org.eclipse.swt.widgets.Combo)8