Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Jan 17, 2025
1 parent bff2fd8 commit 0a05cc8
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
Expand Down Expand Up @@ -136,7 +138,8 @@ private boolean shouldShowObjectWithName(Object element) {
// Normalise in case of multi-line text
name = StringUtils.normaliseNewLineCharacters(name);

return name.toLowerCase().contains(fSearchText.toLowerCase());
//return name.toLowerCase().contains(fSearchText.toLowerCase());
return matchesRegexString(name);
}

return false;
Expand Down Expand Up @@ -177,6 +180,17 @@ private boolean shouldShowProperty(Object element) {

return false;
}

private boolean matchesRegexString(String searchString) {
try {
Pattern pattern = Pattern.compile(fSearchText, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(searchString);
return matcher.find();
}
catch(Exception ex) {
return false;
}
}

public boolean isFiltering() {
return isFilteringName() || isFilteringDocumentation() || isFilteringConcepts() || isFilteringPropertyKeys() || isFilteringSpecializations() || isFilteringViews();
Expand Down

0 comments on commit 0a05cc8

Please sign in to comment.