public void run(Object... parameters) {
setResult(state.getScene());
}
}.dispatch(getEnvironment());
if (new_selected_scene == null) {
throw new JemmyException("The menu bar can not be expanded", getControl());
}
Wrap<? extends Scene> popup_scene_wrap = new SceneWrap(getEnvironment(), new_selected_scene);
Wrap<Node> item = popup_scene_wrap.as(Parent.class, Node.class).lookup(new LookupCriteria<Node>() {
@Override
public boolean check(Node control) {
return control.equals(state);
}
}).wrap(0);
item.mouse().click();
} else {
Boolean found = new GetAction<Boolean>() {
@Override
public void run(Object... parameters) {
for (Node item : getToolBar().getItems()) {
if (item.equals(state)) {
setResult(true);
return;
}
}
setResult(false);
}
}.dispatch(getEnvironment());
if (!found) {
throw new JemmyException("The menu bar does not contain an item", getControl());
}
new NodeWrap(getEnvironment(), state).mouse().click();
}