private void collectMatches(Object object) throws CoreException {
if (object instanceof LineElement) {
LineElement lineElement = (LineElement) object;
FileMatch[] matches = lineElement.getMatches(fResult);
for (int i = 0; i < matches.length; i++) {
FileMatch fileMatch = matches[i];
if (!isSkipped(fileMatch)) {
getBucket(fileMatch.getFile()).add(fileMatch);
}
}
} else if (object instanceof IContainer) {
IContainer container = (IContainer) object;
IResource[] members = container.members();
for (int i = 0; i < members.length; i++) {
collectMatches(members[i]);
}
} else if (object instanceof IFile) {
Match[] matches = fResult.getMatches(object);
if (matches.length > 0) {
Collection bucket = null;
for (int i = 0; i < matches.length; i++) {
FileMatch fileMatch = (FileMatch) matches[i];
if (!isSkipped(fileMatch)) {
if (bucket == null) {
bucket = getBucket((IFile) object);
}
bucket.add(fileMatch);