Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2002-04-01 12:01:02 -0500
committerDarin Wright2002-04-01 12:01:02 -0500
commitb91da8e8637db4ff43e9bcaafeafaf7b854e4557 (patch)
tree25ed890ed924768afdfa183d4aca95c17aa6a949 /org.eclipse.debug.core
parent2b4823f64d6f2fc16056f7cf3e33c57e38a115a8 (diff)
downloadeclipse.platform.debug-b91da8e8637db4ff43e9bcaafeafaf7b854e4557.tar.gz
eclipse.platform.debug-b91da8e8637db4ff43e9bcaafeafaf7b854e4557.tar.xz
eclipse.platform.debug-b91da8e8637db4ff43e9bcaafeafaf7b854e4557.zip
bug 12548
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java16
2 files changed, 18 insertions, 44 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 68a00b0ae..0e24e2a25 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -244,30 +244,16 @@ public class DebugPlugin extends Plugin {
*/
private DebugEvent[] filterEvents(DebugEvent[] events) {
if (hasEventFilters()) {
- ArrayList filteredEvents = null;
- boolean isFilteredEvent = false;
- for (int i = 0; i < events.length; i++) {
- if (isFiltered(events[i])) {
- isFilteredEvent = true;
- } else if (isFilteredEvent) {
- if (filteredEvents == null) {
- filteredEvents = new ArrayList(events.length - 1);
- }
- filteredEvents.add(events[i]);
- }
- }
- if (isFilteredEvent) {
- if (filteredEvents == null) {
- return null;
- } else {
- return (DebugEvent[]) filteredEvents.toArray(new DebugEvent[filteredEvents.size()]);
+ Object[] filters = fEventFilters.getListeners();
+ for (int i = 0; i < filters.length; i++) {
+ events = ((IDebugEventFilter)filters[i]).filterDebugEvents(events);
+ if (events == null || events.length == 0) {
+ break;
}
- } else {
- return events;
}
- } else {
- return events;
+
}
+ return events;
}
/**
@@ -497,24 +483,6 @@ public class DebugPlugin extends Plugin {
}
/**
- * Returns whether the given event is filtered.
- *
- * @param event debug event
- * @return whether the given event is filtered
- */
- private boolean isFiltered(DebugEvent event) {
- if (fEventFilters != null) {
- Object[] filters = fEventFilters.getListeners();
- for (int i = 0; i < filters.length; i++) {
- if (((IDebugEventFilter)filters[i]).filterDebugEvent(event)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
* Logs the given message if in debug mode.
*
* @param String message to log
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
index 0fe4b1032..6cce4004a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
@@ -18,15 +18,21 @@ package org.eclipse.debug.core;
* (repeatedly) as the API evolves.
* </p>
* @see DebugPlugin
+ * @since 2.0
*/
public interface IDebugEventFilter {
/**
- * Returns whether the given debug event is filtered.
- * When <code>true</code> is returned, the event is not
- * sent to registered debug event listeners.
+ * Filters the given set of debug events, and returns the set of debug
+ * events that should be fired to registered listeners - <code>null</code>
+ * or an empty collection if no debug events should be fired.
+ * <p>
+ * When multiple event filters are registered, events are passed through
+ * all filters. That is, the events returned from the first filter are
+ * passed through the second filter, and so on.
+ * </p>
*
- * @return whether the given debug event is filtered
+ * @return the set of debug events to fire
*/
- public boolean filterDebugEvent(DebugEvent event);
+ public DebugEvent[] filterDebugEvents(DebugEvent[] events);
}

Back to the top