opening project properties hack [message #32890] |
Tue, 21 April 2009 23:33 |
David Crawshaw Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Hello,
I am writing a generic function openProjectProperties(String name). The
obvious technique is to open the Project Explorer, select the project from
the tree, and right click.
This works very well, unless there is another tree visible on the
workbench. Then all too often, that other tree is what is returned by
bot.tree(). This happens even if I call view("Project Explorer").show(),
or setFocus(), or use an ICondition to waitUntil() the view isActive().
The workaround is a terrible hack, it involves enumerating the visible
trees. This doesn't sound too hackish, until you realise that there is no
getAllTrees() function. Instead I need to call bot.tree(int) with indexes
until an exception is thrown. Then even when I get a tree, there is no way
to extract its id (if I knew the id of the project explorer tree, I would
just call treeWithId(), but I've tried to guess and had no luck).
What would be really nice is if I could go view("Project
Explorer").tree(), but that function doesn't exist.
Any thoughts on how I can do this more intelligently?
d.
|
|
|
Re: opening project properties hack [message #32926 is a reply to message #32890] |
Wed, 22 April 2009 08:40 |
Ketan Padegaonkar Messages: 873 Registered: July 2009 |
Senior Member |
|
|
See the tree() method in PackageExplorerView[1] for how this is achieved.
The next nightly build of SWTBot in will let you say instead of the
funny statements in [1].
packageExplorerBot = bot.view("Package Explorer").bot();
packageExplorerBot.tree();
[1] -
http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ widgets/helpers/PackageExplorerView.java#L67
-- Ketan
David Crawshaw wrote:
> Hello,
>
> I am writing a generic function openProjectProperties(String name). The
> obvious technique is to open the Project Explorer, select the project
> from the tree, and right click.
>
> This works very well, unless there is another tree visible on the
> workbench. Then all too often, that other tree is what is returned by
> bot.tree(). This happens even if I call view("Project Explorer").show(),
> or setFocus(), or use an ICondition to waitUntil() the view isActive().
>
> The workaround is a terrible hack, it involves enumerating the visible
> trees. This doesn't sound too hackish, until you realise that there is
> no getAllTrees() function. Instead I need to call bot.tree(int) with
> indexes until an exception is thrown. Then even when I get a tree, there
> is no way to extract its id (if I knew the id of the project explorer
> tree, I would just call treeWithId(), but I've tried to guess and had no
> luck).
>
> What would be really nice is if I could go view("Project
> Explorer").tree(), but that function doesn't exist.
>
> Any thoughts on how I can do this more intelligently?
>
> d.
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03819 seconds