Java Code Examples for com.intellij.psi.search.ProjectScope#getProjectScope()

The following examples show how to use com.intellij.psi.search.ProjectScope#getProjectScope() . 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: FindUsagesOptions.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static SearchScope calcScope(@Nonnull Project project, @Nullable DataContext dataContext) {
  String defaultScopeName = FindSettings.getInstance().getDefaultScopeName();
  List<SearchScope> predefined = PredefinedSearchScopeProvider.getInstance().getPredefinedScopes(project, dataContext, true, false, false,
                                                                                                 false);
  SearchScope resultScope = null;
  for (SearchScope scope : predefined) {
    if (scope.getDisplayName().equals(defaultScopeName)) {
      resultScope = scope;
      break;
    }
  }
  if (resultScope == null) {
    resultScope = ProjectScope.getProjectScope(project);
  }
  return resultScope;
}
 
Example 2
Source File: ModuleWithDependentsScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
ModuleWithDependentsScope(@Nonnull Module module) {
  super(module.getProject());
  myModule = module;

  myProjectFileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
  myProjectScope = ProjectScope.getProjectScope(module.getProject());

  myModules = buildDependents(myModule);
}
 
Example 3
Source File: FindSymbolParameters.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static GlobalSearchScope searchScopeFor(@Nullable Project project, boolean searchInLibraries) {
  GlobalSearchScope baseScope = project == null ? new EverythingGlobalScope() : searchInLibraries ? ProjectScope.getAllScope(project) : ProjectScope.getProjectScope(project);

  return baseScope.intersectWith(new EverythingGlobalScope(project) {
    @Override
    public boolean contains(@Nonnull VirtualFile file) {
      return !(file.getFileSystem() instanceof HiddenFileSystem);
    }
  });
}
 
Example 4
Source File: InplaceRefactoring.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected SearchScope getReferencesSearchScope(VirtualFile file) {
  return file == null || ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(file)
         ? ProjectScope.getProjectScope(myElementToRename.getProject())
         : new LocalSearchScope(myElementToRename.getContainingFile());
}
 
Example 5
Source File: MemberInplaceRenamer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected SearchScope getReferencesSearchScope(VirtualFile file) {
  PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
  return currentFile != null ? new LocalSearchScope(currentFile)
                             : ProjectScope.getProjectScope(myProject);
}
 
Example 6
Source File: OttoProjectHandler.java    From otto-intellij-plugin with Apache License 2.0 4 votes vote down vote up
private void findEventsViaMethodsAnnotatedSubscribe() {
  GlobalSearchScope projectScope = ProjectScope.getProjectScope(myProject);
  for (SubscriberMetadata subscriberMetadata : SubscriberMetadata.getAllSubscribers()) {
    performSearch(projectScope, subscriberMetadata.getSubscriberAnnotationClassName());
  }
}