mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
shared-indexes: reduce nesting in the code (minor)
GitOrigin-RevId: 03d9bf18f3d276672914ed79746330d7290d999a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7186d41f33
commit
66118cc40e
+14
-14
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.util.indexing.diagnostic.dump.paths.providers
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -11,21 +12,20 @@ import com.intellij.util.indexing.diagnostic.dump.paths.PortableFilePath
|
||||
object JdkPortableFilePathProvider : PortableFilePathProvider {
|
||||
override fun getRelativePortableFilePath(project: Project, virtualFile: VirtualFile): PortableFilePath.RelativePath? {
|
||||
val orderEntry = LibraryUtil.findLibraryEntry(virtualFile, project)
|
||||
if (orderEntry is JdkOrderEntry) {
|
||||
val jdkName = orderEntry.jdkName
|
||||
if (jdkName != null) {
|
||||
for (rootType in listOf(OrderRootType.CLASSES, OrderRootType.SOURCES)) {
|
||||
val inClassFiles = rootType == OrderRootType.CLASSES
|
||||
val jdkRoots = orderEntry.getRootFiles(rootType)
|
||||
for ((rootIndex, rootFile) in jdkRoots.withIndex()) {
|
||||
val relativePath = VfsUtilCore.getRelativePath(virtualFile, rootFile)
|
||||
if (relativePath != null) {
|
||||
return PortableFilePath.RelativePath(PortableFilePath.JdkRoot(jdkName, rootIndex, inClassFiles), relativePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (orderEntry !is JdkOrderEntry) return null
|
||||
val jdkName = orderEntry.jdkName
|
||||
if (jdkName == null) return null
|
||||
|
||||
for (rootType in listOf(OrderRootType.CLASSES, OrderRootType.SOURCES)) {
|
||||
val inClassFiles = rootType == OrderRootType.CLASSES
|
||||
val jdkRoots = orderEntry.getRootFiles(rootType)
|
||||
for ((rootIndex, rootFile) in jdkRoots.withIndex()) {
|
||||
val relativePath = VfsUtilCore.getRelativePath(virtualFile, rootFile)
|
||||
if (relativePath == null) continue
|
||||
return PortableFilePath.RelativePath(PortableFilePath.JdkRoot(jdkName, rootIndex, inClassFiles), relativePath)
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user