use of org.eclipse.linuxtools.internal.docker.ui.wizards.ImageBuildDialog in project linuxtools by eclipse.
the class BuildDockerImageShortcut method createConfiguration.
/**
* Create a launch configuration based on a Dockerfile resource, and
* optionally save it to the underlying resource.
*
* @param dockerfile
* a {@code Dockerfile} file to build
* @return a launch configuration generated for the Dockerfile build.
*/
@Override
protected ILaunchConfiguration createConfiguration(final IResource dockerfile) {
try {
if (!DockerConnectionManager.getInstance().hasConnections()) {
Display.getDefault().asyncExec(() -> {
boolean confirm = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), LaunchMessages.getString(// $NON-NLS-1$
"BuildDockerImageShortcut.no.connections.msg"), LaunchMessages.getString(// $NON-NLS-1$
"BuildDockerImageShortcut.no.connections.desc"));
if (confirm) {
final NewDockerConnection newConnWizard = new NewDockerConnection();
CommandUtils.openWizard(newConnWizard, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
}
});
return null;
} else {
final ImageBuildDialog dialog = new ImageBuildDialog(getActiveWorkbenchShell());
final int result = dialog.open();
if (result == IDialogConstants.OK_ID) {
return LaunchConfigurationUtils.createBuildImageLaunchConfiguration(dialog.getConnection(), dialog.getRepoName(), dockerfile);
}
}
} catch (CoreException e) {
Activator.log(e);
}
return null;
}
Aggregations