use of com.intellij.util.indexing.FileBasedIndex in project intellij-community by JetBrains.
the class FrameworkDetectionManager method getValidDetectedFrameworks.
private List<? extends DetectedFrameworkDescription> getValidDetectedFrameworks() {
final Set<Integer> detectors = myDetectedFrameworksData.getDetectorsForDetectedFrameworks();
List<DetectedFrameworkDescription> descriptions = new ArrayList<>();
final FileBasedIndex index = FileBasedIndex.getInstance();
final DetectionExcludesConfiguration excludesConfiguration = DetectionExcludesConfiguration.getInstance(myProject);
for (Integer id : detectors) {
final Collection<? extends DetectedFrameworkDescription> frameworks = runDetector(id, index, excludesConfiguration, false);
for (DetectedFrameworkDescription framework : frameworks) {
descriptions.add(framework);
}
}
return FrameworkDetectionUtil.removeDisabled(descriptions);
}
use of com.intellij.util.indexing.FileBasedIndex in project intellij-community by JetBrains.
the class PythonMockSdk method create.
public static Sdk create(final String version, @NotNull final VirtualFile... additionalRoots) {
final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/";
String sdkHome = new File(mock_path, "bin/python" + version).getPath();
SdkType sdkType = PythonSdkType.getInstance();
final Sdk sdk = new ProjectJdkImpl(MOCK_SDK_NAME + " " + version, sdkType) {
@Override
public String getVersionString() {
return "Python " + version + " Mock SDK";
}
};
final SdkModificator sdkModificator = sdk.getSdkModificator();
sdkModificator.setHomePath(sdkHome);
File libPath = new File(mock_path, "Lib");
if (libPath.exists()) {
sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(libPath), OrderRootType.CLASSES);
}
sdkModificator.addRoot(PyUserSkeletonsUtil.getUserSkeletonsDirectory(), OrderRootType.CLASSES);
final LanguageLevel level = LanguageLevel.fromPythonVersion(version);
final VirtualFile typeShedDir = PyTypeShed.INSTANCE.getDirectory();
PyTypeShed.INSTANCE.findRootsForLanguageLevel(level).forEach(path -> {
final VirtualFile file = typeShedDir.findFileByRelativePath(path);
if (file != null) {
sdkModificator.addRoot(file, OrderRootType.CLASSES);
}
});
String mock_stubs_path = mock_path + PythonSdkType.SKELETON_DIR_NAME;
sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByPath(mock_stubs_path), PythonSdkType.BUILTIN_ROOT_TYPE);
for (final VirtualFile root : additionalRoots) {
sdkModificator.addRoot(root, OrderRootType.CLASSES);
}
sdkModificator.commitChanges();
final FileBasedIndex index = FileBasedIndex.getInstance();
index.requestRebuild(StubUpdatingIndex.INDEX_ID);
index.requestRebuild(PyModuleNameIndex.NAME);
return sdk;
}
use of com.intellij.util.indexing.FileBasedIndex in project oxy-template-support-plugin by mutant-industries.
the class OxyTemplateIndexUtil method getJsMacroNameReferences.
@NotNull
public static List<JSElement> getJsMacroNameReferences(@NotNull String macroName, @NotNull VirtualFile file, @NotNull final Project project) {
final GlobalSearchScope allScope = ProjectScope.getProjectScope(project);
FileBasedIndex index = FileBasedIndex.getInstance();
MacroCollector<JSElement, JsMacroNameIndexedElement> processor = new JsMacroCollector(project);
index.processValues(JsMacroNameIndex.INDEX_ID, macroName, file, processor, allScope);
// size <= 1
return processor.getResult();
}
use of com.intellij.util.indexing.FileBasedIndex in project intellij-swagger by zalando.
the class OpenApiIndexService method isMainOpenApiFile.
public boolean isMainOpenApiFile(final VirtualFile virtualFile, final Project project) {
final FileBasedIndex index = FileBasedIndex.getInstance();
final Collection<VirtualFile> openApiFiles = index.getContainingFiles(OpenApiFileIndex.OPEN_API_INDEX_ID, OpenApiFileIndex.MAIN_OPEN_API_FILE, GlobalSearchScope.allScope(project));
return openApiFiles.contains(virtualFile);
}
use of com.intellij.util.indexing.FileBasedIndex in project intellij-swagger by zalando.
the class SwaggerIndexService method isMainSwaggerFile.
public boolean isMainSwaggerFile(final VirtualFile virtualFile, final Project project) {
final FileBasedIndex index = FileBasedIndex.getInstance();
final Collection<VirtualFile> swaggerFiles = index.getContainingFiles(SwaggerFileIndex.SWAGGER_INDEX_ID, SwaggerFileIndex.MAIN_SWAGGER_FILE, GlobalSearchScope.allScope(project));
return swaggerFiles.contains(virtualFile);
}
Aggregations