Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Getting @ to work with a UK keyboard(How do I define the active keyboard to SWTBot)
Getting @ to work with a UK keyboard [message #545429] Wed, 07 July 2010 17:59 Go to next message
John Ormerod is currently offline John OrmerodFriend
Messages: 39
Registered: January 2010
Member
Hello
I've just startes using this - it's great!

But... I met a brickwall when I tried to find a Tree entry with an '@' in it (to be precise the tree item's label was "eliza doolittle (eliza@localhost)".

I tried all sorts of ways to get this selected so I could click it, without success. Then I remembered that on a US keyboard, the '@' sign is upper case 2, whereas on mine it is upper case <single quote>.

When I changed the XP keyboard setting to US, the test worked.

Searches to see how I fix this, keep leading me to the wiki's page on keyboard layouts at: http://wiki.eclipse.org/SWTBot/Keyboard_Layouts

The problem is, that after reading it, and in spite of (or is it, because of) 40 years in IT, I have absolutely no idea what I should do!

To me, this page is aimed at people who already know a lot about SWTBot, whereas this problem is one that all people outside the US will meet early on. Apologies for being critical (I'm not ungrateful), but one thing I have l learned is that if I find something to be a problem, I am probably not the only one.

From what I have read, I can:
- set a system property "org.eclipse.swtbot.keyboard.strategy", but, what to and where?
- set a variable SWTBotPreferences#KEYBOARD_STRATEGY, again, what to and where?
- use a .keyboard file - where is it, I can't find one in the eclipse plugins.

The problem I'm having is that as there are no examples of using / creating a non-US keyboard definition, I have no idea how to proceed. In my case, most of the keys are the same, it's just a few that I need to overrride, in effect.

If anyone can point me to the answer, or provide a simple example, I'd imagine it would help me and others a lot.

Regards, John


Re: Getting @ to work with a UK keyboard [message #545775 is a reply to message #545429] Fri, 09 July 2010 04:38 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hi John,

The wiki page does seem a bit confusing, and I'm fixing the page as I
write this email, it should be fixed by the time you read this email :)

Tree selection is orthogonal to keyboard layouts, and keyboard layouts
are used only when you type something using the #typeText API.

Tree expansions/selections are a bit confusing to first time users. The
correct way to select the tree item is:

tree.expandNode("node 1").expandNode("node 1.1").select("node 1.1.1")

This will set the tree selection to "node 1.1.1".

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot | @ketanpkr


On 7/7/10 10:59 AM, John Ormerod wrote:
> Hello
> I've just startes using this - it's great!
>
> But... I met a brickwall when I tried to find a Tree entry with an
> mailto:'@' in it (to be precise the tree item's label was "eliza
> doolittle (mailto:eliza@localhost)".
>
> I tried all sorts of ways to get this selected so I could click it,
> without success. Then I remembered that on a US keyboard, the mailto:'@'
> sign is upper case 2, whereas on mine it is upper case <single quote>.
>
> When I changed the XP keyboard setting to US, the test worked.
>
> Searches to see how I fix this, keep leading me to the wiki's page on
> keyboard layouts at: http://wiki.eclipse.org/SWTBot/Keyboard_Layouts
>
> The problem is, that after reading it, and in spite of (or is it,
> because of) 40 years in IT, I have absolutely no idea what I should do!
> To me, this page is aimed at people who already know a lot about SWTBot,
> whereas this problem is one that all people outside the US will meet
> early on. Apologies for being critical (I'm not ungrateful), but one
> thing I have l learned is that if I find something to be a problem, I am
> probably not the only one.
>
> From what I have read, I can:
> - set a system property "org.eclipse.swtbot.keyboard.strategy", but,
> what to and where?
> - set a variable SWTBotPreferences#KEYBOARD_STRATEGY, again, what to and
> where?
> - use a .keyboard file - where is it, I can't find one in the eclipse
> plugins.
>
> The problem I'm having is that as there are no examples of using /
> creating a non-US keyboard definition, I have no idea how to proceed. In
> my case, most of the keys are the same, it's just a few that I need to
> overrride, in effect.
>
> If anyone can point me to the answer, or provide a simple example, I'd
> imagine it would help me and others a lot.
>
> Regards, John
>
>
>
Re: Getting @ to work with a UK keyboard [message #545908 is a reply to message #545775] Fri, 09 July 2010 15:04 Go to previous messageGo to next message
John Ormerod is currently offline John OrmerodFriend
Messages: 39
Registered: January 2010
Member
Hi Ketan
many thanks for your reply.

After I had changed my keyboard to US, selection started working. However, in one of those strange IT things, after I restored the keyboard to UK, selection continued to work! As they say, nothing breeds success like successs.

The expansion, selection and clicking are now working.

I'll see if I can create a UK .keyboard file following your updated instructions in the wiki - I assume its code would be EN-GB.

The link to 'SWTBot/Contributing SWTBot source repository' for the KeyboardLayoutGenerator source, results in an empty editor with a msg that the page doesn't exist - I guess I might be getting ahead of you.

I have created a version by pasting the code - it can't resolve the Keys class in the typeKeystrokes() method.

So, I am perched here for the moment.

Regards
Re: Getting @ to work with a UK keyboard [message #545915 is a reply to message #545908] Fri, 09 July 2010 15:21 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 7/9/10 8:04 AM, John Ormerod wrote:
> After I had changed my keyboard to US, selection started working.
> However, in one of those strange IT things, after I restored the
> keyboard to UK, selection continued to work! As they say, nothing breeds
> success like successs.

Let us know if you're able to reproduce it again.

> I'll see if I can create a UK .keyboard file following your updated
> instructions in the wiki - I assume its code would be EN-GB.

I think it might have to be EN_GB. If you do not set any value to the
SWTBotPreferences.KEYBOARD_LAYOUT, the error message will tell you what
file it expected.

> The link to 'SWTBot/Contributing SWTBot source repository' for the
> KeyboardLayoutGenerator source, results in an empty editor with a msg
> that the page doesn't exist - I guess I might be getting ahead of you.

The link was incorrect(http://wiki.eclipse.org/SWTBot/Contributing),
I've fixed it.

> I have created a version by pasting the code - it can't resolve the Keys
> class in the typeKeystrokes() method.
> So, I am perched here for the moment.

All the classes are in the same folder as the KeyboardLayoutGenerator
class(http://goo.gl/Chzz).

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: Getting @ to work with a UK keyboard [message #546243 is a reply to message #545429] Mon, 12 July 2010 09:38 Go to previous messageGo to next message
Tim Moore is currently offline Tim MooreFriend
Messages: 6
Registered: July 2009
Junior Member
I'm also trying to define a EN_GB keyboard, but I'm having problems with defining special characters (e.g. '#') - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=319368.

I've not had any luck with the layout generator yet. The easiest thing seems to be:
* Get hold of the EN_US layout keyboard, edit it and rename to e.g. EN_GB.keyboard.
* Define the package-qualified path to the keyboard e.g. com.foo.bar.EN_GB, either using a -Dorg.eclipse.swtbot.keyboard.layout or by setting it directory on SWTBotPreferences.
* Very important: Make the plugin containing the config file an Eclipse Register Buddy of SWTBot finder plugin: http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.swtbot /msg00741.html
Re: Getting @ to work with a UK keyboard [message #546252 is a reply to message #545915] Mon, 12 July 2010 09:59 Go to previous message
John Ormerod is currently offline John OrmerodFriend
Messages: 39
Registered: January 2010
Member
Hi Ketan

Not sure if I will be able to recreate the 'learned behaviour', that I think I observed. Could be finger trouble, as I thought it had come back. Then spotted that the app's login had not remembered the previous userid. Correcting that, restored normal behaviour.

I have now followed the wiki instructions and generated a EN_GB.keyboard file - which is the one that SWTBot tells me it can't find as a default.

I now have a problem understanding where to put it, so it can be found, and/or how to tell SWTBot where it is.

I copied the EN_GB.keyboard file to the root of the test project. I provided a "-Dorg.eclipse.swtbot.keyboard.layout" parameter, and guessed at "/EN_GB.keyboard". That didn't work. Then I spotted the actual exception message said it couldn't find "/EN_GB.keyboard.keyboard". So, I tried using "/EN_GB", but it still can't find the "EN_GB.keyboard file".

The documentation refers to "/foo/bar/..." stuff. I have a psychological block when I see this as I usually find it confusing! (foo and bar appeared out of nowhere when I took my first steps in Java in the late 90s, and have never got comfortable with its usage).

Once I am past this step and all is working, I will create a description in "layman's" language, which might help others who are new to all this.

Regards, John

Previous Topic:How do I create a CR?
Next Topic:Running SWTBot from a cronjob
Goto Forum:
  


Current Time: Thu Apr 25 12:30:10 GMT 2024

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

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

Back to the top