Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
SWTBot/GSOC dragndrop
< SWTBot
Revision as of 04:11, 3 July 2013 by Unnamed Poltroon (Talk) (New page: This page contains various thoughts/proposals/snippets developed in order to support Drag'n'Drop in SWTBot in a smart and efficient way. Most of this was produced by Rohit AGRAWAL as part ...)
This page contains various thoughts/proposals/snippets developed in order to support Drag'n'Drop in SWTBot in a smart and efficient way. Most of this was produced by Rohit AGRAWAL as part of Google Summer of Code 2013. See Rohit's proposal.
Contents
Requirements
- Usage must be consistent with current SWTBot APIs. We can expect a method on AbstractSWTBot.
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts
- It must support SWT and GEF
- This must be supported by Test Recorder and Generator (addition of rules)
Optional:
- It should support the concept of path (allow intermediary drags to before a drop)
Main use-cases
So far, here are the 2 main use-cases that were identified based on community feedback:
- Drag'n'Drop of Tree elements
- Drag'n'Drop of GEF elements
Proposals
AbstractSWTBot<? extends Widget> dragAndDrop
This is a patch that was proposed early on https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271: Example:
final SWTBotTree sourceTree = bot.tree(0); final SWTBotTree targetTree = bot.tree(1); final SWTBotTreeItem sourceItem = sourceTree.getTreeItem("Drag Source name 0"); final SWTBotTreeItem targetItem = targetTree.getTreeItem("Drop Target name 0"); sourceItem.dragAndDrop(targetItem);
Requirements support:
- Usage must be consistent with current SWTBot APIs. YES
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts YES
- It must support SWT and GEF NO
- This must be supported by Test Recorder and Generator (addition of rules) NO
- It should support the concept of path (allow intermediary drags to before a drop) NO
DNDUtils
This is the workaround that has been extensively used so far. It's an utility class that is attached to https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271:
final SWTBotTree sourceTree = bot.tree(0); final SWTBotTree targetTree = bot.tree(1); final SWTBotTreeItem sourceItem = sourceTree.getTreeItem("Drag Source name 0"); final SWTBotTreeItem targetItem = targetTree.getTreeItem("Drop Target name 0"); DNDUtils.dragAndDrop(sourceItem, targetItem)
Requirements support:
- Usage must be consistent with current SWTBot APIs. NO
- Usage must be homogeneous in SWTBot, and must be the same for all possible controls and concepts YES
- It must support SWT and GEF YES
- This must be supported by Test Recorder and Generator (addition of rules) NO
- It should support the concept of path (allow intermediary drags to before a drop) NO