CTRL+mouseClick [message #519813] |
Wed, 10 March 2010 03:02 |
|
I have a TreeViewer in which I need to select multiple nodes with
different parent nodes. SWTBotTree and SWTTreeBotTreeItem#select
(String... items) seems to work only if the items are siblings - child
nodes of the root in the former case and of the treeItem in the latter.
Nice but not what I need. An alternative would seem to be multiple
#select calls with the CTRL key pressed. Both bots inherit a set of
#pressShortcut methods but they seem to work only if modifier keys are
followed by 'natural' keys... but not by a mouse click.
Has anyone been able to do such a selection? Or perhaps have some ideas
how I might make one?
Any help greatly appreciated.
Craig Foote
|
|
|
|
Re: CTRL+mouseClick [message #520071 is a reply to message #519909] |
Wed, 10 March 2010 22:14 |
|
Thanks Pascal, I'll do that.
Craig
On Wed, 10 Mar 2010 08:33:42 -0500, Pascal Gelinas wrote:
> Craig Foote wrote:
>> I have a TreeViewer in which I need to select multiple nodes with
>> different parent nodes. SWTBotTree and SWTTreeBotTreeItem#select
>> (String... items) seems to work only if the items are siblings - child
>> nodes of the root in the former case and of the treeItem in the latter.
>> Nice but not what I need. An alternative would seem to be multiple
>> #select calls with the CTRL key pressed. Both bots inherit a set of
>> #pressShortcut methods but they seem to work only if modifier keys are
>> followed by 'natural' keys... but not by a mouse click.
>>
>> Has anyone been able to do such a selection? Or perhaps have some ideas
>> how I might make one?
>>
>> Any help greatly appreciated.
>>
>> Craig Foote
>
> There doesn't seem to be any support right now to do it. The solution
> would probably look like this:
> Keyboard keyboard = KeyboardFactory.getDefaultKeyboard(null, null);
> keyboard.pressKeys(Keystrokes.CTRL);
> SWTBotTreeItem item = ...
> item.click();
>
> Although I'm not 100% sure. But, this is not doable right now because
> Keyboard#pressKeys is private. There is currently no way to tell SWTBot
> to press down a key and keep it pressed while doing something else. This
> is one thing that could probably be enabled if necessary.
>
> Another way which would probably be better is to enable
> SWTBotTree#select to look down a certain depth to select items,
> something like:
>
> public SWTBotTree select(final int depth, final String... items) {
>
> and instead of looking only for roots of the tree we could search
> recursively until we hit the depth. Please file a bug and I'll take a
> look at this.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04538 seconds