use of com.microsoft.azure.toolkit.lib.common.bundle.AzureString in project azure-tools-for-java by Microsoft.
the class SubscriptionsDialog method createUIComponents.
private void createUIComponents() {
contentPane = new JPanel();
contentPane.setPreferredSize(new Dimension(350, 200));
DefaultTableModel model = new SubscriptionTableModel();
// Set the text read by JAWS
model.addColumn("Selected");
model.addColumn("Subscription name");
model.addColumn("Subscription ID");
table = new JBTable();
table.setModel(model);
TableColumn column = table.getColumnModel().getColumn(CHECKBOX_COLUMN);
// Don't show title text
column.setHeaderValue("");
column.setMinWidth(23);
column.setMaxWidth(23);
JTableUtils.enableBatchSelection(table, CHECKBOX_COLUMN);
table.getTableHeader().setReorderingAllowed(false);
new TableSpeedSearch(table);
AnActionButton refreshAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
this.setEnabled(false);
model.setRowCount(0);
model.fireTableDataChanged();
table.getEmptyText().setText("Refreshing");
AppInsightsClient.createByType(AppInsightsClient.EventType.Subscription, "", "Refresh", null);
final AzureString title = AzureOperationBundle.title("account|subscription.refresh");
final AzureTask task = new AzureTask(project, title, true, () -> {
try {
SubscriptionsDialog.this.refreshSubscriptions();
} finally {
this.setEnabled(true);
}
}, AzureTask.Modality.ANY);
AzureTaskManager.getInstance().runInBackground(task);
}
};
refreshAction.registerCustomShortcutSet(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK, contentPane);
ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(table).disableUpDownActions().addExtraActions(refreshAction);
panelTable = tableToolbarDecorator.createPanel();
}
use of com.microsoft.azure.toolkit.lib.common.bundle.AzureString in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditor method deleteSelectedFile.
private void deleteSelectedFile() {
final BlobFile blobItem = getFileSelection();
if (blobItem != null) {
boolean isConfirm = DefaultLoader.getUIHelper().showYesNoDialog(mainPanel, "Are you sure you want to " + "delete this blob?", "Delete Blob", null);
if (isConfirm) {
setUIState(true);
final AzureString title = AzureOperationBundle.title("blob.delete", blobItem.getName());
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
progressIndicator.setIndeterminate(true);
try {
StorageClientSDKManager.getManager().deleteBlobFile(connectionString, blobItem);
if (blobItems.size() <= 1) {
directoryQueue.clear();
directoryQueue.addLast(StorageClientSDKManager.getManager().getRootDirectory(connectionString, blobContainer));
queryTextField.setText("");
}
AzureTaskManager.getInstance().runLater(this::fillGrid);
} catch (AzureCmdException ex) {
String msg = "An error occurred while attempting to delete blob." + "\n" + String.format(message("webappExpMsg"), ex.getMessage());
PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, ex);
}
}));
}
}
}
use of com.microsoft.azure.toolkit.lib.common.bundle.AzureString in project azure-tools-for-java by Microsoft.
the class AzureSignInAction method loginNonDeviceCodeSingle.
private static Single<AuthMethodDetails> loginNonDeviceCodeSingle(AuthConfiguration auth) {
final AzureString title = AzureOperationBundle.title("account.sign_in");
final AzureTask<AuthMethodDetails> task = new AzureTask<>(null, title, true, () -> {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
indicator.setIndeterminate(true);
return doLogin(indicator, auth);
});
return AzureTaskManager.getInstance().runInBackgroundAsObservable(task).toSingle();
}
use of com.microsoft.azure.toolkit.lib.common.bundle.AzureString in project azure-tools-for-java by Microsoft.
the class SettingsStep method retrieveVirtualNetworks.
private void retrieveVirtualNetworks() {
final AzureString title = AzureOperationBundle.title("vm.list_virtual_networks");
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
progressIndicator.setIndeterminate(true);
if (virtualNetworks == null) {
virtualNetworks = azure.networks().list();
}
final Runnable task = () -> networkComboBox.setModel(getVirtualNetworkModel(model.getVirtualNetwork(), model.getSubnet()));
AzureTaskManager.getInstance().runLater(task);
}));
if (virtualNetworks == null) {
AzureTaskManager.getInstance().runAndWait(() -> {
final DefaultComboBoxModel loadingVNModel = new DefaultComboBoxModel(new String[] { CREATE_NEW, "<Loading...>" }) {
@Override
public void setSelectedItem(Object o) {
super.setSelectedItem(o);
if (CREATE_NEW.equals(o)) {
showNewVirtualNetworkForm();
} else {
model.setVirtualNetwork((Network) o);
}
}
};
loadingVNModel.setSelectedItem(null);
networkComboBox.setModel(loadingVNModel);
subnetComboBox.removeAllItems();
subnetComboBox.setEnabled(false);
});
}
}
use of com.microsoft.azure.toolkit.lib.common.bundle.AzureString in project azure-tools-for-java by Microsoft.
the class SettingsStep method retrieveStorageAccounts.
private void retrieveStorageAccounts() {
final AzureString title = AzureOperationBundle.title("vm.list_storage_accounts");
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
progressIndicator.setIndeterminate(true);
if (storageAccounts == null) {
List<StorageAccount> accounts = Azure.az(AzureStorageAccount.class).subscription(model.getSubscription().getId()).list();
storageAccounts = new TreeMap<>();
for (StorageAccount storageAccount : accounts) {
storageAccounts.put(storageAccount.name(), storageAccount);
}
}
refreshStorageAccounts(null);
}));
if (storageAccounts == null) {
final DefaultComboBoxModel loadingSAModel = new DefaultComboBoxModel(new String[] { CREATE_NEW, "<Loading...>" }) {
@Override
public void setSelectedItem(Object o) {
if (CREATE_NEW.equals(o)) {
showNewStorageForm();
} else {
super.setSelectedItem(o);
}
}
};
loadingSAModel.setSelectedItem(null);
AzureTaskManager.getInstance().runAndWait(() -> storageComboBox.setModel(loadingSAModel), AzureTask.Modality.ANY);
}
}
Aggregations