use of org.eclipse.reddeer.core.reference.ReferencedComposite in project jbosstools-openshift by jbosstools.
the class ShellWithButton method lookForShellWithButton.
private static org.eclipse.swt.widgets.Shell lookForShellWithButton(final String title, final String buttonLabel) {
Matcher<String> titleMatcher = new WithTextMatcher(title);
Matcher<String> buttonMatcher = new BaseMatcher<String>() {
@Override
public boolean matches(Object obj) {
if (obj instanceof Control) {
final Control control = (Control) obj;
ReferencedComposite ref = new ReferencedComposite() {
@Override
public Control getControl() {
return control;
}
};
try {
new PushButton(ref, buttonLabel);
return true;
} catch (CoreLayerException e) {
// ok, this control doesn't contain the button
}
}
return false;
}
@Override
public void describeTo(Description description) {
description.appendText("containing button '" + buttonLabel + "'");
}
};
@SuppressWarnings("unchecked") Matcher<String> matcher = new AndMatcher(titleMatcher, buttonMatcher);
return ShellLookup.getInstance().getShell(matcher);
}
Aggregations