use of com.microsoft.azuretools.docker.ui.wizards.publish.AzureSelectDockerWizard in project azure-tools-for-java by Microsoft.
the class AzureDockerUIResources method publish2DockerHostContainer.
public static void publish2DockerHostContainer(Shell shell, IProject project, DockerHost host) {
try {
AzureDockerUIResources.createArtifact(shell, project);
AzureManager azureAuthManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureAuthManager == null) {
return;
}
AzureDockerHostsManager dockerManager = AzureDockerHostsManager.getAzureDockerHostsManager(azureAuthManager);
if (!dockerManager.isInitialized()) {
AzureDockerUIResources.updateAzureResourcesWithProgressDialog(shell, project);
if (AzureDockerUIResources.CANCELED) {
return;
}
dockerManager = AzureDockerHostsManager.getAzureDockerHostsManagerEmpty(null);
}
if (dockerManager.getSubscriptionsMap().isEmpty()) {
PluginUtil.displayErrorDialog(shell, "Create Docker Host", "Must select an Azure subscription first");
return;
}
DockerHost dockerHost = (host != null) ? host : (dockerManager.getDockerPreferredSettings() != null) ? dockerManager.getDockerHostForURL(dockerManager.getDockerPreferredSettings().dockerApiName) : null;
AzureDockerImageInstance dockerImageDescription = dockerManager.getDefaultDockerImageDescription(project.getName(), dockerHost);
AzureSelectDockerWizard selectDockerWizard = new AzureSelectDockerWizard(project, dockerManager, dockerImageDescription);
WizardDialog selectDockerHostDialog = new AzureWizardDialog(shell, selectDockerWizard);
if (dockerHost != null) {
selectDockerWizard.selectDefaultDockerHost(dockerHost, true);
}
if (selectDockerHostDialog.open() == Window.OK) {
try {
String url = selectDockerWizard.deploy();
if (AzureDockerUtils.DEBUG)
System.out.println("Web app published at: " + url);
} catch (Exception ex) {
PluginUtil.displayErrorDialogAndLog(shell, "Unexpected error detected while publishing to a Docker container", ex.getMessage(), ex);
log.log(Level.SEVERE, "publish2DockerHostContainer: " + ex.getMessage(), ex);
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "publish2DockerHostContainer: " + e.getMessage(), e);
e.printStackTrace();
}
}
Aggregations