diff --git a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml index 55f48d5c372d..2b0d6129d33b 100644 --- a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml @@ -282,6 +282,7 @@ + diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/AdditionalLibraryRootsProvider.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/AdditionalLibraryRootsProvider.java new file mode 100644 index 000000000000..7155ba1b2af7 --- /dev/null +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/AdditionalLibraryRootsProvider.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.roots; + +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.Collections; + +public abstract class AdditionalLibraryRootsProvider { + public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.additionalLibraryRootsProvider"); + + @NotNull + public Collection getAdditionalProjectLibrarySourceRoots(@NotNull Project project) { + return Collections.emptyList(); + } +} diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java index 8b0441dee432..c85cd2836479 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java @@ -154,6 +154,10 @@ public class RootIndex { } } + for (AdditionalLibraryRootsProvider provider : Extensions.getExtensions(AdditionalLibraryRootsProvider.EP_NAME)) { + Collection roots = provider.getAdditionalProjectLibrarySourceRoots(project); + info.libraryOrSdkSources.addAll(roots); + } for (DirectoryIndexExcludePolicy policy : Extensions.getExtensions(DirectoryIndexExcludePolicy.EP_NAME, project)) { Collections.addAll(info.excludedFromProject, policy.getExcludeRootsForProject()); }