Package com._1c.g5.v8.dt.search.core
Class SearchUtils
java.lang.Object
com._1c.g5.v8.dt.search.core.SearchUtils
Utils to use global search
-
Method Summary
Modifier and TypeMethodDescriptionstatic PatterncompileFullNamePattern(String regex, boolean onlyInNames, boolean isCaseSensitive) Compiles pattern for full name of model object.static Collection<Pattern>compileLastSegmentPatterns(String regex, boolean isCaseSensitive) Compiles pattern for last segment of model object name.static String[]Returns all string matching occurrences in the given text by thesearchTextregexp.static Collection<Pair<String,Integer>> getGroupsWithOffsets(String text, String searchText, boolean caseSencetive) Returns all string matching occurrences in the given text by thesearchTextregexp with their offsets.static Set<org.eclipse.core.resources.IProject>getLinkedProjects(org.eclipse.core.resources.IProject initialProject, IV8ProjectManager projectManager) Gets all linked projects from workspace for creating projects scope for text search find operationstatic booleanmatchesPattern(Pattern pattern, String text) Checks if giventextmatches givenpattern.static booleanmatchesPatterns(Collection<Pattern> patterns, String text) Runs through givenpatternsand checks thattextmatches all patterns.static Collection<org.eclipse.jface.text.IRegion>searchTextRegions(String pattern, String text) Search specific text pattern and return collection of region of matches in given text.
-
Method Details
-
getGroups
Returns all string matching occurrences in the given text by thesearchTextregexp.- Parameters:
text- the text to search in, cannot benullsearchText- the regexp expression or simple text to search, cannot benull- Returns:
- an array with all found string occurrences, never
null
-
getGroupsWithOffsets
public static Collection<Pair<String,Integer>> getGroupsWithOffsets(String text, String searchText, boolean caseSencetive) Returns all string matching occurrences in the given text by thesearchTextregexp with their offsets.- Parameters:
text- the text to search in, cannot benullsearchText- the regexp expression or simple text to search, cannot benull- Returns:
- a collection with pairs: found string occurrences and its offset, never
null
-
searchTextRegions
public static Collection<org.eclipse.jface.text.IRegion> searchTextRegions(String pattern, String text) Search specific text pattern and return collection of region of matches in given text.Note this search is case insensitive.
- Parameters:
pattern- the text pattern to search, cannot benulltext- the text to search in, cannot benull- Returns:
- collection of regions with matches, never
null
-
getLinkedProjects
public static Set<org.eclipse.core.resources.IProject> getLinkedProjects(org.eclipse.core.resources.IProject initialProject, IV8ProjectManager projectManager) Gets all linked projects from workspace for creating projects scope for text search find operation- Parameters:
initialProject- initial project for full text search, cannotnullprojectManager- actualIV8ProjectManager, cannotnull- Returns:
- set of projects for text search find operation, never
null
-
matchesPattern
Checks if giventextmatches givenpattern.- Parameters:
pattern- pattern to match for, cannot benulltext- text to check pattern matching for, cannot benull- Returns:
trueif matches givenpatternfalseotherwise
-
matchesPatterns
Runs through givenpatternsand checks thattextmatches all patterns.- Parameters:
patterns- patterns to match for, cannot benulltext- text to check patterns matching for, cannot benull- Returns:
trueif matches all patterns,falseotherwise
-
compileLastSegmentPatterns
Compiles pattern for last segment of model object name.- Parameters:
regex- regular expression of model object name to comply, segments of object name splitted by ".", cannot benullisCaseSensitive- tells if case is sensitive- Returns:
- compiled pattern, never
null
-
compileFullNamePattern
public static Pattern compileFullNamePattern(String regex, boolean onlyInNames, boolean isCaseSensitive) Compiles pattern for full name of model object.- Parameters:
regex- regular expression of model object name to comply, segments of object name splitted by ".", cannot benullonlyInNames- tells if type of model object also must be consideredisCaseSensitive- tells if case is sensitive- Returns:
- compiled pattern, never
null
-