Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKetan Padegaonkar2010-11-04 02:39:47 -0400
committerKetan Padegaonkar2010-11-04 02:39:47 -0400
commitf2c44bcc689bd71348c207dc6191c4b274e516c2 (patch)
tree070ecf23b9c50b8042087760c7164cece1c36560
parent4d7ead6f944a37914c1957841c1455d0c8533e78 (diff)
downloadorg.eclipse.swtbot-f2c44bcc689bd71348c207dc6191c4b274e516c2.tar.gz
org.eclipse.swtbot-f2c44bcc689bd71348c207dc6191c4b274e516c2.tar.xz
org.eclipse.swtbot-f2c44bcc689bd71348c207dc6191c4b274e516c2.zip
280562: Deprecate the existing KeyboardLayout class. Will put in a new KeyboardLayout based on the new mapping.
[keyboard layouts] support for alt+gr keys on keyboards that have the key https://bugs.eclipse.org/bugs/show_bug.cgi?id=280562
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayoutTest.java (renamed from org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayoutTest.java)6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayout.java (renamed from org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayout.java)15
3 files changed, 12 insertions, 11 deletions
diff --git a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayoutTest.java b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayoutTest.java
index be5771c3..0278c2c7 100644
--- a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayoutTest.java
+++ b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayoutTest.java
@@ -23,18 +23,18 @@ import org.junit.Test;
* @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
* @version $Id$
*/
-public class KeyboardLayoutTest {
+public class OldKeyboardLayoutTest {
@Test
public void shouldBeAbleToParseUserProvidedKeyboardLayout() throws Exception {
- KeyboardLayout layout = KeyboardLayout.getKeyboardLayout("com.foo.bar.BAZ");
+ OldKeyboardLayout layout = OldKeyboardLayout.getKeyboardLayout("com.foo.bar.BAZ");
assertEquals(keys(SWT.SHIFT, 't'), layout.keyStrokeFor('#'));
}
@Test
public void shouldBeAbleToParseUserProvidedKeyboardLayoutViaPreference() throws Exception {
SWTBotPreferences.KEYBOARD_LAYOUT = "com.foo.bar.MAC_FOOBAR";
- KeyboardLayout layout = KeyboardLayout.getDefaultKeyboardLayout();
+ OldKeyboardLayout layout = OldKeyboardLayout.getDefaultKeyboardLayout();
assertEquals(keys(SWT.SHIFT, 'Y'), layout.keyStrokeFor('*'));
}
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java
index cf175664..6f63fd40 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java
@@ -107,7 +107,7 @@ public class Keystrokes {
public static final KeyStroke PAGE_DOWN = KeyStroke.getInstance(0, SWT.PAGE_DOWN);
/** The keyboard layout to use for mapping characters. */
- private static KeyboardLayout defaultKeyboardLayout = KeyboardLayout.getDefaultKeyboardLayout();
+ private static OldKeyboardLayout defaultKeyboardLayout = OldKeyboardLayout.getDefaultKeyboardLayout();
/**
* @param ch the character to convert to {@link KeyStroke}s.
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayout.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayout.java
index 3769166a..0a967c97 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayout.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/OldKeyboardLayout.java
@@ -28,11 +28,12 @@ import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
* @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
* @version $Id$
*/
-class KeyboardLayout {
+@Deprecated
+class OldKeyboardLayout {
private final BidiMap<Character, KeyStroke> keyStrokes = new BidiMap<Character, KeyStroke>();
private final String layoutName;
- private KeyboardLayout(String name, URL resource) throws IOException {
+ private OldKeyboardLayout(String name, URL resource) throws IOException {
this.layoutName = name;
initialiseDefaults();
parseKeyStrokes(resource);
@@ -71,7 +72,7 @@ class KeyboardLayout {
* @return the default keyboard layout.
* @see SWTBotPreferences#KEYBOARD_LAYOUT
*/
- public static KeyboardLayout getDefaultKeyboardLayout() {
+ public static OldKeyboardLayout getDefaultKeyboardLayout() {
return getKeyboardLayout(SWTBotPreferences.KEYBOARD_LAYOUT);
}
@@ -79,8 +80,8 @@ class KeyboardLayout {
* @param layoutName the layout of the keyboard.
* @return the keyboard layout corresponding to the specified layout.
*/
- public static KeyboardLayout getKeyboardLayout(String layoutName) {
- ClassLoader classLoader = KeyboardLayout.class.getClassLoader();
+ public static OldKeyboardLayout getKeyboardLayout(String layoutName) {
+ ClassLoader classLoader = OldKeyboardLayout.class.getClassLoader();
URL configURL = classLoader.getResource(toFolder(myPackage() + "." + layoutName) + ".keyboard");
if (configURL == null)
@@ -89,14 +90,14 @@ class KeyboardLayout {
throw new IllegalArgumentException(layoutName + ".keyboard not found, see http://wiki.eclipse.org/SWTBot/Keyboard_Layouts for more information.");
try {
- return new KeyboardLayout(layoutName, configURL);
+ return new OldKeyboardLayout(layoutName, configURL);
} catch (IOException e) {
throw new IllegalStateException("could not parse " + layoutName + " keyboard layout properties");
}
}
private static String myPackage() {
- return KeyboardLayout.class.getPackage().getName();
+ return OldKeyboardLayout.class.getPackage().getName();
}
private static String toFolder(String layoutName) {

Back to the top