|
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
| 16 | +package com.perl5.lang.perl.idea.configuration.settings.sdk |
16 | 17 |
|
17 | | -package com.perl5.lang.perl.idea.configuration.settings.sdk; |
| 18 | +import com.intellij.openapi.application.ReadAction |
| 19 | +import com.intellij.openapi.project.Project |
| 20 | +import com.intellij.openapi.roots.AdditionalLibraryRootsProvider |
| 21 | +import com.intellij.openapi.roots.SyntheticLibrary |
| 22 | +import com.intellij.openapi.vfs.VirtualFile |
| 23 | +import com.perl5.lang.perl.idea.project.PerlProjectManager |
| 24 | +import com.perl5.lang.perl.util.PerlRunUtil |
18 | 25 |
|
19 | | -import com.intellij.openapi.project.Project; |
20 | | -import com.intellij.openapi.roots.AdditionalLibraryRootsProvider; |
21 | | -import com.intellij.openapi.roots.SyntheticLibrary; |
22 | | -import com.intellij.openapi.vfs.VirtualFile; |
23 | | -import com.perl5.lang.perl.idea.project.PerlProjectManager; |
24 | | -import com.perl5.lang.perl.util.PerlRunUtil; |
25 | | -import org.jetbrains.annotations.NotNull; |
| 26 | +class PerlLibraryProvider : AdditionalLibraryRootsProvider() { |
| 27 | + override fun getAdditionalProjectLibraries(project: Project): MutableCollection<SyntheticLibrary?> = |
| 28 | + PerlProjectManager.getInstance(project).projectLibraries |
26 | 29 |
|
27 | | -import java.util.ArrayList; |
28 | | -import java.util.Collection; |
29 | | - |
30 | | -public class PerlLibraryProvider extends AdditionalLibraryRootsProvider { |
31 | | - |
32 | | - @Override |
33 | | - public @NotNull Collection<SyntheticLibrary> getAdditionalProjectLibraries(@NotNull Project project) { |
34 | | - return PerlProjectManager.getInstance(project).getProjectLibraries(); |
35 | | - } |
36 | | - |
37 | | - @Override |
38 | | - public @NotNull Collection<VirtualFile> getRootsToWatch(@NotNull Project project) { |
39 | | - ArrayList<VirtualFile> libraryAndBinaryRoots = new ArrayList<>(PerlProjectManager.getInstance(project).getAllLibraryRoots()); |
40 | | - PerlRunUtil.getBinDirectories(project).forEach(libraryAndBinaryRoots::add); |
41 | | - return libraryAndBinaryRoots; |
42 | | - } |
| 30 | + override fun getRootsToWatch(project: Project): List<VirtualFile> = |
| 31 | + PerlProjectManager.getInstance(project).allLibraryRoots + ReadAction.compute<List<VirtualFile>, Throwable> { PerlRunUtil.getBinDirectories(project).toList() } |
43 | 32 | } |
0 commit comments