Search in sources :

Example 1 with AzureDockerSubscription

use of com.microsoft.azure.docker.model.AzureDockerSubscription in project azure-tools-for-java by Microsoft.

the class AzureNewDockerConfigPage method updateDockerSubscriptionComboBox.

private void updateDockerSubscriptionComboBox(Composite mainContainer) {
    dockerSubscriptionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (selection.size() > 0) {
                AzureDockerSubscription currentSubscription = (AzureDockerSubscription) selection.getFirstElement();
                dockerSubscriptionIdTextField.setText(currentSubscription != null ? currentSubscription.id : "");
                wizard.setSubscription(currentSubscription);
                errDispatcher.removeMessage("dockerSubscriptionCombo", dockerSubscriptionCombo);
                updateDockerLocationComboBox(mainContainer, currentSubscription);
                updateDockerHostSelectRGComboBox(mainContainer, currentSubscription);
                String region = (String) dockerLocationComboBox.getText();
                Region regionObj = Region.findByLabelOrName(region);
                updateDockerSelectVnetComboBox(mainContainer, currentSubscription, regionObj != null ? regionObj.name() : region);
                updateDockerSelectStorageComboBox(mainContainer, currentSubscription);
                setPageComplete(doValidate());
            } else {
                errDispatcher.addMessage("dockerSubscriptionCombo", "No active subscriptions found", null, IMessageProvider.ERROR, dockerSubscriptionCombo);
                setPageComplete(false);
            }
        }
    });
    dockerSubscriptionComboViewer.setContentProvider(ArrayContentProvider.getInstance());
    dockerSubscriptionComboViewer.setInput(dockerManager.getSubscriptionsList());
    if (dockerManager.getSubscriptionsList() != null && dockerManager.getSubscriptionsList().size() > 0) {
        dockerSubscriptionCombo.select(0);
        dockerSubscriptionIdTextField.setText(((AzureDockerSubscription) ((StructuredSelection) dockerSubscriptionComboViewer.getSelection()).getFirstElement()).id);
        wizard.setSubscription((AzureDockerSubscription) ((StructuredSelection) dockerSubscriptionComboViewer.getSelection()).getFirstElement());
    }
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) AzureDockerSubscription(com.microsoft.azure.docker.model.AzureDockerSubscription) Region(com.microsoft.azure.management.resources.fluentcore.arm.Region) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 2 with AzureDockerSubscription

use of com.microsoft.azure.docker.model.AzureDockerSubscription in project azure-tools-for-java by Microsoft.

the class AzureNewDockerConfigPage method updateDockerLocationGroup.

private void updateDockerLocationGroup(Composite mainContainer) {
    AzureDockerSubscription currentSubscription = getCurrentSubscription();
    dockerLocationComboBox.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String region = dockerLocationComboBox.getText();
            if (!region.equals(SELECT_REGION)) {
                Region regionObj = Region.findByLabelOrName(region);
                String selectedRegion = regionObj != null ? regionObj.name() : region;
                if (preferredLocation == null && selectedRegion != null) {
                    // remove the SELECT_REGION entry (first entry in the
                    // list)
                    dockerLocationComboBox.remove(SELECT_REGION);
                }
                preferredLocation = selectedRegion;
                updateDockerSelectVnetComboBox(mainContainer, currentSubscription, selectedRegion);
                setPageComplete(doValidate());
            } else {
                updateDockerSelectVnetComboBox(mainContainer, currentSubscription, null);
                setPageComplete(false);
            }
            updateDockerHostVMSizeComboBox(mainContainer, dockerHostVMPreferredSizesCheckBox.getSelection());
        }
    });
    updateDockerLocationComboBox(mainContainer, currentSubscription);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) AzureDockerSubscription(com.microsoft.azure.docker.model.AzureDockerSubscription) Region(com.microsoft.azure.management.resources.fluentcore.arm.Region)

Example 3 with AzureDockerSubscription

use of com.microsoft.azure.docker.model.AzureDockerSubscription in project azure-tools-for-java by Microsoft.

the class AzureNewDockerConfigPage method validateDockerSubscription.

private boolean validateDockerSubscription() {
    // Subscription
    AzureDockerSubscription currentSubscription = getCurrentSubscription();
    if (currentSubscription == null || currentSubscription.id == null || currentSubscription.id.isEmpty()) {
        String errMsg = "Subscription not found";
        errDispatcher.addMessage("dockerSelectStorageComboBox", errMsg, null, IMessageProvider.ERROR, dockerSelectStorageComboBox);
        setErrorMessage(errMsg);
        return false;
    } else {
        newHost.sid = currentSubscription.id;
        errDispatcher.removeMessage("dockerSelectStorageComboBox", dockerSelectStorageComboBox);
        setErrorMessage(null);
        return true;
    }
}
Also used : AzureDockerSubscription(com.microsoft.azure.docker.model.AzureDockerSubscription)

Aggregations

AzureDockerSubscription (com.microsoft.azure.docker.model.AzureDockerSubscription)3 Region (com.microsoft.azure.management.resources.fluentcore.arm.Region)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1