private void createRegionSection(Composite composite) { Group regionGroup = newGroup(composite, "", 2); regionGroup.setLayout(new GridLayout(2, false)); newLabel(regionGroup, "Region:"); regionCombo = newCombo(regionGroup); for (Region region : RegionUtils.getRegionsForService(ServiceAbbreviations.BEANSTALK)) { regionCombo.add(region.getName()); regionCombo.setData(region.getName(), region); } Region region = RegionUtils.getRegionByEndpoint(wizardDataModel.getRegionEndpoint()); regionCombo.setText(region.getName()); newFillingLabel( regionGroup, "AWS regions are geographically isolated, " + "allowing you to position your Elastic Beanstalk application closer to you or your customers.", 2); regionChangeListener = new SelectionListener() { public void widgetSelected(SelectionEvent e) { Region region = (Region) regionCombo.getData(regionCombo.getText()); String endpoint = region.getServiceEndpoints().get(ServiceAbbreviations.BEANSTALK); elasticBeanstalkClient = AwsToolkitCore.getClientFactory().getElasticBeanstalkClientByEndpoint(endpoint); wizardDataModel.setRegion(region); if (wizardDataModel.getKeyPairComposite() != null) { wizardDataModel .getKeyPairComposite() .getKeyPairSelectionTable() .setEc2RegionOverride(region); } createNewApplicationRadioButtonObservable.setValue(true); existingApplicationCombo.setEnabled(false); newApplicationNameText.setEnabled(true); newApplicationDescriptionText.setEnabled(true); refreshApplications(); refreshEnvironments(); } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }; regionCombo.addSelectionListener(regionChangeListener); }
/** Initializes the page to its default selections */ private void initializeDefaults() { createNewApplicationRadioButtonObservable.setValue(true); existingApplicationRadioButton.setSelection(false); newApplicationNameTextObservable.setValue(""); newApplicationDescriptionTextObservable.setValue(""); newEnvironmentNameTextObservable.setValue(""); newEnvironmentDescriptionTextObservable.setValue(""); environmentTypeComboObservable.setValue(ConfigurationOptionConstants.LOAD_BALANCED_ENV); if (RegionUtils.isServiceSupportedInCurrentRegion(ServiceAbbreviations.BEANSTALK)) { regionCombo.setText(RegionUtils.getCurrentRegion().getName()); wizardDataModel.setRegion(RegionUtils.getCurrentRegion()); } else { regionCombo.setText(RegionUtils.getRegion(ElasticBeanstalkPlugin.DEFAULT_REGION).getName()); wizardDataModel.setRegion(RegionUtils.getRegion(ElasticBeanstalkPlugin.DEFAULT_REGION)); } regionChangeListener.widgetSelected(null); // Trigger the standard enabled / disabled control logic radioButtonSelected(createNewApplicationRadioButton); }