Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

SWT Layer details for contributors

jpeterka edited this page Apr 18, 2013 · 6 revisions

Obsolete page !!!

Basic guidelines for implementation SWT widgets on SWT Layer

General instructions

  • always try to make it user-friendly and readable for a client and other commiters
  • don't overengineer - make it simple and simply maintainable, use generics reasonably
  • make tests (see plugin org.jboss.reddeer.swt.tests)
  • try to make your methods safe and reliable for any situation (widgets created statically, dynamically, latency, etc.)

Widget API (interfaces) in org.jboss.reddeer.swt.api

  • is ment for widget control and state read only
  • don't add any getters related to other control if not REALLY necessary
  • Widgets API should contain most simple and effective method for manipulation and getters related to object properties
  • try to follow SWT method naming convention
  • don't extend interfaces if not necessary to be able keep specific javadoc

Widget implementation guidelines

  • You can create your own implementation or wrap SWTBot widget
  • Constructors are ment to locate and prepare widgets (for additional manipulation or properties read there are methods)
  • Widget implementation always extends Abstract class
  • If reasonable implement Default implementation (DefaultShell, ...)
  • Widget implementations are ment to represent particular Widget Situation, not a Matchers
    • CORRECT impl.: WorkbenchShell, DefaultShell, etc.
    • INCORRECT impl.: RegexShell, ShellByTitle
  • For widgets using various matchers create specific constructors
    • Constructors that should be implemented:
    • DefaultWidget(), DefaultWidget(String title), DefaultWidget(Matchers... matchers), etc.

Matchers

Matchers implements org.hamcrest.BaseMatcher and resides in org.jboss.reddeer.swt.matcher Available matchers:

  • RegexMatcher
  • TextMatcher

There are also classes for constructing array of matchers, which are usable for Widgets implementation where array of matchers can be needed (MenuItems, TreeItems, etc.)

  • RegexMatchers
  • TextMatchers

Conditions (TBD)

Exceptions and Error Handling

SWT Layer should throw unchecked SWTLayerException with short but precise message what happened for unexpected state. If you need more indication, feel free to add some indicator properties that can be set into that Exception.

Clone this wiki locally