move PsiShortNamesCache to java-indexing

This commit is contained in:
Evgeny Pasynkov
2012-07-25 12:10:51 +02:00
parent 2f5d4b905d
commit 8cdaaee00d
11 changed files with 18 additions and 4 deletions
@@ -0,0 +1,155 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.search;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* Allows to retrieve files and Java classes, methods and fields in a project by
* non-qualified names.
*
*/
public abstract class PsiShortNamesCache {
/**
* Return the composite short names cache, uniting all short name cache instances registered via extensions.
*
* @param project the project to return the cache for.
* @return the cache instance.
*/
public static PsiShortNamesCache getInstance(Project project) {
return ServiceManager.getService(project, PsiShortNamesCache.class);
}
public static final ExtensionPointName<PsiShortNamesCache> EP_NAME = ExtensionPointName.create("com.intellij.java.shortNamesCache");
/**
* Returns the list of files with the specified name.
*
* @param name the name of the files to find.
* @return the list of files in the project which have the specified name.
*/
@NotNull
public PsiFile[] getFilesByName(@NotNull String name) {
return PsiFile.EMPTY_ARRAY;
}
/**
* Returns the list of names of all files in the project.
*
* @return the list of all file names in the project.
*/
@NotNull
public String[] getAllFileNames() {
return ArrayUtil.EMPTY_STRING_ARRAY;
}
/**
* Returns the list of all classes with the specified name in the specified scope.
*
* @param name the non-qualified name of the classes to find.
* @param scope the scope in which classes are searched.
* @return the list of found classes.
*/
@NotNull
public abstract PsiClass[] getClassesByName(@NotNull @NonNls String name, @NotNull GlobalSearchScope scope);
/**
* Returns the list of names of all classes in the project and
* (optionally) libraries.
*
* @return the list of all class names.
*/
@NotNull
public abstract String[] getAllClassNames();
/**
* Adds the names of all classes in the project and (optionally) libraries
* to the specified set.
*
* @param dest the set to add the names to.
*/
public abstract void getAllClassNames(@NotNull HashSet<String> dest);
/**
* Returns the list of all methods with the specified name in the specified scope.
*
* @param name the name of the methods to find.
* @param scope the scope in which methods are searched.
* @return the list of found methods.
*/
@NotNull
public abstract PsiMethod[] getMethodsByName(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope);
@NotNull
public abstract PsiMethod[] getMethodsByNameIfNotMoreThan(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, int maxCount);
@NotNull
public abstract PsiField[] getFieldsByNameIfNotMoreThan(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, int maxCount);
public abstract boolean processMethodsWithName(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, @NotNull Processor<PsiMethod> processor);
/**
* Returns the list of names of all methods in the project and
* (optionally) libraries.
*
* @return the list of all method names.
*/
@NotNull
public abstract String[] getAllMethodNames();
/**
* Adds the names of all methods in the project and (optionally) libraries
* to the specified set.
*
* @param set the set to add the names to.
*/
public abstract void getAllMethodNames(@NotNull HashSet<String> set);
/**
* Returns the list of all fields with the specified name in the specified scope.
*
* @param name the name of the fields to find.
* @param scope the scope in which fields are searched.
* @return the list of found fields.
*/
@NotNull
public abstract PsiField[] getFieldsByName(@NotNull @NonNls String name, @NotNull GlobalSearchScope scope);
/**
* Returns the list of names of all fields in the project and
* (optionally) libraries.
*
* @return the list of all field names.
*/
@NotNull
public abstract String[] getAllFieldNames();
/**
* Adds the names of all methods in the project and (optionally) libraries
* to the specified set.
*
* @param set the set to add the names to.
*/
public abstract void getAllFieldNames(@NotNull HashSet<String> set);
}