GlobalSearchScope (OrderEntry selectedEntry) { if (selectedEntry instanceof ModuleSourceOrderEntry) { return GlobalSearchScope.moduleScope(selectedEntry.getOwnerModule()); } if (selectedEntry instanceof ModuleOrderEntry) { Module module = ((ModuleOrderEntry)selectedEntry).getModule(); return module != null ? GlobalSearchScope.moduleScope(module) : null; } if (selectedEntry instanceof LibraryOrderEntry) { Library library = ((LibraryOrderEntry)selectedEntry).getLibrary(); return library != null ? new LibraryScope(myPanel.getProject(), library) : null; } return null; }