本文整理汇总了Java中com.intellij.util.indexing.FileBasedIndexImpl类的典型用法代码示例。如果您正苦于以下问题:Java FileBasedIndexImpl类的具体用法?Java FileBasedIndexImpl怎么用?Java FileBasedIndexImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileBasedIndexImpl类属于com.intellij.util.indexing包,在下文中一共展示了FileBasedIndexImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: manualReindex
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public static void manualReindex() {
ID<?, ?>[] indexIds = new ID<?, ?>[] {
// php
ModulePackageIndex.KEY,
// xml|di configuration
PluginIndex.KEY,
TypeConfigurationIndex.KEY,
VirtualTypeIndex.KEY,
// layouts
BlockClassNameIndex.KEY,
BlockNameIndex.KEY,
ContainerNameIndex.KEY,
// events
EventNameIndex.KEY,
EventObserverIndex.KEY,
// webapi
WebApiTypeIndex.KEY,
ModuleNameIndex.KEY
};
for (ID<?, ?> id: indexIds) {
FileBasedIndexImpl.getInstance().requestRebuild(id);
FileBasedIndexImpl.getInstance().scheduleRebuild(id, new Throwable());
}
}
示例2: assertIndex
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
for (String key : keys) {
final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();
FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
@Override
public boolean process(VirtualFile virtualFile) {
virtualFiles.add(virtualFile);
return true;
}
}, GlobalSearchScope.allScope(getProject()));
if(notCondition && virtualFiles.size() > 0) {
fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
} else if(!notCondition && virtualFiles.size() == 0) {
fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
}
}
}
示例3: manualReindex
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public static void manualReindex() {
ID<?,?>[] indexIds = new ID<?,?>[] {
// php
ModulePackageFileBasedIndex.NAME,
EventsDeclarationsFileBasedIndex.NAME,
// xml configuration
// di
PluginToTypeFileBasedIndex.NAME,
TypeConfigurationFileBasedIndex.NAME,
VirtualTypesNamesFileBasedIndex.NAME,
// layouts
BlockClassFileBasedIndex.NAME,
BlockFileBasedIndex.NAME,
ContainerFileBasedIndex.NAME,
// events
EventObserverFileBasedIndex.NAME,
// webapi
WebApiTypesFileBasedIndex.NAME
};
for(ID<?,?> id: indexIds) {
FileBasedIndexImpl.getInstance().requestRebuild(id);
FileBasedIndexImpl.getInstance().scheduleRebuild(id, new Throwable());
}
}
示例4: getImplementedBlocks
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
private void getImplementedBlocks(final Project project, VirtualFile virtualFile, final Set<VirtualFile> templatePathFiles, int depth) {
if(templatePathFiles.contains(virtualFile) || depth-- <= 0) {
return;
}
final String templateName = TemplateUtil.getTemplateName(project, virtualFile);
if(templateName == null) {
return;
}
final int finalDepth = depth;
FileBasedIndexImpl.getInstance().getFilesWithKey(SmartyExtendsStubIndex.KEY, new HashSet<>(Arrays.asList(templateName)), virtualFile1 -> {
templatePathFiles.add(virtualFile1);
getImplementedBlocks(project, virtualFile1, templatePathFiles, finalDepth);
return true;
}, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), SmartyFileType.INSTANCE));
}
示例5: attachExtends
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public void attachExtends(final SmartyFile smartyFile, final List<GotoRelatedItem> gotoRelatedItems) {
final String templateName = TemplateUtil.getTemplateName(smartyFile.getProject(), smartyFile.getVirtualFile());
if(templateName == null) {
return;
}
FileBasedIndexImpl.getInstance().getFilesWithKey(SmartyExtendsStubIndex.KEY, new HashSet<>(Arrays.asList(templateName)), virtualFile -> {
PsiFile psiFile = PsiManager.getInstance(smartyFile.getProject()).findFile(virtualFile);
if(psiFile != null) {
gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(psiFile, TemplateUtil.getTemplateName(psiFile.getProject(), psiFile.getVirtualFile())).withIcon(PhpIcons.IMPLEMENTED, PhpIcons.IMPLEMENTED));
}
return true;
}, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(smartyFile.getProject()), SmartyFileType.INSTANCE));
}
示例6: getIndexedBootstrapResources
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
@NotNull
public static Collection<ServiceResource> getIndexedBootstrapResources(@NotNull Project project, @NotNull BootstrapResource... bootstrapResources) {
Collection<ServiceResource> serviceResources = new ArrayList<>();
for (BootstrapResource bootstrapResource : bootstrapResources) {
for (Set<String> resources : FileBasedIndexImpl.getInstance().getValues(InitResourceServiceIndex.KEY, bootstrapResource.getText(), GlobalSearchScope.allScope(project))) {
if(resources == null) {
continue;
}
for (String s : resources) {
String[] split = s.split(String.valueOf(InitResourceServiceIndex.TRIM_KEY));
if(split.length < 4) {
continue;
}
ServiceResource e = new ServiceResource(split[0], split[1], split[2]);
e.setSignature(split[3]);
serviceResources.add(e);
}
}
}
return serviceResources;
}
示例7: getSnippetNamespaceTargets
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
/**
* Snippet target, only use ini files
*/
@NotNull
public static Set<PsiElement> getSnippetNamespaceTargets(@NotNull Project project, @NotNull String namespace) {
Set<VirtualFile> files = new HashSet<>();
FileBasedIndexImpl.getInstance().getFilesWithKey(SnippetIndex.KEY, new HashSet<>(Collections.singletonList(namespace)), virtualFile -> {
if("ini".equalsIgnoreCase(virtualFile.getExtension())) {
files.add(virtualFile);
}
return true;
}, GlobalSearchScope.allScope(project));
// we are not allows to resolve inside index process
PsiManager instance = PsiManager.getInstance(project);
return files.stream()
.map(instance::findFile)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
示例8: assertIndexContainsKeyWithValue
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
for (T t : values) {
if(tAssert.match(t)) {
return;
}
}
fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
示例9: doSynchronizeRoots
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
@Override
protected void doSynchronizeRoots() {
if (!myStartupActivityPerformed) return;
if (myDoLogCachesUpdate) LOG.info(new Throwable("sync roots"));
else LOG.info("project roots have changed");
DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
if (FileBasedIndex.getInstance() instanceof FileBasedIndexImpl) {
dumbService.queueTask(new UnindexedFilesUpdater(myProject, false));
}
}
示例10: getContentIdentsTargets
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public static Set<PsiElement> getContentIdentsTargets(final @NotNull Project project, final @NotNull VirtualFile currentFile, final @NotNull String ident) {
final Set<PsiElement> psiElements = new HashSet<PsiElement>();
FileBasedIndexImpl.getInstance().getFilesWithKey(OxidContentIdentIndexer.KEY, new HashSet<String>(Arrays.asList(ident)), new Processor<VirtualFile>() {
@Override
public boolean process(VirtualFile virtualFile) {
if (currentFile.equals(virtualFile)) {
return true;
}
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
if (psiFile == null) {
return true;
}
psiFile.acceptChildren(new PsiRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
if(SmartyPattern.getAttributeInsideTagPattern("ident", "oxcontent").accepts(element)) {
String content = element.getText();
if(StringUtils.isNotBlank(content) && content.equalsIgnoreCase(ident)) {
psiElements.add(element);
}
}
super.visitElement(element);
}
});
return true;
}
}, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), SmartyFileType.INSTANCE));
return psiElements;
}
示例11: doSynchronizeRoots
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
@Override
protected void doSynchronizeRoots() {
if (!myStartupActivityPerformed) return;
if (myDoLogCachesUpdate) {
LOG.debug(new Throwable("sync roots"));
}
else if (!ApplicationManager.getApplication().isUnitTestMode()) LOG.info("project roots have changed");
DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
if (FileBasedIndex.getInstance() instanceof FileBasedIndexImpl) {
dumbService.queueTask(new UnindexedFilesUpdater(myProject));
}
}
示例12: acceptsFile
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
@Override
public boolean acceptsFile(VirtualFile file) {
FileType fileType = file.getFileType();
return fileType == XmlFileType.INSTANCE && !FileBasedIndexImpl.isProjectOrWorkspaceFile(file, fileType);
}
示例13: attachIncludeTemplateGoto
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public void attachIncludeTemplateGoto(final PsiElement sourceElement, final PsiFile psiFile, final List<PsiElement> psiTargets) {
final String text = sourceElement.getText();
FileBasedIndexImpl.getInstance().getFilesWithKey(SmartyBlockStubIndex.KEY, new HashSet<>(Arrays.asList(text)), virtualFile -> {
if(psiFile.getVirtualFile().equals(virtualFile)) {
return true;
}
PsiFile psiFile1 = PsiManager.getInstance(sourceElement.getProject()).findFile(virtualFile);
if(psiFile1 != null) {
psiTargets.addAll(getBlockPsiElement(psiFile1, text));
}
return true;
}, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(psiFile.getProject()), SmartyFileType.INSTANCE));
}
示例14: attachInclude
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
public void attachInclude(final SmartyFile smartyFile, final List<GotoRelatedItem> gotoRelatedItems) {
final String templateName = TemplateUtil.getTemplateName(smartyFile.getProject(), smartyFile.getVirtualFile());
if(templateName == null) {
return;
}
FileBasedIndexImpl.getInstance().getFilesWithKey(SmartyIncludeStubIndex.KEY, new HashSet<>(Arrays.asList(templateName)), virtualFile -> {
PsiFile psiFile = PsiManager.getInstance(smartyFile.getProject()).findFile(virtualFile);
if(psiFile != null) {
for(PsiElement psiElement: getIncludePsiElement(psiFile, templateName)) {
gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(psiElement, "Navigate to include").withIcon(PhpIcons.IMPLEMENTED, PhpIcons.IMPLEMENTED));
}
}
return true;
}, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(smartyFile.getProject()), SmartyFileType.INSTANCE));
}
示例15: getFirstValue
import com.intellij.util.indexing.FileBasedIndexImpl; //导入依赖的package包/类
private ServiceInterface getFirstValue(@NotNull String key) {
return FileBasedIndexImpl.getInstance().getValues(ServicesDefinitionStubIndex.KEY, key, GlobalSearchScope.allScope(getProject())).get(0);
}