Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 09388ef8c8a99742081ce501293aa88b27829a38 (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
/*******************************************************************************
 * Copyright (c) 2017, 2018 Red Hat, Inc.
 * 
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributor:
 *     Red Hat, Inc. - initial API and implementation
 ******************************************************************************/

package org.eclipse.linuxtools.docker.reddeer.ui;

import java.util.List;

import org.eclipse.reddeer.eclipse.exception.EclipseLayerException;
import org.eclipse.reddeer.swt.api.TableItem;
import org.eclipse.reddeer.swt.impl.table.DefaultTable;
import org.eclipse.reddeer.swt.impl.text.DefaultText;
import org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem;
import org.eclipse.reddeer.workbench.impl.view.WorkbenchView;

public class DockerContainersTab extends WorkbenchView {

	public DockerContainersTab() {
		super("Docker Containers");
	}

	public TableItem getDockerContainer(String dockerContainerName) {
		this.activate();
		for (TableItem item : getTableItems()) {
			if (item.getText().equals(dockerContainerName)) {
				return item;
			}
		}
		throw new EclipseLayerException("There is no container with name " + dockerContainerName);
	}

	public void refresh() {
		this.activate();
		new DefaultToolItem("Refresh (F5)").click();

	}

	public List<TableItem> getTableItems() {
		return new DefaultTable().getItems();

	}

	public void select(String containerName) {
		getDockerContainer(containerName).select();
	}

	public void searchContainer(String containerName) {
		this.activate();
		new DefaultText().setText(containerName);
	}

}

Back to the top