Jump to: navigation, search


< SWTBot
Revision as of 10:05, 9 June 2010 by Pascal.gelinas.nuecho.com (Talk | contribs) (Installing/Updating on the command line)

Update Sites
Mailing List
Open Bugzilla tickets
Open Gerrit reviews
Browse Source
Continuous Integration

Some snippets for working with SWTBot

Installing/Updating on the command line

Here is a little bash script to help manage SWTBot's version on the command line. Useful for managing an Eclipse installation used for Continuous Integration. It is by no means perfect and you will need to set the proper version for the equinox launcher and the swtbot repository (ganymede, galileo or helios). Feel free to modify to fit your needs­.

# ganymede, galileo or helios
# Uninstall the feature.
$ECLIPSE_DIR/eclipse -nosplash -consoleLog \
 -application org.eclipse.equinox.p2.director \
 -uninstallIU org.eclipse.swtbot.eclipse.gef.feature.group,org.eclipse.swtbot.eclipse.test.junit4.feature.group \
# (Re)Install the feature. This is how you update in the p2 world.
$ECLIPSE_DIR/eclipse -nosplash -consoleLog \
 -application org.eclipse.equinox.p2.director \
 -repository http://download.eclipse.org/technology/swtbot/$REPOSITORY_VERSION/dev-build/update-site/ \
 -installIU org.eclipse.swtbot.eclipse.gef.feature.group,org.eclipse.swtbot.eclipse.test.junit4.feature.group \

Note: apparently the application p2.director doesn't exist in eclipse 3.4. The alternative/equivalent is org.eclipse.equinox.p2.director.app.application, but this is an undocumented feature. Another workaround would be to use an eclipse 3.5 to manage an eclipse 3.4, which sounds like the way to go (it's even documented: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_director.html). All you need to do is add -destination eclipse/3.4/path -profile PROFILE when installing, where PROFILE is defined by the property eclipse.p2.profile in the config.ini (configuration/config.ini) of the destination.

Switch perspective

This allows you to switch perspectives in eclipse from within the Window>Open Perspective>Other... menu.

// Change the perspective via the Open Perspective dialog       
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");

// select the dialog