blob: 4edb23fa0714f4ad767d9fc78b42fb9c5a4f71e6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.linuxtools.internal.docker.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.linuxtools.docker.core.IDockerImage;
import org.eclipse.linuxtools.docker.core.IRegistry;
import org.eclipse.linuxtools.internal.docker.core.DockerImage;
/**
* {@link Wizard} to push an {@link IDockerImage} to a registry
*/
public class ImagePush extends Wizard {
private ImagePushPage mainPage;
private final IDockerImage image;
private final String defaultImageName;
/**
* Constructor
*
* @param image
* the image to push
* @param defautImageName
* the default tag to use to push the image
*/
public ImagePush(final IDockerImage image, final String defautImageName) {
super();
setWindowTitle(WizardMessages.getString("ImagePush.name")); //$NON-NLS-1$
this.image = image;
this.defaultImageName = defautImageName;
}
/**
* @return the image name that was selected when opening this wizard.
*/
public IDockerImage getImage() {
return this.image;
}
/**
* @return the image name that was initially selected when opening this
* wizard.
*/
public String getDefaultImageName() {
return this.defaultImageName;
}
/**
* <p>
* <strong>Note:</strong> If no tag was specified, then <code>latest</code>
* is set.
* </p>
*
* @return the repository/tag to select/apply on the image.
*/
public String getSelectedImageTag() {
final String selectedImageName = this.mainPage.getSelectedImageName();
return DockerImage.setDefaultTagIfMissing(selectedImageName);
}
/**
* @return the target {@link IRegistry} on which to push the image
*/
public IRegistry getRegistry() {
return this.mainPage.getSelectedRegistryAccount();
}
/**
* @return flag to indicate if the 'force' option should be used when
* tagging the image.
*/
public boolean isForceTagging() {
return this.mainPage.isForceTagging();
}
/**
* @return flag to indicate if the tagged image should be kept upon
* completion.
*/
public boolean isKeepTaggedImage() {
return this.mainPage.isKeepTaggedImage();
}
@Override
public void addPages() {
this.mainPage = new ImagePushPage(this.image, this.defaultImageName);
addPage(mainPage);
}
@Override
public boolean canFinish() {
return this.mainPage.isPageComplete();
}
@Override
public boolean performFinish() {
return true;
}
}
|