/
DefaultShell.java
58 lines (51 loc) · 1.58 KB
/
DefaultShell.java
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
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.reddeer.swt.impl.shell;
import org.eclipse.swt.widgets.Shell;
import org.hamcrest.Matcher;
import org.eclipse.reddeer.core.lookup.ShellLookup;
/**
* Default shell returns active shell if available if not it returns first
* available shell
*
* @author Jiri Peterka, Andrej Podhradsky, mlabuda@redhat.com
*
*/
public class DefaultShell extends AbstractShell {
/**
* Instantiates a new default shell.
*
* @param text shell text
*/
public DefaultShell(String text) {
super(ShellLookup.getInstance().getShell(text));
}
public DefaultShell(Shell widget){
super(widget);
}
/**
*
* Creates a new DefaultShell matching specified matcher. First found shell with
* specified matcher is created. Beware, there is no strict (deterministic) order of shells.
*
* @param matchers matchers to match title of a shell
*/
public DefaultShell(Matcher<?>... matchers) {
super(ShellLookup.getInstance().getShell(matchers));
}
/**
* Instantiates a new default shell.
*/
public DefaultShell() {
super(ShellLookup.getInstance().getActiveShell());
}
}