Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » CTRL+mouseClick
CTRL+mouseClick [message #519813] Tue, 09 March 2010 22:02 Go to next message
Craig Foote is currently offline Craig Foote
Messages: 195
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 03:40 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
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 17:14 Go to previous messageGo to next message
Craig Foote is currently offline Craig Foote
Messages: 195
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 11:31 Go to previous messageGo to next message
Caroline Bourdeu d'Aguerre is currently offline Caroline Bourdeu d'Aguerre
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 12:45 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
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 09:32 Go to previous message
Caroline Bourdeu d'Aguerre is currently offline Caroline Bourdeu d'Aguerre
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 17 08:36:06 EDT 2014

Powered by FUDForum. Page generated in 0.01684 seconds