in src/org/jetbrains/r/visualization/inlays/table/filters/gui/editor/EditorComponent.java [564:622]
protected void updateFilter(String text,
ChoiceMatch match,
boolean userUpdate) {
RowFilter currentFilter = filter;
boolean localError = false;
if (text == null) {
match = null;
text = getText();
}
if (match == null) {
match = getBestMatch(text);
}
// perform actions in a try/catch due to text parsing exceptions
try {
if (match.exact) {
content = match.content;
if (match.content instanceof CustomChoice) {
CustomChoice cc = (CustomChoice) content;
filter = cc.getFilter(filterEditor);
} else {
filter = textParser.parseText(parseEscape(text));
}
} else if (instantFiltering && userUpdate) {
// parse the expression as it is. If this would produce
// no rows, evaluate the filter as an instant expression
filter = textParser.parseText(parseEscape(text));
if (filterEditor.attemptFilterUpdate(filter)) {
content = text;
setWarning(false);
currentFilter = filter; // to not apply it again below
} else {
InstantFilter iFilter = textParser.parseInstantText(
parseEscape(text));
content = iFilter.expression;
filter = iFilter.filter;
}
} else {
filter = textParser.parseText(parseEscape(text));
content = text;
}
} catch (ParseException pex) {
filter = null;
content = text;
localError = true;
}
setError(localError);
if (filter != currentFilter) {
if (userUpdate && !allowInstantVanishing) {
// in this case, the filter is only propagated if it does
// not filter all rows out. If it would, just set the
// warning color -unset it otherwise-
setWarning(!filterEditor.attemptFilterUpdate(filter));
} else {
filterEditor.filterUpdated(filter);
}
}
}