protected static void preselectLastPathComponent(@NotNull JTextField field) {
    final String text = field.getText();
    final int start = text.lastIndexOf(File.separatorChar);
    final int lastDotIndex = text.lastIndexOf('.');
    final int end = lastDotIndex < 0 ? text.length() : lastDotIndex;
    if (start + 1 < end) {
      field.select(start + 1, end);
    }
    field.putClientProperty(DialogWrapperPeer.HAVE_INITIAL_SELECTION, true);
  }
protected static void preselectLastPathComponent(@NotNull JTextField field)