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());
}
}
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);
}
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;
}
}
Aggregations