Exemplo n.º 1
0
 private KeyboardEvent getKeyboardEventFromRegistry(String path) {
   NullCheck.notNull(path, "path");
   final Settings.HotKey proxy = Settings.createHotKey(registry, path);
   KeyboardEvent.Special special = null;
   char c = ' ';
   final String specialStr = proxy.getSpecial("");
   if (!specialStr.trim().isEmpty()) {
     special = KeyboardEvent.translateSpecial(specialStr);
     if (special == null) {
       Log.error(
           "core",
           "registry path "
               + path
               + " tries to use an unknown special keyboard code \'"
               + specialStr
               + "\'");
       return null;
     }
   } else {
     final String charStr = proxy.getCharacter("");
     if (charStr.isEmpty()) {
       Log.error(
           "core",
           "registry path "
               + path
               + " does not contain neither \'special\' nor \'character\' values");
       return null;
     }
     c = charStr.charAt(0);
   }
   final boolean withControl = proxy.getWithControl(false);
   final boolean withShift = proxy.getWithShift(false);
   final boolean withAlt = proxy.getWithAlt(false);
   return new KeyboardEvent(special != null, special, c, withShift, withControl, withAlt);
 }