本文整理汇总了Java中com.intellij.psi.stubs.StubIndex.processElements方法的典型用法代码示例。如果您正苦于以下问题:Java StubIndex.processElements方法的具体用法?Java StubIndex.processElements怎么用?Java StubIndex.processElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.stubs.StubIndex
的用法示例。
在下文中一共展示了StubIndex.processElements方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAllRobotKeywordDefsInRobotFilesStartingWith
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的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);
}
示例2: findMatchingKeywordDefsByName
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static List<RobotKeywordTitle> findMatchingKeywordDefsByName(String name, Project project, boolean isSearchTextFromRobotFile) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final String normalizedName = normalizeRobotDefinedKeywordForIndex(name);
List<PsiElement> results = Lists.newArrayList();
RobotKeywordDefProcessor processor = new RobotKeywordDefProcessor(results, SearchType.FIND_ALL_EXACT_MATCHES, name);
STUB_INDEX.processElements(RobotKeywordTitleNormalizedNameIndex.KEY, normalizedName, project,
GlobalSearchScope.allScope(project), RobotKeywordTitle.class, processor);
if (isSearchTextFromRobotFile) {
Optional<RobotKeywordTitle> embeddedKeywordTitle = findFirstMatchInEmbeddedArgsIndex(name, project);
if (embeddedKeywordTitle.isPresent()) {
results.add(embeddedKeywordTitle.get());
}
}
List<RobotKeywordTitle> keywordTitleResults = Lists.newArrayList();
for (PsiElement result: results) {
if (result instanceof RobotKeywordTitle) {
keywordTitleResults.add((RobotKeywordTitle)result);
}
}
return keywordTitleResults;
}
示例3: findTestCasesByName
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static List<RobotTestCase> findTestCasesByName(String name, Project project) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final String normalizedName = normalizeKeywordForIndex(name);
List<RobotTestCase> results = Lists.newArrayList();
RobotTestCaseProcessor processor = new RobotTestCaseProcessor(results, SearchType.FIND_ALL, name);
STUB_INDEX.processElements(RobotTestCaseNormalizedNameIndex.KEY, normalizedName, project,
GlobalSearchScope.allScope(project), RobotTestCase.class, processor);
return results;
}
示例4: findKeywordDefsByName
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static void findKeywordDefsByName(String name, Project project, List<PsiElement> results) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final String normalizedName = normalizeRobotDefinedKeywordForIndex(name);
RobotKeywordDefProcessor processor = new RobotKeywordDefProcessor(results, SearchType.FIRST_EXACT_MATCH, name);
STUB_INDEX.processElements(RobotKeywordTitleNormalizedNameIndex.KEY, normalizedName, project,
GlobalSearchScope.allScope(project), RobotKeywordTitle.class, processor);
}
示例5: findUniqueKeywordDefByName
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static Optional<RobotKeywordTitle> findUniqueKeywordDefByName(String name, Project project, boolean isSearchTextFromRobotFile) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final String normalizedName = normalizeRobotDefinedKeywordForIndex(name);
List<PsiElement> results = Lists.newArrayList();
RobotKeywordDefProcessor processor = new RobotKeywordDefProcessor(results, SearchType.FIRST_EXACT_MATCH, name);
STUB_INDEX.processElements(RobotKeywordTitleNormalizedNameIndex.KEY, normalizedName, project,
GlobalSearchScope.allScope(project), RobotKeywordTitle.class, processor);
if (results.size() > 0) {
return Optional.of((RobotKeywordTitle) results.get(0));
}
if (!isSearchTextFromRobotFile) {
return Optional.absent();
}
return findFirstMatchInEmbeddedArgsIndex(name, project);
}
示例6: findKeywordUsagesByNormalizedName
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
private static List<RobotKeyword> findKeywordUsagesByNormalizedName(String normalizedKeywordName, Project project, boolean findAll) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
GlobalSearchScope robotFileScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), RobotFileType.INSTANCE);
RobotKeywordProcessor processor = new RobotKeywordProcessor(normalizedKeywordName, findAll);
STUB_INDEX.processElements(RobotKeywordNormalizedNameIndex.KEY, normalizedKeywordName, project, robotFileScope,
RobotKeyword.class, processor);
return processor.getResults();
}
示例7: findKeywordUsagesInKeywordArgs
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static List<RobotKeywordArg> findKeywordUsagesInKeywordArgs(String normalizedKeywordName, Project project, boolean findAll) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
GlobalSearchScope robotFileScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), RobotFileType.INSTANCE);
// Find usages of Robot Keywords in Robot Keyword Args
RobotKeywordArgProcessor keywordArgProcessor = new RobotKeywordArgProcessor(normalizedKeywordName, findAll);
STUB_INDEX.processElements(RobotKeywordArgNormalizedNameIndex.KEY, normalizedKeywordName, project, robotFileScope,
RobotKeywordArg.class, keywordArgProcessor);
return keywordArgProcessor.getResults();
}
示例8: findKeywordUsagesOfKeywordWithEmbeddedArgs
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static List<RobotKeyword> findKeywordUsagesOfKeywordWithEmbeddedArgs(RobotKeywordTitle robotKeywordTitle) {
final StubIndex STUB_INDEX = StubIndex.getInstance();
final Project project = robotKeywordTitle.getProject();
final Pattern REGEX = Pattern.compile(robotKeywordTitle.getRegex());
final Collection<String> allKeywords = STUB_INDEX.getAllKeys(RobotKeywordNormalizedNameIndex.KEY, project);
final GlobalSearchScope PROJECT_ROBOT_FILES = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), RobotFileType.INSTANCE);
final RobotKeywordEmbeddedArgsProcessor processor = new RobotKeywordEmbeddedArgsProcessor(REGEX, true);
for (String keyword: allKeywords) {
STUB_INDEX.processElements(RobotKeywordNormalizedNameIndex.KEY,
keyword, project, PROJECT_ROBOT_FILES, RobotKeyword.class, processor);
}
return processor.getResults();
}
示例9: findAllJavaKeywordsStartingWithUsingWordIndex
import com.intellij.psi.stubs.StubIndex; //导入方法依赖的package包/类
public static void findAllJavaKeywordsStartingWithUsingWordIndex(Project project, List<PsiElement> results, String startsWith, boolean wrapPsiMethods) {
// First process the stub index that has all Java files in the current project
final StubIndex STUB_INDEX = StubIndex.getInstance();
GlobalSearchScope javaFiles = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), JavaFileType.INSTANCE);
RobotKeywordPsiAnnotationProcessor processor = new RobotKeywordPsiAnnotationProcessor(results, SearchType.STARTS_WITH, Optional.of(startsWith), wrapPsiMethods);
STUB_INDEX.processElements(JavaStubIndexKeys.ANNOTATIONS, ROBOT_KEYWORD_ANNOTATION_SHORT, project, javaFiles, PsiAnnotation.class, processor);
// Next, attempt to find Keywords from external sources using the Word Index on the word "RobotKeyword".
PsiSearchHelper PSI_SEARCH_HELPER = PsiSearchHelper.SERVICE.getInstance(project);
GlobalSearchScope outsideProjectScope = GlobalSearchScope.allScope(project).intersectWith(GlobalSearchScope.notScope(GlobalSearchScope.projectScope(project)));
GlobalSearchScope javaOutsideProjectScope = GlobalSearchScope.getScopeRestrictedByFileTypes(outsideProjectScope, JavaFileType.INSTANCE);
TextOccurenceProcessor textOccurenceProcessor = new RobotAnnotationTextOccurrenceProcessor(results, SearchType.FIND_ALL, Optional.of(startsWith), wrapPsiMethods);
PSI_SEARCH_HELPER.processElementsWithWord(textOccurenceProcessor, javaOutsideProjectScope, ROBOT_KEYWORD_ANNOTATION_SHORT, UsageSearchContext.IN_CODE, true);
}