Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "SWTBot/Generator"
m (SWTBot/Recorder moved to SWTBot/Generator) |
|
(No difference)
|
Revision as of 08:13, 13 January 2013
SWTBot |
Website |
Update Sites |
Community |
Mailing List |
Forums/Newsgroups |
IRC |
Contribute |
Open Bugzilla tickets |
Open Gerrit reviews |
Browse Source |
Continuous Integration |
Contents
Screencast
Here is a screencast presenting SWTBot Recorder and Generator: https://vimeo.com/55953990
Installation
The Test recorder and generator is a single plugin to install in any RCP application (may it be your Eclipse IDE, or a bundled RCP application. You can get it from the SWTBot update-site/p2 repository (starting from version 2.0.6).
With p2 UI: TODO screenshot of installation
With p2 director, install bundle org.eclipse.swtbot.generator:
java -jar plugins/org.eclipse.equinox.laucher_*.jar -application org.eclipse.equinox.p2.director -repository <choose_a_SWTBot_p2_repo> -installIU org.eclipse.swtbot.generator
Enablement
From IDE
Ensure the org.eclipse.swtbot.generator bundle is part of your Lauch Configuration TODO: screenshot
Set the -Dorg.eclipse.swtbot.generator.enable=true system property TODO: screenshot
From a RCP app
Ensure org.eclipse.swtbot.generator bundle is installed in your application (use ls or OSGi console at runtime to check that).
Set the -Dorg.eclipse.swtbot.generator.enable=true system property in your config.ini. Example for JBoss Developer Studio, in jbdevstudio/studio/jbdevstudio.ini, line 17:
-vm
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120522-1813
-product
com.jboss.jbds.product.product
-showsplash
platform\:/base/plugins/com.jboss.jbds.product
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Djboss.discovery.directory.url=https://devstudio.jboss.com/updates/6.0/devstudio-directory.xml
-Dorg.eclipse.swtbot.generator.enable=true
-Xms512m
-Xmx1024m
-Dosgi.instance.area.default=@user.home/workspace
Usage
The generator window generates code, copy-paste it where you want
Extending it
Mechanism
The Generator places some SWT listeners that look at events and generate code from each event. A Generator support is just a set of "rules" that are classes that process (or not) the current event to generate some code. Processing an event is divided in 2 pieces:
- Create an accessor for the widget (eg: bot.button("blah")
- create an action on the widget (eg: .click())
Contribute your own Bot support
There is an extension point for that in org.eclipse.swtbot.generator. We recommend you to get the source for the org.eclipse.swtbot.generator plugin and see what's in it. The default SWTBot support is installed as an extension too, so you can take it as an example.
Contributing
The contributions tools and process are the same as for any SWTBot part. See SWTBot/Contributing.