SWT Faq

来源:互联网 发布:windows 手写笔记软件 编辑:程序博客网 时间:2024/05/02 00:45
How do I enable debug mode in Eclipse for SWT?
A: Follow these steps:
  1. Create a .options file in the same directory as your eclipse executable.
  2. Place the following lines in the .options file: 
    org.eclipse.ui/debug=true 
    org.eclipse.ui/debug/swtdebugglobal=true
  3. Start up eclipse from the command line with the debug flag: ./eclipse -debug

All messages from SWT will be printed to the console window.


Q: How can I implement user interaction tests?
A: The method org.eclipse.swt.widgets.Display.post(Event) can be used to post mouse and keyboard events into the OS, which emulates the user performing the specified action. This is the typical approach that is used for implementing JUnit test cases.

There are also stand-alone applications available for automating SWT user interaction tests:

  • SWTBot (open source)
  • Abbot for SWT (open source)
  • Instantiations Window Tester (commercial)