[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: How to monitor all Events handled by an SWT app

There is new API in 3.0 that may be helpful.  Warning, it may still be under
flux and may change before the end 3.0.

/**
* Adds the listener to the collection of listeners who will
* be notifed when an event of the given type occurs anywhere
* in this display. When the event does occur, the listener is
* notified by sending it the <code>handleEvent()</code> message.
*
* @param eventType the type of event to listen for
* @param listener the listener which should be notified when the event
occurs
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that
created the receiver</li>
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
* </ul>
*
* @see Listener
* @see #removeFilter
* @see #removeListener
*
* @since 3.0
*/
public void addFilter (int eventType, Listener listener) {


<ktdale@xxxxxxxxxx> wrote in message news:bfpe8r$pp5$1@xxxxxxxxxxxxxx

We are working on an SWT automated testing framework that will be able to
both record a user's interactions with the GUI and play them back as a
series of high-level semantic actions.  The action-generation is coming
along fine, and now we're looking into the recording side of things.

The main piece of the puzzle is gaining access to all events that are
handled by the GUI.  In the AWT world, we could just look at the
AWTEventQueue.  With SWT, how can this be done?  A couple ideas come to
mind- monitoring Display.MSG and processing these low-level messages into
high-level events, or adding listeners to all the widgets in the
application, recording the events that arrive, and passing them on to the
real listeners.  I see all sorts of problems with the former, and I can't
get anything akin to the latter to work.

Does anyone have any suggestions?


Kevin