| The SWTBot generator plugin |
| =========================== |
| |
| 1. What is this plugin? |
| |
| This plugin contains some sources to generate key parts of the SWTBot |
| source. The `SWTBot' class and two classes named `WidgetMatcherFactory' |
| are generated using this plugin. |
| |
| |
| |
| 2. Why would one generate these classes? |
| |
| For two reasons: |
| * consistency and error-free source - all the methods look exactly the |
| same and are generated by a program |
| * no need to keep track of methods on these classes when adding support |
| for new widgets or matchers |
| |
| |
| |
| 3. What do I need to do if I want to add a new widget to SWTBot? |
| |
| Four things: |
| * Create an SWTBotMyWidget class (see SWTBotButton for an example) |
| * Add an annotation `@SWTBotWidget' to the new class. This annotation |
| describes what prefix and and suffixes should be generated for accessing |
| this widget. More on this annotation later. |
| * Edit widgets.xml and add the name of your class |
| * Run the class `SWTBotGeneratorMain' |
| |
| |
| |
| 4. What do I need to do if I want to add a new accessor method to SWTBot? |
| |
| If SWTBot already has support for the widget, but is missing an accessor of |
| the form <widget>withSomeproperty(arguments), then change the annotation on |
| the SWTBot<widget> class and execute `SWTBotGeneratorMain'. |
| |
| |
| |
| 5. What do I need to do if I want to add support for a new matcher? |
| |
| Four things: |
| * Create a Matcher class (see WithStyle/WithText for example) |
| * Ensure that there is an @Factory method on the class |
| * Edit swtbot-matchers.xml or swtbot-eclipse-matchers.xml as the case may be |
| * Run the class `MatcherGeneratorMain' |
| |
| |
| |
| 6. What is this @SWTBotWidget annotation about? |
| |
| This annotation marks a SWTBot widget so the generator and other tools can |
| recognize it. This annotation is primarily used to describe the convinience |
| API that should be generated for a class annotated with the specified widget. |
| |
| See the javadoc on the annotation for more detail and examples. |