Java Code Examples for com.intellij.util.indexing.FindSymbolParameters#getCompletePattern()

The following examples show how to use com.intellij.util.indexing.FindSymbolParameters#getCompletePattern() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultChooseByNameItemProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static boolean filterElements(@Nonnull ChooseByNameViewModel base,
                                      @Nonnull ProgressIndicator indicator,
                                      @Nullable PsiElement context,
                                      @Nullable Supplier<String[]> allNamesProducer,
                                      @Nonnull Processor<FoundItemDescriptor<?>> consumer,
                                      @Nonnull FindSymbolParameters parameters) {
  boolean everywhere = parameters.isSearchInLibraries();
  String pattern = parameters.getCompletePattern();
  if (base.getProject() != null) {
    base.getProject().putUserData(ChooseByNamePopup.CURRENT_SEARCH_PATTERN, pattern);
  }

  String namePattern = getNamePattern(base, pattern);
  boolean preferStartMatches = !pattern.startsWith("*");

  List<MatchResult> namesList = getSortedNamesForAllWildcards(base, parameters, indicator, allNamesProducer, namePattern, preferStartMatches);

  indicator.checkCanceled();

  return processByNames(base, everywhere, indicator, context, consumer, preferStartMatches, namesList, parameters);
}
 
Example 2
Source File: GotoFileItemProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean doFilterElements(@Nonnull ChooseByNameBase base,
                                 @Nonnull FindSymbolParameters parameters,
                                 @Nonnull ProgressIndicator indicator,
                                 @Nonnull Processor<FoundItemDescriptor<?>> consumer) {
  long start = System.currentTimeMillis();
  try {
    String pattern = parameters.getCompletePattern();
    PsiFileSystemItem absolute = getFileByAbsolutePath(pattern);
    if (absolute != null && !consumer.process(new FoundItemDescriptor<>(absolute, EXACT_MATCH_DEGREE))) {
      return true;
    }

    if (pattern.startsWith("./") || pattern.startsWith(".\\")) {
      parameters = parameters.withCompletePattern(pattern.substring(1));
    }

    if (!processItemsForPattern(base, parameters, consumer, indicator)) {
      return false;
    }
    String fixedPattern = FixingLayoutMatcher.fixLayout(pattern);
    return fixedPattern == null || processItemsForPattern(base, parameters.withCompletePattern(fixedPattern), consumer, indicator);
  }
  finally {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Goto File \"" + parameters.getCompletePattern() + "\" took " + (System.currentTimeMillis() - start) + " ms");
    }
  }
}
 
Example 3
Source File: DefaultFileNavigationContributor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isDirectoryOnlyPattern(@Nonnull FindSymbolParameters parameters) {
  String completePattern = parameters.getCompletePattern();
  return completePattern.endsWith("/") || completePattern.endsWith("\\");
}