Example usage for javafx.stage Window isFocused

List of usage examples for javafx.stage Window isFocused

Introduction

In this page you can find the example usage for javafx.stage Window isFocused.

Prototype

public final boolean isFocused() 

Source Link

Usage

From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java

/**
 * {@inheritDoc}/*from w w w  . j  a v  a 2 s . c o m*/
 */
public void activateApplication(String method) throws RobotException {
    try {
        final Window window = getActiveWindow();
        if (window == null) {
            return;
        }
        WindowActivationMethod wam = WindowActivationMethod.createWindowActivationMethod(method, m_robot,
                m_queuer);
        wam.activate(window);

        // Verify that window was successfully activated
        Window activeWindow = (Window) m_queuer.invokeAndWait("getActiveWindow", //$NON-NLS-1$
                new IRunnable() {
                    public Object run() throws StepExecutionException {

                        if (window.isFocused()) {
                            return window;
                        }
                        return null;
                    }
                });
        if (activeWindow != window) {
            throw new StepExecutionException(I18n.getString(TestErrorEvent.WINDOW_ACTIVATION_FAILED, true),
                    EventFactory.createActionError(TestErrorEvent.WINDOW_ACTIVATION_FAILED));
        }

    } catch (Exception exc) {
        throw new RobotException(exc);
    }
}