Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to map 3 or more keys to KeyStroke
How to map 3 or more keys to KeyStroke [message #634590] Fri, 22 October 2010 07:18 Go to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi guys,

I need to use the typeText() method on a SWTBotText object.

I use CZECH keyboard and when I try write 'Ž' the exception with the message like "can't create keystroke for char 'Ž'" is thrown and I know it's because I need use keyboard mapping file.

So I've created the CS_CZ.keyboard file and registered it with the SWTBot. And there is my problem:

'Ž' is written on the czech keyboard using this key combination
SHIFT + ´ + Z
and I'm not able to figure out how this could be mapped. Since when I use
Ž SHIFT + ´ + Z
in the keyboard file, SWTBot throws this exception:

java.lang.ExceptionInInitializerError
	at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeCharacter(Keyboard.java:100)
	at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText(Keyboard.java:89)
	at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SWTBotText.java:92)
	at cz.tigra.spl.test.swtbot.client.modul.odchylky.pageObjects.ZkusebniListPageObject.vyplnHlavniFormular(ZkusebniListPageObject.java:38)
	at cz.tigra.spl.test.swtbot.client.modul.odchylky.ZkusebniListSWTBotTest.testVytvoreniZkusebnihoListu(ZkusebniListSWTBotTest.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at cz.tigra.swtbot.utils.junit.TigraSWTBotJUnit4ClassRunner.run(TigraSWTBotJUnit4ClassRunner.java:46)
	at org.junit.runners.Suite.runChild(Suite.java:115)
	at org.junit.runners.Suite.runChild(Suite.java:23)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
	at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
	at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: org.eclipse.jface.bindings.keys.ParseException: Cannot create key stroke with duplicate or non-existent modifier key: ´
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseKeyStrokes(KeyboardLayout.java:135)
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseKeyStrokes(KeyboardLayout.java:124)
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.<init>(KeyboardLayout.java:38)
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKeyboardLayout(KeyboardLayout.java:92)
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDefaultKeyboardLayout(KeyboardLayout.java:75)
	at org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
	... 41 more
Caused by: org.eclipse.jface.bindings.keys.ParseException: Cannot create key stroke with duplicate or non-existent modifier key: ´
	at org.eclipse.jface.bindings.keys.KeyStroke.getInstance(KeyStroke.java:134)
	at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseKeyStrokes(KeyboardLayout.java:133)
	... 46 more

Re: How to map 3 or more keys to KeyStroke [message #634793 is a reply to message #634590] Sat, 23 October 2010 11:36 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Seems like yet another keyboard bug similar to
https://bugs.eclipse.org/322186 Never anticipated that there's
keyboards that needed complex handling of layouts, and I assumed that 2
character combos would suffice most users.

Could you open another bug and I'll take a look at it sometime.

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

On 10/22/10 4:19 AM, Behnil wrote:
> Hi guys,
>
> I need to use the typeText() method on a SWTBotText object.
>
> I use CZECH keyboard and when I try write 'Ž' the exception with the
> message like "can't create keystroke for char 'Ž'" is thrown and I know
> it's because I need use keyboard mapping file.
>
> So I've created the CS_CZ.keyboard file and registered it with the
> SWTBot. And there is my problem:
>
> 'Ž' is written on the czech keyboard using this key combination
> SHIFT + ´ + Z and I'm not able to figure out how this could be mapped.
> Since when I use
> Ž SHIFT + ´ + Z in the keyboard file, SWTBot throws this exception:
>
> java.lang.ExceptionInInitializerError
> at
> org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeCharacte r(Keyboard.java:100)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText(Key board.java:89)
> at
> org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SW TBotText.java:92)
>
> at
> cz.tigra.spl.test.swtbot.client.modul.odchylky.pageObjects.Z kusebniListPageObject.vyplnHlavniFormular(ZkusebniListPageOb ject.java:38)
>
> at
> cz.tigra.spl.test.swtbot.client.modul.odchylky.ZkusebniListS WTBotTest.testVytvoreniZkusebnihoListu(ZkusebniListSWTBotTes t.java:62)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( FrameworkMethod.java:44)
>
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(Refl ectiveCallable.java:15)
>
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr ameworkMethod.java:41)
>
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate( InvokeMethod.java:20)
>
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
>
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:73)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:46)
>
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :180)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 41)
> at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java: 173)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
>
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
> cz.tigra.swtbot.utils.junit.TigraSWTBotJUnit4ClassRunner.run (TigraSWTBotJUnit4ClassRunner.java:46)
>
> at org.junit.runners.Suite.runChild(Suite.java:115)
> at org.junit.runners.Suite.runChild(Suite.java:23)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :180)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 41)
> at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java: 173)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
>
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
>
> at
> org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
>
> at
> org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
>
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:71)
>
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.RuntimeException:
> org.eclipse.jface.bindings.keys.ParseException: Cannot create key stroke
> with duplicate or non-existent modifier key: ´
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseK eyStrokes(KeyboardLayout.java:135)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseK eyStrokes(KeyboardLayout.java:124)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.<init >(KeyboardLayout.java:38)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKey boardLayout(KeyboardLayout.java:92)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDef aultKeyboardLayout(KeyboardLayout.java:75)
>
> at
> org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
>
> ... 41 more
> Caused by: org.eclipse.jface.bindings.keys.ParseException: Cannot create
> key stroke with duplicate or non-existent modifier key: ´
> at
> org.eclipse.jface.bindings.keys.KeyStroke.getInstance(KeyStr oke.java:134)
> at
> org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.parseK eyStrokes(KeyboardLayout.java:133)
>
> ... 46 more
>
>
Re: How to map 3 or more keys to KeyStroke [message #634934 is a reply to message #634793] Mon, 25 October 2010 03:40 Go to previous message
Mariot Chauvin is currently offline Mariot Chauvin
Messages: 174
Registered: July 2009
Senior Member
Hi had similar and other problems with french keyboard layout .
I have some hack/dirty code to correct part of the problem, but I never
finish to clean and implement it correctly and completely.
I will comment on bug entries.

Mariot

Ketan Padegaonkar a écrit :
> Seems like yet another keyboard bug similar to
> https://bugs.eclipse.org/322186 Never anticipated that there's
> keyboards that needed complex handling of layouts, and I assumed that
> 2 character combos would suffice most users.
>
> Could you open another bug and I'll take a look at it sometime.
>


--
Mariot Chauvin @ Obeo

http://www.obeo.fr
http://mariot-thoughts.blogspot.com
http://fr.linkedin.com/in/mariotchauvin
Previous Topic:SWTBot and e4
Next Topic:SWTBot Table Cell
Goto Forum:
  


Current Time: Tue Jul 22 19:38:09 EDT 2014

Powered by FUDForum. Page generated in 0.01723 seconds