use of com.microsoft.intellij.docker.wizards.createhost.AzureNewDockerWizardDialog in project azure-tools-for-java by Microsoft.
the class AzureSelectDockerHostStep method onAddNewDockerHostAction.
private void onAddNewDockerHostAction() {
AppInsightsClient.createByType(AppInsightsClient.EventType.DockerHost, "", "Add");
AzureNewDockerWizardModel newDockerHostModel = new AzureNewDockerWizardModel(model.getProject(), dockerManager);
AzureNewDockerWizardDialog wizard = new AzureNewDockerWizardDialog(newDockerHostModel);
wizard.setTitle("Create Docker Host");
wizard.show();
if (wizard.getExitCode() == 0) {
dockerHostsTable.setEnabled(false);
DockerHost host = newDockerHostModel.getDockerHost();
dockerImageDescription.host = host;
dockerImageDescription.hasNewDockerHost = true;
dockerImageDescription.sid = host.sid;
model.setSubscription(this.dockerManager.getSubscriptionsMap().get(host.sid));
AzureDockerPreferredSettings dockerPrefferedSettings = dockerManager.getDockerPreferredSettings();
if (dockerPrefferedSettings == null) {
dockerPrefferedSettings = new AzureDockerPreferredSettings();
}
dockerPrefferedSettings.region = host.hostVM.region;
dockerPrefferedSettings.vmSize = host.hostVM.vmSize;
dockerPrefferedSettings.vmOS = host.hostOSType.name();
dockerManager.setDockerPreferredSettings(dockerPrefferedSettings);
final DefaultTableModel tableModel = (DefaultTableModel) dockerHostsTable.getModel();
if (dockerHostsTableSelection != null && (Boolean) tableModel.getValueAt(dockerHostsTableSelection.row, 0)) {
tableModel.setValueAt(false, dockerHostsTableSelection.row, 0);
}
Vector<Object> row = new Vector<>();
row.add(false);
row.add(host.name);
row.add("TO_BE_CREATED");
row.add(host.hostOSType.toString());
row.add(host.apiUrl);
tableModel.insertRow(0, row);
tableModel.setValueAt(true, 0, 0);
dockerHostsTable.setRowSelectionInterval(0, 0);
setFinishButtonState(doValidate(false) == null);
setNextButtonState(doValidate(false) == null);
}
}
use of com.microsoft.intellij.docker.wizards.createhost.AzureNewDockerWizardDialog in project azure-tools-for-java by Microsoft.
the class CreateNewDockerHostAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
try {
if (!AzureSignInAction.doSignIn(AuthMethodManager.getInstance(), project))
return;
AzureManager azureAuthManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureAuthManager == null) {
return;
}
AzureDockerHostsManager dockerManager = AzureDockerHostsManager.getAzureDockerHostsManagerEmpty(azureAuthManager);
if (!dockerManager.isInitialized()) {
AzureDockerUIResources.updateAzureResourcesWithProgressDialog(project);
if (AzureDockerUIResources.CANCELED) {
return;
}
dockerManager = AzureDockerHostsManager.getAzureDockerHostsManagerEmpty(null);
}
if (dockerManager.getSubscriptionsMap().isEmpty()) {
PluginUtil.displayErrorDialog("Create Docker Host", "Must select an Azure subscription first");
return;
}
AzureNewDockerWizardModel newDockerHostModel = new AzureNewDockerWizardModel(project, dockerManager);
AzureNewDockerWizardDialog wizard = new AzureNewDockerWizardDialog(newDockerHostModel);
wizard.setTitle("Create Docker Host");
wizard.show();
if (wizard.getExitCode() == 0) {
dockerHost = newDockerHostModel.getDockerHost();
wizard.create();
System.out.println("New Docker host will be created at: " + dockerHost.apiUrl);
}
} catch (Exception ex1) {
ex1.printStackTrace();
}
}
Aggregations