@Nullable public static Sdk mostSpecificSdk(@NotNull PsiElement psiElement) { Project project = psiElement.getProject(); Sdk elixirSdk; /* ModuleUtilCore.findModuleForPsiElement can fail with NullPointerException if the ProjectFileIndex.SERVICE.getInstance(Project) returns {@code null}, so check that the ProjectFileIndex is available first */ if (ProjectFileIndex.SERVICE.getInstance(project) != null) { Module module = ModuleUtilCore.findModuleForPsiElement(psiElement); if (module != null) { elixirSdk = mostSpecificSdk(module); } else { elixirSdk = mostSpecificSdk(project); } } else { elixirSdk = mostSpecificSdk(project); } return elixirSdk; }
private static boolean isInSource(@NotNull final PsiFile psiFile, final PluginConfigurationManager pluginConfig) { return pluginConfig.getCurrent().getScanScope() == ScanScope.Everything || ProjectFileIndex.SERVICE.getInstance(psiFile.getProject()).isInSourceContent(psiFile.getVirtualFile()); }
@Override public void apply( @NotNull final PsiFile file, final AnnotationResult annotationResult, @NotNull final AnnotationHolder holder ) { if ( null == file.getVirtualFile() || null == ProjectFileIndex.SERVICE.getInstance(file.getProject()).getContentRootForFile(file.getVirtualFile()) || ( // Fixes #106: Annotations in PHPStorm shown twice per File "html".equalsIgnoreCase(file.getFileType().getName()) && "php".equalsIgnoreCase(file.getVirtualFile().getExtension())) ) { return; } createAnnotations(file,annotationResult,holder); }
boolean hasPackage = StringUtil.isNotEmpty(targetPackage); ProjectRootManager rootManager = ProjectRootManager.getInstance(project); ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(project);
@CheckForNull public Module findModuleForFile(VirtualFile file, Project project) { ApplicationManager.getApplication().assertReadAccessAllowed(); return ProjectFileIndex.SERVICE.getInstance(project).getModuleForFile(file, false); }
final ProjectFileIndex projectFileIndex = ProjectFileIndex.SERVICE.getInstance(project); if (projectFileIndex != null) { if (!projectFileIndex.isInSourceContent(selectedFile)) {