use of com.microsoft.azuretools.sdkmanage.AzureManager in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditor method addSubscriptionSelectionListener.
private void addSubscriptionSelectionListener() {
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
azureManager.getSubscriptionManager().addListener(new ISubscriptionSelectionListener() {
@Override
public void update(boolean isSignedOut) {
if (isSignedOut) {
Object openedFile = DefaultLoader.getUIHelper().getOpenedFile(project, storageAccount, blobContainer);
if (openedFile != null) {
DefaultLoader.getIdeHelper().closeFile(project, openedFile);
}
}
}
});
} catch (Exception ex) {
DefaultLoader.getUIHelper().logError(ex.getMessage(), ex);
}
}
use of com.microsoft.azuretools.sdkmanage.AzureManager in project azure-tools-for-java by Microsoft.
the class AppInsightsMngmtPanel method loadInfoFirstTime.
private void loadInfoFirstTime() {
try {
if (AuthMethodManager.getInstance().isSignedIn()) {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
List<Subscription> subList = azureManager.getSelectedSubscriptions();
if (subList.size() > 0) {
updateApplicationInsightsResourceRegistry(subList, myProject);
} else {
// just show manually added list from preferences
// Neither clear subscription list nor show sign in dialog as user may just want to add key manually.
keeepManuallyAddedList(myProject);
}
} else {
// just show manually added list from preferences
keeepManuallyAddedList(myProject);
}
} catch (Exception ex) {
AzurePlugin.log(ex.getMessage(), ex);
}
}
use of com.microsoft.azuretools.sdkmanage.AzureManager in project azure-tools-for-java by Microsoft.
the class SelectSubscriptionsAction method selectSubscriptions.
public static Single<List<SubscriptionDetail>> selectSubscriptions(Project project) {
final AuthMethodManager authMethodManager = AuthMethodManager.getInstance();
final AzureManager manager = authMethodManager.getAzureManager();
if (manager == null) {
return Single.fromCallable(() -> null);
}
final SubscriptionManager subscriptionManager = manager.getSubscriptionManager();
return loadSubscriptions(subscriptionManager, project).switchMap((subs) -> selectSubscriptions(project, subs)).toSingle().doOnSuccess((subs) -> Optional.ofNullable(subs).ifPresent(subscriptionManager::setSubscriptionDetails));
}
use of com.microsoft.azuretools.sdkmanage.AzureManager in project azure-tools-for-java by Microsoft.
the class CreateArmStorageAccountForm method fillFields.
public void fillFields() {
if (subscription == null) {
try {
subscriptionComboBox.setEnabled(true);
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
List<Subscription> subscriptions = azureManager.getSelectedSubscriptions();
for (Subscription sub : subscriptions) {
if (sub.isSelected()) {
subscriptionComboBox.add(sub.getName());
subscriptionComboBox.setData(sub.getName(), sub);
}
}
subscriptionComboBox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
loadRegionsAndGroups();
}
});
if (subscriptions.size() > 0) {
subscriptionComboBox.select(0);
loadRegionsAndGroups();
}
} catch (Exception e) {
PluginUtil.displayErrorDialogWithAzureMsg(PluginUtil.getParentShell(), Messages.err, "An error occurred while loading subscriptions.", e);
}
for (Map.Entry<String, Kind> entry : ACCOUNT_KIND.entrySet()) {
kindCombo.add(entry.getKey());
kindCombo.setData(entry.getKey(), entry.getValue());
}
kindCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fillPerformanceComboBox();
fillReplicationTypes();
showAccessTier();
}
});
kindCombo.select(1);
showAccessTier();
} else {
// create form create VM form
subscriptionComboBox.setEnabled(false);
subscriptionComboBox.add(subscription.getName());
subscriptionComboBox.setData(subscription.getName(), subscription);
subscriptionComboBox.select(0);
// only General purpose accounts supported for VMs
kindCombo.add("General purpose v1");
kindCombo.setData("General purpose v1", Kind.STORAGE);
kindCombo.setEnabled(false);
kindCombo.select(0);
regionComboBox.add(region.getLabel());
regionComboBox.setData(region.getLabel(), region);
regionComboBox.setEnabled(false);
regionComboBox.select(0);
loadGroups();
// loadRegions();
}
fillPerformanceComboBox();
// performanceCombo.select(0);
performanceCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
fillReplicationTypes();
}
});
fillReplicationTypes();
}
use of com.microsoft.azuretools.sdkmanage.AzureManager in project azure-tools-for-java by Microsoft.
the class AIProjConfigWizardDialog method setData.
private void setData() {
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null || !AuthMethodManager.getInstance().isSignedIn()) {
return;
}
List<Subscription> subList = azureManager.getSelectedSubscriptions();
if (subList.size() > 0 && !ApplicationInsightsPreferences.isLoaded()) {
// if (manager.authenticated()) {
// authenticated using AD. Proceed for updating application insights registry.
ApplicationInsightsResourceRegistryEclipse.updateApplicationInsightsResourceRegistry(subList);
// } else {
// imported publish settings file. just show manually added list from preferences
// Neither clear subscription list nor show sign in dialog as user may just want to add key manually.
// ApplicationInsightsResourceRegistryEclipse.keeepManuallyAddedList();
// }
}
} catch (Exception ex) {
Activator.getDefault().log(ex.getMessage(), ex);
}
comboInstrumentationKey.removeAll();
String[] array = ApplicationInsightsResourceRegistry.getResourcesNamesToDisplay();
if (array.length > 0) {
comboInstrumentationKey.setItems(array);
comboInstrumentationKey.setText(array[0]);
}
}
Aggregations