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