OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, the Dart project authors. | 2 * Copyright (c) 2014, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.tools.core.internal.builder; | 14 package com.google.dart.tools.core.internal.builder; |
15 | 15 |
16 import com.google.dart.tools.core.DartCore; | 16 import com.google.dart.tools.core.DartCore; |
17 import com.google.dart.tools.core.internal.model.DartIgnoreManager; | 17 import com.google.dart.tools.core.internal.model.DartIgnoreManager; |
18 | 18 |
| 19 import org.eclipse.core.resources.IResource; |
| 20 |
19 /** | 21 /** |
20 * A delta listener that filters out sources specified by {@link DartIgnoreManag
er} and broadcasts | 22 * A delta listener that filters out sources specified by {@link DartIgnoreManag
er} and broadcasts |
21 * any remaining changes to its own listeners. For performance, this filter cach
es information about | 23 * any remaining changes to its own listeners. For performance, this filter cach
es information about |
22 * what is ignored and as such should be used once and discarded. | 24 * what is ignored and as such should be used once and discarded. |
23 */ | 25 */ |
24 public class IgnoreResourceFilter extends DeltaBroadcaster implements DeltaListe
ner { | 26 public class IgnoreResourceFilter extends DeltaBroadcaster implements DeltaListe
ner { |
25 | 27 |
26 //TODO (danrubel): Optimizations: | 28 //TODO (danrubel): Optimizations: |
27 // Don't traverse containers that are ignored | 29 // Don't traverse containers that are ignored |
28 // Optimize case where nothing in container is ignored | 30 // Optimize case where nothing in container is ignored |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 listener.visitContext(event); | 123 listener.visitContext(event); |
122 } | 124 } |
123 | 125 |
124 /** | 126 /** |
125 * Determine if the specified event should be forwarded to listeners. | 127 * Determine if the specified event should be forwarded to listeners. |
126 * | 128 * |
127 * @param event the event, not {@code null} | 129 * @param event the event, not {@code null} |
128 * @return {@code true} if the event should be forwarded | 130 * @return {@code true} if the event should be forwarded |
129 */ | 131 */ |
130 private boolean shouldForward(ResourceDeltaEvent event) { | 132 private boolean shouldForward(ResourceDeltaEvent event) { |
131 return !hasIgnores || ignoreManager.isAnalyzed(event.getResource().getLocati
on()); | 133 if (hasIgnores) { |
| 134 IResource res = event.getResource(); |
| 135 if (res == null || ignoreManager.isIgnored(res.getLocation())) { |
| 136 return false; |
| 137 } |
| 138 } |
| 139 return true; |
132 } | 140 } |
133 } | 141 } |
OLD | NEW |