Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 139857
Collapse All | Expand All

(-)src/org/eclipse/ui/views/markers/internal/MarkerFilter.java (-56 / +27 lines)
Lines 27-32 Link Here
27
import org.eclipse.core.resources.IResource;
27
import org.eclipse.core.resources.IResource;
28
import org.eclipse.core.resources.ResourcesPlugin;
28
import org.eclipse.core.resources.ResourcesPlugin;
29
import org.eclipse.core.resources.mapping.ResourceMapping;
29
import org.eclipse.core.resources.mapping.ResourceMapping;
30
import org.eclipse.core.resources.mapping.ResourceTraversal;
30
import org.eclipse.core.runtime.CoreException;
31
import org.eclipse.core.runtime.CoreException;
31
import org.eclipse.core.runtime.IAdaptable;
32
import org.eclipse.core.runtime.IAdaptable;
32
import org.eclipse.core.runtime.IProgressMonitor;
33
import org.eclipse.core.runtime.IProgressMonitor;
Lines 36-44 Link Here
36
import org.eclipse.ui.PlatformUI;
37
import org.eclipse.ui.PlatformUI;
37
38
38
/**
39
/**
39
 * MarkerFilter is the class that defines a filter on markers in a
40
 * MarkerFilter is the class that defines a filter on markers in a MarkerView.
40
 * MarkerView.
41
 * 
41
 *
42
 */
42
 */
43
public class MarkerFilter implements Cloneable {
43
public class MarkerFilter implements Cloneable {
44
44
Lines 233-300 Link Here
233
			}
233
			}
234
		}
234
		}
235
235
236
		// Iterate through all the selected resources
236
		iter = typesToSearch.iterator();
237
		for (int resourceIdx = 0; resourceIdx < resources.length; resourceIdx++) {
238
			iter = typesToSearch.iterator();
239
237
240
			IResource resource = resources[resourceIdx];
238
		ResourceTraversal traversal = new ResourceTraversal(resources, depth, 0);
241
239
242
			// Skip resources that don't exist
240
		// Iterate through all the marker types
243
			if (!resource.isAccessible()) {
241
		while (iter.hasNext()) {
244
				continue;
242
			MarkerType markerType = (MarkerType) iter.next();
245
			}
243
244
			// Only search for subtypes of the marker if we found all of its
245
			// subtypes in the filter criteria.
246
			IMarker[] markers = traversal.findMarkers(markerType.getId(),
247
					includeAllSubtypes.contains(markerType));
246
248
247
			if (depth == IResource.DEPTH_INFINITE) {
249
			mon.worked(1);
248
				// Determine if any parent of this resource is also in our
250
249
				// filter
251
			for (int idx = 0; idx < markers.length; idx++) {
250
				IResource parent = resource.getParent();
252
				ConcreteMarker marker;
251
				boolean found = false;
253
				try {
252
				while (parent != null) {
254
					marker = MarkerList.createMarker(markers[idx]);
253
					if (resourcesToSearch.contains(parent)) {
255
				} catch (CoreException e) {
254
						found = true;
256
					if (ignoreExceptions) {
257
						continue;
255
					}
258
					}
259
					throw e;
256
260
257
					parent = parent.getParent();
258
				}
261
				}
259
262
260
				// If a parent of this resource is also in the filter, we can
263
				if (limit != -1 && resultList.size() >= limit) {
261
				// skip it
264
					return resultList;
262
				// because we'll pick up its markers when we search the parent.
263
				if (found) {
264
					continue;
265
				}
265
				}
266
			}
267
268
			// Iterate through all the marker types
269
			while (iter.hasNext()) {
270
				MarkerType markerType = (MarkerType) iter.next();
271
272
				// Only search for subtypes of the marker if we found all of its
273
				// subtypes in the filter criteria.
274
				IMarker[] markers = resource.findMarkers(markerType.getId(),
275
						includeAllSubtypes.contains(markerType), depth);
276
277
				mon.worked(1);
278
279
				for (int idx = 0; idx < markers.length; idx++) {
280
					ConcreteMarker marker;
281
					try {
282
						marker = MarkerList.createMarker(markers[idx]);
283
					} catch (CoreException e) {
284
						if (ignoreExceptions) {
285
							continue;
286
						}
287
						throw e;
288
289
					}
290
266
291
					if (limit != -1 && resultList.size() >= limit) {
267
				if (selectMarker(marker)) {
292
						return resultList;
268
					resultList.add(marker);
293
					}
294
295
					if (selectMarker(marker)) {
296
						resultList.add(marker);
297
					}
298
				}
269
				}
299
			}
270
			}
300
		}
271
		}

Return to bug 139857