Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ScalaCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
java-version: 21
cache: sbt
- uses: sbt/setup-sbt@v1
- uses: coursier/cache-action@v6
Expand All @@ -29,11 +29,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
java-version: 21
cache: sbt
- uses: sbt/setup-sbt@v1
- uses: coursier/cache-action@v6
Expand All @@ -44,11 +44,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
java-version: 21
cache: sbt
- uses: sbt/setup-sbt@v1
- uses: coursier/cache-action@v6
Expand All @@ -59,11 +59,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
java-version: 21
cache: sbt
- uses: sbt/setup-sbt@v1
- uses: coursier/cache-action@v6
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ lazy val ktVersion = "2.1.0"
lazy val jbAnnotVersion = "26.0.2"

// https://youtrack.jetbrains.com/articles/IDEA-A-2100661679/IntelliJ-IDEA-2023.3-Latest-Builds
// NOTE: Latest-Builds 233
lazy val intellijVersion = "252.25557.131"
lazy val pluginVersion = s"0.8.2-$intellijVersion"
lazy val intellijVersion = "253.20558.43"
lazy val pluginVersion = s"0.9.0-RC1"

ThisBuild / version := pluginVersion

Expand Down Expand Up @@ -74,7 +73,8 @@ lazy val `sbt-dependency-analyzer` = (project in file("."))
xmx = 2048,
xms = 256,
defaultOptions = intellijVMOptions.value.defaultOptions ++ Seq(
"--add-exports=java.management/sun.management=ALL-UNNAMED"
"--add-exports=java.management/sun.management=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED"
)
),
Compile / unmanagedResourceDirectories += baseDirectory.value / "src" / "main" / "resources",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package bitlap.sbt.analyzer.jbexternal

import bitlap.sbt.analyzer.jbexternal.util.whenDisposed

import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerExtension
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerView
import com.intellij.openapi.externalSystem.model.ProjectSystemId
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.observable.util.whenDisposed

