|
4 | 4 | import java.io.IOException; |
5 | 5 | import java.net.URL; |
6 | 6 | import java.util.Collection; |
| 7 | +import java.util.HashSet; |
7 | 8 | import java.util.Iterator; |
8 | 9 | import java.util.Set; |
9 | 10 | import java.util.logging.Level; |
|
18 | 19 | import org.netbeans.modules.masterfs.providers.AnnotationProvider; |
19 | 20 | import org.netbeans.modules.masterfs.providers.InterceptionListener; |
20 | 21 | import org.netbeans.modules.parsing.impl.indexing.errors.Utilities; |
| 22 | +import org.netbeans.modules.parsing.impl.indexing.implspi.FileAnnotationsRefresh; |
21 | 23 | import org.netbeans.modules.parsing.spi.indexing.ErrorsCache; |
22 | 24 | import org.openide.filesystems.FileObject; |
| 25 | +import org.openide.filesystems.FileStateInvalidException; |
| 26 | +import org.openide.filesystems.FileStatusEvent; |
| 27 | +import org.openide.filesystems.URLMapper; |
23 | 28 | import org.openide.util.Exceptions; |
24 | 29 | import org.openide.util.ImageUtilities; |
25 | 30 | import static org.openide.util.ImageUtilities.assignToolTipToImage; |
|
28 | 33 | import org.openide.util.Lookup; |
29 | 34 | import static org.openide.util.NbBundle.getMessage; |
30 | 35 | import org.openide.util.lookup.ServiceProvider; |
| 36 | +import org.openide.util.lookup.ServiceProviders; |
31 | 37 |
|
32 | 38 | /** |
33 | 39 | * |
34 | 40 | * @author albilu |
35 | 41 | */ |
36 | 42 | //FIXME-BUG: Notice weird slowness on large directories (but not on debug mode) => contribution-welcome |
37 | | -@ServiceProvider(service = org.netbeans.modules.masterfs.providers.AnnotationProvider.class, |
38 | | - supersedes = "org.netbeans.modules.parsing.ui.indexing.errors$AnnotationProvider", position = 100) |
39 | | -public class PythonErrorAnnotator extends AnnotationProvider { |
| 43 | +@ServiceProviders({ |
| 44 | + @ServiceProvider(service = org.netbeans.modules.parsing.impl.indexing.implspi.FileAnnotationsRefresh.class, position = 100), |
| 45 | + @ServiceProvider(service = org.netbeans.modules.masterfs.providers.AnnotationProvider.class, |
| 46 | + supersedes = "org.netbeans.modules.parsing.ui.indexing.errors$AnnotationProvider", position = 100) |
| 47 | +}) |
| 48 | +public class PythonErrorAnnotator extends AnnotationProvider implements FileAnnotationsRefresh { |
40 | 49 |
|
41 | 50 | private static final Logger LOG = Logger.getLogger(PythonErrorAnnotator.class.getName()); |
42 | 51 |
|
@@ -171,4 +180,21 @@ private synchronized boolean isInError(FileObject file, boolean recursive, boole |
171 | 180 |
|
172 | 181 | return result; |
173 | 182 | } |
| 183 | + |
| 184 | + @Override |
| 185 | + public void refresh(Set<URL> set) { |
| 186 | + try { |
| 187 | + |
| 188 | + Set<FileObject> toRefresh = new HashSet<>(); |
| 189 | + |
| 190 | + set.forEach((t) -> { |
| 191 | + toRefresh.add(URLMapper.findFileObject(t)); |
| 192 | + }); |
| 193 | + |
| 194 | + fireFileStatusChanged(new FileStatusEvent(toRefresh.iterator().next() |
| 195 | + .getFileSystem(), toRefresh, true, false)); |
| 196 | + } catch (FileStateInvalidException ex) { |
| 197 | + Exceptions.printStackTrace(ex); |
| 198 | + } |
| 199 | + } |
174 | 200 | } |
0 commit comments