Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » CTRL+mouseClick
CTRL+mouseClick [message #519813] Wed, 10 March 2010 03:02 Go to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
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 #519909 is a reply to message #519813] Wed, 10 March 2010 08:40 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
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.

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: CTRL+mouseClick [message #520071 is a reply to message #519909] Wed, 10 March 2010 22:14 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
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.
Re: CTRL+mouseClick [message #526686 is a reply to message #520071] Mon, 12 April 2010 15:31 Go to previous messageGo to next message
Caroline Bourdeu d'Aguerre is currently offline Caroline Bourdeu d'AguerreFriend
Messages: 6
Registered: July 2009
Junior Member
Hi all,

I am also interested in keeping CTRL key pressed while cliking. Craig did you open the bug? Does anyone know if it has been fixed?

Best regards
Re: CTRL+mouseClick [message #526708 is a reply to message #519813] Mon, 12 April 2010 16:45 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Could you open a bug and I'll see how modifier keys(CTRL/ALT/SHIFT) with
mouse click can be addressed.

– Ketan

On 3/9/10 7:02 PM, 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
Re: CTRL+mouseClick [message #526911 is a reply to message #526708] Tue, 13 April 2010 13:32 Go to previous message
Caroline Bourdeu d'Aguerre is currently offline Caroline Bourdeu d'AguerreFriend
Messages: 6
Registered: July 2009
Junior Member
The bug is open here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=308965

Regards
Previous Topic:Page objects for standard views?
Next Topic:Problem with CommandFinder...
Goto Forum:
  


Current Time: Thu Apr 25 17:41:23 GMT 2024

Powered by FUDForum. Page generated in 0.02692 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top