public static CustomChoice create()

in src/org/jetbrains/r/visualization/inlays/table/filters/gui/CustomChoice.java [141:189]


  public static CustomChoice create(final Object choice, String repr) {
    if (choice instanceof Pattern) {
      return new CustomChoice(repr) {

        private static final long serialVersionUID = -3239105477862513930L;

        @Override
        public RowFilter getFilter(final IFilterEditor ed) {
          final int index = ed.getModelIndex();
          final Pattern pattern = (Pattern)choice;
          return new RowFilter() {
            @Override
            public boolean include(Entry entry) {
              Object o = entry.getValue(index);
              if (o == null) {
                return false;
              }
              Format fmt = ed.getFormat();
              String s = (fmt == null) ? o.toString() :
                         fmt.format(o);
              return pattern.matcher(s).matches();
            }
          };
        }
      };
    }
    return new CustomChoice(repr) {
      private static final long serialVersionUID = -3573642873044716998L;

      @Override
      public RowFilter getFilter(final IFilterEditor editor) {
        final int index = editor.getModelIndex();
        final String string = (choice instanceof String)
                              ? (String)choice : null;
        return new RowFilter() {
          @Override
          public boolean include(Entry entry) {
            Object o = entry.getValue(index);
            if ((string != null) && (o instanceof String)
                && editor.isIgnoreCase()) {
              return string.equalsIgnoreCase((String)o);
            }

            return choice.equals(o);
          }
        };
      }
    };
  }