/** * Processes a change in the contents of the filter widget. * * @param inValue a <code>String</code> value containing the text of the filter widget */ protected final void handleFilter(String inValue) { // inValue contains the full text of what the user entered in the filter widget, e.g. Side=B if (inValue.length() > 0) { // some filter value has been entered, process that value Matcher regexMatcher = mFilterPattern.matcher(inValue); // if the value is meaningful, continue, otherwise, exit and do nothing (no filtering changes) if (regexMatcher.matches()) { // the first match of the regex must be the field against which to match String fieldSpecifier = regexMatcher.group(1); try { // the second is the operator (either '=' or '~=' as dictated by the regex pattern) String operator = regexMatcher.group(2); // the third is the value to match String value = regexMatcher.group(3); // the field name may be one that we've translated to a shorter or more readable version // try to translate it back first String fieldNameToUse = FIXFieldLocalizer.readFIXFieldNameFromCache(fieldSpecifier); // dig out the field object indicated by the fieldSpecified (a failure will throw a // CoreException) Field<?> fixField = FIXMessageUtil.getQuickFixFieldFromName(fieldNameToUse); // this is the int value of the FIX field which we now know is valid int fixFieldInt = fixField.getField(); // create a matcher depending on the operator entered by the user if ("=".equals(operator)) { // $NON-NLS-1$ // use a straight string matcher getFilterMatcherEditor().setMatcher(createStringMatcher(fixFieldInt, value)); } else { // use a regex matcher assert "~=".equals(operator); // $NON-NLS-1$ getFilterMatcherEditor().setMatcher(createRegexMatcher(fixFieldInt, value)); } } catch (Throwable t) { PhotonPlugin.getMainConsoleLogger().error(UNRECOGNIZED_FIELD.getText(fieldSpecifier)); } } } else { // the value entered by the user is of zero length, use the default matcher getFilterMatcherEditor().setMatcher(getDefaultMatcher()); } }