use of org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRun in project linuxtools by eclipse.
the class RunImageCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerImage selectedImage = CommandUtils.getSelectedImage(activePart);
if (selectedImage == null) {
Activator.log(new DockerException(// $NON-NLS-1$
DVMessages.getString("RunImageUnableToRetrieveError.msg")));
} else {
try {
final ImageRun wizard = new ImageRun(selectedImage);
final boolean runImage = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (runImage) {
final IDockerContainerConfig containerConfig = wizard.getDockerContainerConfig();
final IDockerHostConfig hostConfig = wizard.getDockerHostConfig();
runImage(selectedImage, containerConfig, hostConfig, wizard.getDockerContainerName(), wizard.removeWhenExits());
}
} catch (DockerException | CoreException e) {
Activator.log(e);
}
}
return null;
}
Aggregations