@Service(Service.Level.PROJECT)
class DependencyAnalyzerManager(private val project: Project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.intellij.openapi.observable.operation.core.getOperationInProgressProp
import com.intellij.openapi.observable.operation.core.isOperationInProgress
import com.intellij.openapi.observable.operation.core.withCompletedOperation
import com.intellij.openapi.observable.properties.AtomicProperty
import com.intellij.openapi.observable.properties.ObservableProperty
import com.intellij.openapi.observable.util.*
import com.intellij.openapi.progress.util.BackgroundTaskUtil
import com.intellij.openapi.project.Project
Expand All @@ -45,11 +46,10 @@ import com.intellij.ui.ScrollPaneFactory
import com.intellij.ui.SearchTextField
import com.intellij.ui.components.JBLoadingPanel
import com.intellij.util.concurrency.AppExecutorUtil
import com.intellij.util.ui.JBUI
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerDependency as Dependency

/**
* https://github.com/JetBrains/intellij-community/blob/idea/233.11799.300/platform/external-system-impl/src/com/intellij/openapi/externalSystem/dependency/analyzer/DependencyAnalyzerViewImpl.kt
* https://github.com/JetBrains/intellij-community/blob/idea/253.20558.43/platform/external-system-impl/src/com/intellij/openapi/externalSystem/dependency/analyzer/DependencyAnalyzerViewImpl.kt
*/
class DependencyAnalyzerViewImpl(
private val project: Project, private val systemId: ProjectSystemId, private val parentDisposable: Disposable
Expand Down Expand Up @@ -324,8 +324,9 @@ class DependencyAnalyzerViewImpl(
val externalProjectSelector = ExternalProjectSelector(
externalProjectProperty, externalProjects, iconsProvider
).bindEnabled(!dependencyLoadingProperty)
val dataFilterField = SearchTextField(SEARCH_HISTORY_PROPERTY).apply { setPreferredWidth(JBUI.scale(240)) }
.apply { textEditor.bind(dependencyDataFilterProperty) }.bindEnabled(!dependencyLoadingProperty)
val dataFilterField =
SearchTextField(SEARCH_HISTORY_PROPERTY).apply { textEditor.bind(dependencyDataFilterProperty) }
.bindEnabled(!dependencyLoadingProperty)
val scopeFilterSelector =
SearchScopeSelector(dependencyScopeFilterProperty).bindEnabled(!dependencyLoadingProperty)
val dependencyInspectionFilterButton = toggleAction(showDependencyWarningsProperty).apply {
Expand Down Expand Up @@ -367,11 +368,11 @@ class DependencyAnalyzerViewImpl(
.bindEnabled(!dependencyLoadingProperty)
val dependencyPanel = cardPanel<Boolean> {
ScrollPaneFactory.createScrollPane(if (it) dependencyTree else dependencyList, true)
}.bind(showDependencyTreeProperty)
}.bindSelected(showDependencyTreeProperty)
val dependencyLoadingPanel =
JBLoadingPanel(BorderLayout(), parentDisposable).apply { add(dependencyPanel, BorderLayout.CENTER) }
.apply { setLoadingText(ExternalSystemBundle.message("external.system.dependency.analyzer.dependency.loading")) }
.bind(dependencyLoadingProperty)
.bindLoading(dependencyLoadingProperty)
val showDependencyTreeButton = toggleAction(showDependencyTreeProperty).apply {
templatePresentation.text =
ExternalSystemBundle.message("external.system.dependency.analyzer.resolved.tree.show")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import com.intellij.icons.AllIcons
import com.intellij.ide.actions.SplitAction
import com.intellij.ide.plugins.UIComponentFileEditor
import com.intellij.ide.plugins.UIComponentVirtualFile
import com.intellij.ide.plugins.UIComponentVirtualFile.Content
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerView
import com.intellij.openapi.externalSystem.model.ProjectSystemId
import com.intellij.openapi.externalSystem.util.ExternalSystemBundle
import com.intellij.openapi.project.Project
import com.intellij.util.containers.DisposableWrapperList

/**
* https://github.com/JetBrains/intellij-community/blob/idea/233.11799.300/platform/external-system-impl/src/com/intellij/openapi/externalSystem/dependency/analyzer/DependencyAnalyzerVirtualFile.kt
* https://github.com/JetBrains/intellij-community/blob/idea/253.20558.43/platform/external-system-impl/src/com/intellij/openapi/externalSystem/dependency/analyzer/DependencyAnalyzerVirtualFile.kt
*/
internal class DependencyAnalyzerVirtualFile(private val project: Project, private val systemId: ProjectSystemId) :
UIComponentVirtualFile(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bitlap.sbt.analyzer.jbexternal

/**
* NOTE: Kotlin code can only be referenced and cannot refer to code in src/main/scala
* The code for this package is almost copied from https://github.com/JetBrains/intellij-community
* NOTE: Kotlin code can only be referenced and cannot refer to code in src/main/scala.
* The code in this package is almost entirely copied from https://github.com/JetBrains/intellij-community.
*/
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package bitlap.sbt.analyzer.jbexternal.util

import javax.swing.JList
import javax.swing.JTree
import javax.swing.ListModel
import javax.swing.tree.DefaultMutableTreeNode
import javax.swing.tree.TreeModel

import bitlap.sbt.analyzer.jbexternal.SbtDAArtifact

import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.DataSink
import com.intellij.openapi.actionSystem.UiDataProvider
Expand All @@ -28,6 +22,12 @@ import com.intellij.ui.components.JBList
import com.intellij.ui.treeStructure.SimpleTree
import com.intellij.util.ui.ListUiUtil
import com.intellij.util.ui.tree.TreeUtil
import org.jetbrains.annotations.Nls
import javax.swing.JList
import javax.swing.JTree
import javax.swing.ListModel
import javax.swing.tree.DefaultMutableTreeNode
import javax.swing.tree.TreeModel
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerDependency as Dependency


Expand All @@ -51,10 +51,8 @@ private fun SimpleColoredComponent.customizeCellRenderer(
}
val dataText = group.data.getDisplayText(showGroupId)
append(dataText, if (group.isOmitted) GRAYED_ATTRIBUTES else REGULAR_ATTRIBUTES)
val scopes = group.variances.map { it.scope.name }.toSet()
val scopesText = scopes.singleOrNull() ?: ExternalSystemBundle.message(
"external.system.dependency.analyzer.scope.n", scopes.size
)
val nScopesText = ExternalSystemBundle.message("external.system.dependency.analyzer.scope.n", group.scopes.size)
val scopesText = group.scopes.map { it.name }.singleOrNull() ?: nScopesText
append(" ($scopesText)", GRAYED_ATTRIBUTES)

if (showSize) {
Expand Down Expand Up @@ -84,6 +82,30 @@ private fun SimpleColoredComponent.customizeCellRenderer(
else -> return
}
}

toolTipText = buildList {
val dataText = when (group.data) {
is Dependency.Data.Module -> ExternalSystemBundle.message("external.system.dependency.analyzer.tooltip.module")
is Dependency.Data.Artifact -> ExternalSystemBundle.message("external.system.dependency.analyzer.tooltip.artifact")
}
add(htmlParagraph(dataText + "\n" + htmlList(listOf(group.data.getDisplayText(true)))))

val scopesText = ExternalSystemBundle.message("external.system.dependency.analyzer.tooltip.scopes")
add(htmlParagraph(scopesText + "\n" + htmlList(group.scopes.map { it.title }.toSet())))

if (group.status.isNotEmpty()) {
val statusText = ExternalSystemBundle.message("external.system.dependency.analyzer.tooltip.status")
add(htmlParagraph(statusText + "\n" + htmlList(group.status.map { it.title }.toSet())))
}
}.joinToString("\n")
}

private fun htmlList(elements: Iterable<@Nls String>): @NlsSafe String {
return "<ul>\n" + elements.joinToString("\n") { "<li>$it</li>" } + "\n</ul>"
}

private fun htmlParagraph(text: @Nls String): @NlsSafe String {
return "<p>\n$text\n</p>"
}

internal abstract class AbstractDependencyList(
Expand Down Expand Up @@ -227,6 +249,7 @@ internal class DependencyGroup(val variances: List<Dependency>) {
val data by lazy { dependency.data }
val scopes by lazy { variances.map { it.scope }.toSet() }
val parents by lazy { variances.map { it.parent }.toSet() }
val status by lazy { variances.flatMap { it.status } }
val warnings by lazy { variances.flatMap { it.warnings } }
val isOmitted by lazy { variances.all { it.isOmitted } }
val hasWarnings by lazy { variances.any { it.hasWarnings } }
Expand All @@ -243,4 +266,4 @@ internal class DependencyGroup(val variances: List<Dependency>) {
internal val Dependency.hasWarnings: Boolean
get() = warnings.isNotEmpty()
}
}
}
Loading