@Override public boolean accept(PsiFile psiFile) { if (myFile == null || !myFile.equals(psiFile) || !myFile.isValid()) { return false; } return (myTodoFilter != null && myTodoFilter.accept(mySearchHelper, psiFile)) || (myTodoFilter == null && mySearchHelper.getTodoItemsCount(psiFile) > 0); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ResolveModuleParams params = (ResolveModuleParams) o; if (myAbsolute != params.myAbsolute) return false; if (myLevel != params.myLevel) return false; if (!myName.equals(params.myName)) return false; if (!myFile.equals(params.myFile)) return false; return true; }
public void processIncludingFiles( PsiFile context, Processor<Pair<VirtualFile, FileIncludeInfo>> processor) { context = context.getOriginalFile(); VirtualFile contextFile = context.getVirtualFile(); if (contextFile == null) return; MultiMap<VirtualFile, FileIncludeInfoImpl> infoList = FileIncludeIndex.getIncludingFileCandidates( context.getName(), GlobalSearchScope.allScope(myProject)); for (VirtualFile candidate : infoList.keySet()) { PsiFile psiFile = myPsiManager.findFile(candidate); if (psiFile == null || context.equals(psiFile)) continue; for (FileIncludeInfo info : infoList.get(candidate)) { PsiFileSystemItem item = resolveFileInclude(info, psiFile); if (item != null && contextFile.equals(item.getVirtualFile())) { if (!processor.process(Pair.create(candidate, info))) { return; } } } } }
public static boolean checkFileExist( @Nullable PsiDirectory targetDirectory, int[] choice, PsiFile file, String name, String title) { if (targetDirectory == null) return false; final PsiFile existing = targetDirectory.findFile(name); if (existing != null && !existing.equals(file)) { int selection; if (choice == null || choice[0] == -1) { String message = String.format( "File '%s' already exists in directory '%s'", name, targetDirectory.getVirtualFile().getPath()); String[] options = choice == null ? new String[] {"Overwrite", "Skip"} : new String[] {"Overwrite", "Skip", "Overwrite for all", "Skip for all"}; selection = Messages.showDialog(message, title, options, 0, Messages.getQuestionIcon()); } else { selection = choice[0]; } if (choice != null && selection > 1) { choice[0] = selection % 2; selection = choice[0]; } if (selection == 0 && file != existing) { existing.delete(); } else { return true; } } return false; }