diff --git a/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java b/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java index c28c2e1a31d3..22b5c0d942b8 100644 --- a/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java +++ b/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java @@ -32,13 +32,13 @@ import java.util.Set; * @author Dmitry Avdeev */ public class ExternalResourcesRootsProvider extends IndexableSetContributor { - private final NotNullLazyValue> myStandardResources = new NotNullLazyValue>() { + private final NotNullLazyValue> myStandardResources = new NotNullLazyValue>() { @NotNull @Override - protected Set compute() { + protected Set compute() { ExternalResourceManagerExImpl manager = (ExternalResourceManagerExImpl)ExternalResourceManager.getInstance(); Set dirs = new THashSet<>(); - Set set = new THashSet<>(); + Set set = new THashSet<>(); for (Map map : manager.getStandardResources()) { for (ExternalResourceManagerExImpl.Resource resource : map.values()) { ExternalResourceManagerExImpl.Resource dir = new ExternalResourceManagerExImpl.Resource( @@ -47,7 +47,7 @@ public class ExternalResourcesRootsProvider extends IndexableSetContributor { if (dirs.add(dir)) { String url = resource.getResourceUrl(); if (url != null) { - set.add(url.substring(0, url.lastIndexOf('/') + 1)); + ContainerUtil.addIfNotNull(set, VfsUtilCore.findRelativeFile(url.substring(0, url.lastIndexOf('/') + 1), null)); } } } @@ -59,13 +59,7 @@ public class ExternalResourcesRootsProvider extends IndexableSetContributor { @NotNull @Override public Set getAdditionalRootsToIndex() { - Set roots = new THashSet<>(); - for (String url : myStandardResources.getValue()) { - VirtualFile file = VfsUtilCore.findRelativeFile(url, null); - if (file != null) { - roots.add(file); - } - } + Set roots = new THashSet<>(myStandardResources.getValue()); String path = FetchExtResourceAction.getExternalResourcesPath(); VirtualFile extResources = LocalFileSystem.getInstance().findFileByPath(path);