use of com.microsoft.azure.management.compute.AvailabilitySet in project azure-tools-for-java by Microsoft.
the class SettingsStep method retrieveAvailabilitySets.
private void retrieveAvailabilitySets() {
DefaultLoader.getIdeHelper().runInBackground(null, "Loading availability sets...", false, true, "Loading availability sets...", new Runnable() {
@Override
public void run() {
if (availabilitySets == null) {
availabilitySets = wizard.getAzure().availabilitySets().list();
}
DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
@Override
public void run() {
availabilityCombo.removeAll();
availabilityCombo.add(NONE);
availabilityCombo.add(CREATE_NEW);
for (AvailabilitySet availabilitySet : availabilitySets) {
availabilityCombo.add(availabilitySet.name());
availabilityCombo.setData(availabilitySet.name(), availabilitySet);
}
availabilityCombo.select(0);
}
});
}
});
availabilityCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (NONE.equals(availabilityCombo.getText())) {
wizard.setAvailabilitySet(null);
wizard.setWithNewAvailabilitySet(false);
} else if (CREATE_NEW.equals(availabilityCombo.getText())) {
wizard.setWithNewAvailabilitySet(true);
wizard.setAvailabilitySet(null);
} else if (availabilityCombo.getData(availabilityCombo.getText()) instanceof AvailabilitySet) {
wizard.setAvailabilitySet((AvailabilitySet) availabilityCombo.getData(availabilityCombo.getText()));
wizard.setWithNewAvailabilitySet(false);
}
}
});
if (availabilitySets == null) {
DefaultLoader.getIdeHelper().invokeAndWait(new Runnable() {
@Override
public void run() {
availabilityCombo.setItems(new String[] { NONE, CREATE_NEW, LOADING });
}
});
}
}
Aggregations