Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6e183d0e773dcbd63ad9ce06bbc4cf66dbbabe02 (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
/*******************************************************************************
 * Copyright (c) 2014, 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.docker.ui.wizards;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerImageSearchResult;
import org.eclipse.linuxtools.internal.docker.ui.wizards.DockerImageTagSearchResult;
import org.eclipse.linuxtools.internal.docker.ui.wizards.ImageSearchModel;
import org.eclipse.linuxtools.internal.docker.ui.wizards.ImageSearchPage;
import org.eclipse.linuxtools.internal.docker.ui.wizards.ImageTagSelectionPage;
import org.eclipse.linuxtools.internal.docker.ui.wizards.WizardMessages;

/**
 * Wizard to search for images.
 * 
 */
public class ImageSearch extends Wizard {

	/** the Image Search {@link WizardPage}. */
	private final ImageSearchPage imageSearchPage;

	/** the Image Tag selection {@link WizardPage}. */
	private final ImageTagSelectionPage imageTagSelectionPage;

	/**
	 * shared databinding model for {@link ImageSearchPage} and
	 * {@link ImageTagSelectionPage}.
	 */
	private final ImageSearchModel imageSearchModel;

	/*
	 * Default Constructor
	 */
	public ImageSearch(final IDockerConnection connection) {
		setWindowTitle(WizardMessages.getString("ImageSearch.title")); //$NON-NLS-1$
        setNeedsProgressMonitor(true);
		this.imageSearchModel = new ImageSearchModel(connection);
		this.imageSearchPage = new ImageSearchPage(this.imageSearchModel);
		this.imageTagSelectionPage = new ImageTagSelectionPage(
				this.imageSearchModel);
	}

	@Override
	public void addPages() {
		addPage(imageSearchPage);
		addPage(imageTagSelectionPage);
	}

	@Override
	public boolean canFinish() {
		return this.imageTagSelectionPage.isPageComplete();
	}

	@Override
	public boolean performFinish() {
		return true;
	}

	public IDockerImageSearchResult getSelectedImage() {
		return this.imageSearchPage.getSelectedImage();
	}

	public DockerImageTagSearchResult getSelectedImageTag() {
		return this.imageTagSelectionPage.getSelectedImageTag();
	}
}

Back to the top