本文整理汇总了Java中com.intellij.psi.stubs.StubIndexKey类的典型用法代码示例。如果您正苦于以下问题:Java StubIndexKey类的具体用法?Java StubIndexKey怎么用?Java StubIndexKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StubIndexKey类属于com.intellij.psi.stubs包,在下文中一共展示了StubIndexKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIndexDirectory
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
@NotNull
private static File getIndexDirectory(@NotNull ID<?, ?> indexName, boolean forVersion, String relativePath) {
final String dirName = indexName.toString().toLowerCase(Locale.US);
File indexDir;
if (indexName instanceof StubIndexKey) {
// store StubIndices under StubUpdating index' root to ensure they are deleted
// when StubUpdatingIndex version is changed
indexDir = new File(getIndexDirectory(StubUpdatingIndex.INDEX_ID, false, relativePath), forVersion ? STUB_VERSIONS : dirName);
} else {
if (relativePath.length() > 0) relativePath = File.separator + relativePath;
indexDir = new File(PathManager.getIndexRoot() + relativePath, dirName);
}
indexDir.mkdirs();
return indexDir;
}
示例2: addVariantsFromIndex
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
private static <T extends PsiNamedElement> void addVariantsFromIndex(final CompletionResultSet resultSet,
final PsiFile targetFile,
final StubIndexKey<String, T> key,
final InsertHandler<LookupElement> insertHandler,
final Condition<? super T> condition, Class<T> elementClass) {
final Project project = targetFile.getProject();
GlobalSearchScope scope = PyProjectScopeBuilder.excludeSdkTestsScope(targetFile);
Collection<String> keys = StubIndex.getInstance().getAllKeys(key, project);
for (final String elementName : CompletionUtil.sortMatching(resultSet.getPrefixMatcher(), keys)) {
for (T element : StubIndex.getElements(key, elementName, project, scope, elementClass)) {
if (condition.value(element)) {
resultSet.addElement(LookupElementBuilder.createWithIcon(element)
.withTailText(" " + ((NavigationItem)element).getPresentation().getLocationString(), true)
.withInsertHandler(insertHandler));
}
}
}
}
示例3: findAllRobotKeywordDefsInRobotFilesStartingWith
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
public static void findAllRobotKeywordDefsInRobotFilesStartingWith(Project project, List<PsiElement> results, String startsWith) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final String normalizedStartsWith = RobotPsiUtil.normalizeRobotDefinedKeywordForIndex(startsWith);
String keyValue;
StubIndexKey<String, RobotKeywordTitle> indexKey;
if (normalizedStartsWith.length() >= 3) {
keyValue = normalizedStartsWith.substring(0, 3);
indexKey = RobotKeywordDefFirstThreeCharsIndex.KEY;
} else if (normalizedStartsWith.length() >= 2) {
keyValue = normalizedStartsWith.substring(0, 2);
indexKey = RobotKeywordTitleFirstTwoCharsIndex.KEY;
} else if (normalizedStartsWith.length() >= 1) {
keyValue = normalizedStartsWith.substring(0, 1);
indexKey = RobotKeywordDefFirstCharIndex.KEY;
} else {
findAllRobotKeywordDefsInRobotFiles(project, results);
return;
}
GlobalSearchScope robotFilesScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), RobotFileType.INSTANCE);
RobotKeywordDefProcessor processor = new RobotKeywordDefProcessor(results, SearchType.STARTS_WITH, startsWith);
STUB_INDEX.processElements(indexKey, keyValue, project, robotFilesScope, RobotKeywordTitle.class, processor);
}
示例4: indexStub
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
public static void indexStub(@NotNull IndexSink indexSink,
@NotNull StubIndexKey<String, ? extends DotNetQualifiedElement> elementByQNameKey,
@NotNull StubIndexKey<String, ? extends DotNetQualifiedElement> namespaceKey,
@NotNull String namespace,
@NotNull String name)
{
String indexableNamespace = getIndexableNamespace(namespace);
name = consulo.internal.dotnet.msil.decompiler.util.MsilHelper.cutGenericMarker(name);
indexSink.occurrence(elementByQNameKey, indexableNamespace + "." + name);
if(!StringUtil.isEmpty(namespace))
{
QualifiedName parent = QualifiedName.fromDottedString(namespace);
do
{
indexSink.occurrence(namespaceKey, getIndexableNamespace(parent));
}
while((parent = parent.getParent()) != null);
}
else
{
indexSink.occurrence(namespaceKey, indexableNamespace);
}
}
示例5: getContainingIds
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
@Nonnull
@Override
public <Key> IdIterator getContainingIds(@Nonnull StubIndexKey<Key, ?> indexKey,
@Nonnull Key dataKey,
@Nonnull Project project,
@Nonnull GlobalSearchScope scope) {
return new IdIterator() {
@Override
public boolean hasNext() {
return false;
}
@Override
public int next() {
return 0;
}
@Override
public int size() {
return 0;
}
};
}
示例6: getIndexDirectory
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
@Nonnull
private static File getIndexDirectory(@Nonnull ID<?, ?> indexName, boolean forVersion, String relativePath) {
final String dirName = indexName.toString().toLowerCase(Locale.US);
File indexDir;
if (indexName instanceof StubIndexKey) {
// store StubIndices under StubUpdating index' root to ensure they are deleted
// when StubUpdatingIndex version is changed
indexDir = new File(getIndexDirectory(StubUpdatingIndex.INDEX_ID, false, relativePath), forVersion ? STUB_VERSIONS : dirName);
} else {
if (relativePath.length() > 0) relativePath = File.separator + relativePath;
indexDir = new File(PathManager.getIndexRoot() + relativePath, dirName);
}
indexDir.mkdirs();
return indexDir;
}
示例7: getCandidateMethodsWithSuitableParams
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
private static Collection<PsiMethod> getCandidateMethodsWithSuitableParams(final PsiClass aClass,
final Project project,
final GlobalSearchScope useScope,
final Set<VirtualFile> candidateFiles,
final GlobalSearchScope candidateScope) {
return ApplicationManager.getApplication().runReadAction(new Computable<Collection<PsiMethod>>() {
@Override
public Collection<PsiMethod> compute() {
if (!aClass.isValid()) return Collections.emptyList();
GlobalSearchScope visibleFromCandidates = combineResolveScopes(project, candidateFiles);
final Set<String> usedMethodNames = newHashSet();
FileBasedIndex.getInstance().processAllKeys(JavaFunctionalExpressionIndex.JAVA_FUNCTIONAL_EXPRESSION_INDEX_ID,
new CommonProcessors.CollectProcessor<String>(usedMethodNames), candidateScope, null);
final LinkedHashSet<PsiMethod> methods = newLinkedHashSet();
Processor<PsiMethod> methodProcessor = new Processor<PsiMethod>() {
@Override
public boolean process(PsiMethod method) {
if (usedMethodNames.contains(method.getName())) {
methods.add(method);
}
return true;
}
};
StubIndexKey<String, PsiMethod> key = JavaMethodParameterTypesIndex.getInstance().getKey();
StubIndex index = StubIndex.getInstance();
index.processElements(key, aClass.getName(), project, useScope.intersectWith(visibleFromCandidates), PsiMethod.class, methodProcessor);
index.processElements(key, JavaMethodElementType.TYPE_PARAMETER_PSEUDO_NAME, project, visibleFromCandidates, PsiMethod.class, methodProcessor);
LOG.info("#methods: " + methods.size());
return methods;
}
});
}
示例8: getNames
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
public String[] getNames(@NotNull final Project project, final boolean includeNonProjectItems) {
final Collection<String> names = new HashSet<String>();
for (final StubIndexKey<String, ?> indexKey : myIndexKeys) {
names.addAll(StubIndexHelper.getInstance(indexKey).getAllKeys(project, includeNonProjectItems));
}
return ArrayUtil.toStringArray(names);
}
示例9: getItemsByName
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
public NavigationItem[] getItemsByName(@NotNull final String name, @NotNull final String pattern, @NotNull final Project project, final boolean includeNonProjectItems) {
final GlobalSearchScope scope = StubIndexHelper.createScope(project, includeNonProjectItems);
final Collection<NavigationItem> items = new ArrayList<NavigationItem>();
for (final StubIndexKey<String, ? extends OCamlNamedElement> indexKey : myIndexKeys) {
items.addAll(StubIndex.getInstance().get(indexKey, name, project, scope));
}
return items.toArray(new NavigationItem[items.size()]);
}
示例10: getIndexDirectory
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
private static File getIndexDirectory(ID<?, ?> indexName, boolean forVersion) {
final String dirName = indexName.toString().toLowerCase(Locale.US);
// store StubIndices under StubUpdating index' root to ensure they are deleted
// when StubUpdatingIndex version is changed
final File indexDir = indexName instanceof StubIndexKey
? new File(getIndexRootDir(StubUpdatingIndex.INDEX_ID), forVersion ? STUB_VERSIONS : dirName)
: new File(PathManager.getIndexRoot(), dirName);
indexDir.mkdirs();
return indexDir;
}
示例11: getStubId
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
public static ID getStubId(ID<?, ?> indexName, FileType fileType) {
if (StubUpdatingIndex.INDEX_ID.equals(indexName)) {
String name = fileType.getName();
ID id = ID.findByName(name);
if (id != null) {
return id;
}
else {
return StubIndexKey.createIndexKey(name);
}
}
else {
return indexName;
}
}
示例12: isFoundAnyOneElement
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
private static boolean isFoundAnyOneElement(@NotNull Project project,
@NotNull final String indexKey,
@NotNull StubIndexKey<String, DotNetQualifiedElement> keyForIndex,
@NotNull GlobalSearchScope scope)
{
return !StubIndex.getInstance().processAllKeys(keyForIndex, s ->
{
ProgressManager.checkCanceled();
return !indexKey.equals(s);
}, scope, new GlobalSearchScopeFilter(scope));
}
示例13: processElements
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
@Override
public <Key, Psi extends PsiElement> boolean processElements(@Nonnull StubIndexKey<Key, Psi> indexKey,
@Nonnull Key key,
@Nonnull Project project,
GlobalSearchScope scope,
Class<Psi> requiredClass,
@Nonnull Processor<? super Psi> processor) {
return true;
}
示例14: doIndex
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
private static void doIndex(IndexSink sink, JSReferenceListStub stub, StubIndexKey<String, JSReferenceList> indexKey)
{
for(String s : stub.getReferenceTexts())
{
if(s != null)
{
sink.occurrence(indexKey, StringUtil.getShortName(s));
}
}
}
示例15: getKey
import com.intellij.psi.stubs.StubIndexKey; //导入依赖的package包/类
@NotNull
@Override
public StubIndexKey<String, PsiLet> getKey() {
return IndexKeys.LETS;
}