diff options
Diffstat (limited to 'extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java')
-rw-r--r-- | extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java index 5a7514bf70b..b4c67f63a02 100644 --- a/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java +++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.uml.search.ui/src/org/eclipse/papyrus/cdo/uml/search/internal/ui/query/PatternUtil.java @@ -37,17 +37,25 @@ public class PatternUtil { * @param caseSensitive * whether the search is case-sensitive * @param regularExpression - * whether the search tex is to be interpreted as a regular expression + * whether the search text is to be interpreted as a regular expression + * @param allStringAttributes + * whether the search text is sought in all string attributes of an object * * @return the appropriately modified string specifying the regular expression search term, or {@code null} if the search text * is actually a literal exact sub-string match */ - public static String wrap(String searchText, boolean caseSensitive, boolean regularExpression) { + public static String wrap(String searchText, boolean caseSensitive, boolean regularExpression, boolean allStringAttributes) { String result; if(caseSensitive) { if(!regularExpression) { - result = null; // simple sub-string search + if(allStringAttributes) { + // the cdoMatches() operation needs a regex + result = String.format("%s%s%s", WILDCARD, quote(searchText), WILDCARD); + } else { + // we use "indexOf(searchPattern) > 0" to do a simple sub-string search + result = null; + } } else { result = ensureRegexSubstring(searchText); } |