mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -11,13 +11,14 @@ import com.intellij.openapi.roots.libraries.LibraryUtil
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.LocalFileProvider
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.util.PathUtil
|
||||
import com.intellij.util.PlatformUtils
|
||||
|
||||
fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project, includeFilePath: Boolean, moduleOnTheLeft: Boolean): String {
|
||||
fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project, isIncludeFilePath: Boolean, moduleOnTheLeft: Boolean): String {
|
||||
var result = url
|
||||
|
||||
if (includeFilePath) {
|
||||
val projectHomeUrl = project.baseDir?.presentableUrl
|
||||
if (isIncludeFilePath) {
|
||||
val projectHomeUrl = PathUtil.toSystemDependentName(project.basePath)
|
||||
result = when {
|
||||
projectHomeUrl != null && result.startsWith(projectHomeUrl) -> "...${result.substring(projectHomeUrl.length)}"
|
||||
else -> FileUtil.getLocationRelativeToUserHome(file.presentableUrl)
|
||||
@@ -35,8 +36,10 @@ fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project
|
||||
}
|
||||
}
|
||||
|
||||
if (PlatformUtils.isCidr() || PlatformUtils.isRider()) // see PredefinedSearchScopeProviderImpl.getPredefinedScopes for the other place to fix.
|
||||
// see PredefinedSearchScopeProviderImpl.getPredefinedScopes for the other place to fix.
|
||||
if (PlatformUtils.isCidr() || PlatformUtils.isRider()) {
|
||||
return result
|
||||
}
|
||||
|
||||
val module = ModuleUtilCore.findModuleForFile(file, project)
|
||||
return when {
|
||||
@@ -53,5 +56,5 @@ val Project.isExternalStorageEnabled: Boolean
|
||||
}
|
||||
|
||||
val manager = ServiceManager.getService(this, ExternalStorageConfigurationManager::class.java) ?: return false
|
||||
return manager.isEnabled() || (ApplicationManager.getApplication()?.isUnitTestMode ?: false)
|
||||
return manager.isEnabled || (ApplicationManager.getApplication()?.isUnitTestMode ?: false)
|
||||
}
|
||||
Reference in New Issue
Block a user