Search in sources :

Example 1 with ImageTag

use of org.eclipse.linuxtools.internal.docker.ui.wizards.ImageTag in project linuxtools by eclipse.

the class TagImageCommandHandler method execute.

@Override
public Object execute(final ExecutionEvent event) {
    final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    final List<IDockerImage> selectedImages = CommandUtils.getSelectedImages(activePart);
    final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
    if (selectedImages.size() != 1 || connection == null) {
        Activator.log(new DockerException(CommandMessages.getString(// $NON-NLS-1$
        "Command.missing.selection.failure")));
        return null;
    }
    final IDockerImage image = selectedImages.get(0);
    // TODO: remove the cast to DockerImage once the 'shortId' method has
    // been added in the API
    final ImageTag wizard = new ImageTag(((DockerImage) image).shortId());
    final boolean tagImage = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
    if (tagImage) {
        performTagImage(connection, image, wizard.getTag());
    }
    return null;
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) ImageTag(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageTag) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) IDockerImage(org.eclipse.linuxtools.docker.core.IDockerImage)

Aggregations

DockerException (org.eclipse.linuxtools.docker.core.DockerException)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 IDockerImage (org.eclipse.linuxtools.docker.core.IDockerImage)1 ImageTag (org.eclipse.linuxtools.internal.docker.ui.wizards.ImageTag)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1