Class SearchUtils

java.lang.Object
com._1c.g5.v8.dt.search.core.SearchUtils

public final class SearchUtils extends Object
Utils to use global search
  • Method Details

    • getGroups

      public static String[] getGroups(String text, String searchText)
      Returns all string matching occurrences in the given text by the searchText regexp.
      Parameters:
      text - the text to search in, cannot be null
      searchText - the regexp expression or simple text to search, cannot be null
      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 the searchText regexp with their offsets.
      Parameters:
      text - the text to search in, cannot be null
      searchText - the regexp expression or simple text to search, cannot be null
      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 be null
      text - the text to search in, cannot be null
      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, cannot null
      projectManager - actual IV8ProjectManager, cannot null
      Returns:
      set of projects for text search find operation, never null
    • matchesPattern

      public static boolean matchesPattern(Pattern pattern, String text)
      Checks if given text matches given pattern.
      Parameters:
      pattern - pattern to match for, cannot be null
      text - text to check pattern matching for, cannot be null
      Returns:
      true if matches given pattern false otherwise
    • matchesPatterns

      public static boolean matchesPatterns(Collection<Pattern> patterns, String text)
      Runs through given patterns and checks that text matches all patterns.
      Parameters:
      patterns - patterns to match for, cannot be null
      text - text to check patterns matching for, cannot be null
      Returns:
      true if matches all patterns, false otherwise
    • compileLastSegmentPatterns

      public static Collection<Pattern> compileLastSegmentPatterns(String regex, boolean isCaseSensitive)
      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 be null
      isCaseSensitive - 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 be null
      onlyInNames - tells if type of model object also must be considered
      isCaseSensitive - tells if case is sensitive
      Returns:
      compiled pattern, never null