Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » No getParent or getParentItem
No getParent or getParentItem [message #479682] Tue, 11 August 2009 20:06
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
Seems like it would be easier to move around in tree chains with
getParentItem and getParent.

tbot.getTreeItem("C1").expandNode("Debug").getParentItem().expandNode( "src");
tbot.getTreeItem("C1").expandNode("Debug").getParent().select( "C1");
tbot.getTreeItem("C1").expandNode("Debug").getParentItem().select();



-----------

Here's some code to add to SWTBotTreeItem to implement it.

/**
* Gets the widgets parentItem TreeItem or throws exception for null
parentItem.
*
* @return the parentItem of the current TreeItem
*/
public SWTBotTreeItem getParentItem() {
return syncExec(new Result<SWTBotTreeItem>() {
public SWTBotTreeItem run() {
return new SWTBotTreeItem(widget.getParentItem());
}
});
}
/**
* Gets the widgets parent Tree or throws exception for null parentItem.
*
* @return the parent Tree of the current TreeItem
*/
public SWTBotTree getParent() {
return syncExec(new Result<SWTBotTree>() {
public SWTBotTree run() {
return new SWTBotTree(widget.getParent());
}
});
}
Previous Topic:failed chaining of select(String)
Next Topic:[swtbot4gef] Why is the constructor of SWTBotEditPart and SwtBotConnectionEditPart package-private?
Goto Forum:
  


Current Time: Tue Jul 29 21:06:01 EDT 2014

Powered by FUDForum. Page generated in 0.01783 seconds