class PackageServiceLoaderImpl implements PackageServiceLoader {

    public Set<String> find(final Path path) {
        final Set<String> result = new HashSet<>();
        try {

            final WorkspaceProject workspaceProject = projectService.resolveProject(path);

            final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME,
                                                                                getValueIndexTerms(workspaceProject));

            for (RefactoringPageRow row : rows) {
                result.add(row.getValue().toString());
            }
        } catch (Exception e) {
            return result;
        }

        return result;
    }

}