Search in sources :

Example 1 with ImageRun

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;
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerContainerConfig(org.eclipse.linuxtools.docker.core.IDockerContainerConfig) CoreException(org.eclipse.core.runtime.CoreException) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IDockerHostConfig(org.eclipse.linuxtools.docker.core.IDockerHostConfig) IDockerImage(org.eclipse.linuxtools.docker.core.IDockerImage) ImageRun(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRun)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 DockerException (org.eclipse.linuxtools.docker.core.DockerException)1 IDockerContainerConfig (org.eclipse.linuxtools.docker.core.IDockerContainerConfig)1 IDockerHostConfig (org.eclipse.linuxtools.docker.core.IDockerHostConfig)1 IDockerImage (org.eclipse.linuxtools.docker.core.IDockerImage)1 ImageRun (org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRun)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1