Package org.fest.swing.exception

Examples of org.fest.swing.exception.ParsingException


  public KeyStrokeMappingProvider parse(File file) {
    validate(file);
    try {
      return parse(fileAsStream(file));
    } catch (IOException e) {
      throw new ParsingException(concat("An I/O error ocurred while parsing file ", file), e);
    }
  }
View Full Code Here


  private InputStream fileAsStream(File file) {
    try {
      return new FileInputStream(file);
    } catch (FileNotFoundException e) {
      throw new ParsingException(concat("The file ", file.getPath(), " was not found"), e);
    }
  }
View Full Code Here

  private static String[] split(String line) {
    return line.trim().split(",");
  }

  private static ParsingException notConformingWithPatternError(String line) {
    return new ParsingException(concat(
        "Line ", quote(line), " does not conform with pattern '{char}, {keycode}, {modifiers}'"));
  }
View Full Code Here

  }

  private static char characterFrom(String s) {
    if (SPECIAL_MAPPINGS.containsKey(s)) return SPECIAL_MAPPINGS.get(s);
    if (s.length() == 1) return s.charAt(0);
    throw new ParsingException(concat("The text ", quote(s) , " should have a single character"));
  }
View Full Code Here

  private static int keyCodeFrom(String s) {
    try {
      return staticField(keyCodeNameFrom(s)).ofType(int.class).in(KeyEvent.class).get();
    } catch (ReflectionError e) {
      throw new ParsingException(concat("Unable to retrieve key code from text ", quote(s)), e.getCause());
    }
  }
View Full Code Here

  private static int modifiersFrom(String s) {
    if ("NO_MASK".equals(s)) return NO_MASK;
    try {
      return staticField(s).ofType(int.class).in(InputEvent.class).get();
    } catch (ReflectionError e) {
      throw new ParsingException(concat("Unable to retrieve modifiers from text ", quote(s)), e.getCause());
    }
  }
View Full Code Here

TOP

Related Classes of org.fest.swing.exception.ParsingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.