[PKGS] Remove Package-Search plugin and Dependencies Tool Window
GitOrigin-RevId: a72a2809935778892e35dfcb6fee6c5516834d26
18
.idea/libraries/package_search_version_utils.xml
generated
@@ -1,18 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="package-search-version-utils" type="repository">
|
||||
<properties include-transitive-deps="false" maven-id="org.jetbrains.packagesearch:pkgs-version-utils:1.0.1">
|
||||
<verification>
|
||||
<artifact url="file://$MAVEN_REPOSITORY$/org/jetbrains/packagesearch/pkgs-version-utils/1.0.1/pkgs-version-utils-1.0.1.jar">
|
||||
<sha256sum>08e4b76769ca0ab8bbc3f33498eb09df352e467e7cd55606ebc627a387d1c3b8</sha256sum>
|
||||
</artifact>
|
||||
</verification>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/packagesearch/pkgs-version-utils/1.0.1/pkgs-version-utils-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/packagesearch/pkgs-version-utils/1.0.1/pkgs-version-utils-1.0.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
6
.idea/modules.xml
generated
@@ -597,11 +597,6 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/built-in-server/client/node-rpc-client/intellij.nodeRpcClient.iml" filepath="$PROJECT_DIR$/platform/built-in-server/client/node-rpc-client/intellij.nodeRpcClient.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" filepath="$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" filepath="$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/package-search/intellij.packageSearch.iml" filepath="$PROJECT_DIR$/plugins/package-search/intellij.packageSearch.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/package-search/gradle/intellij.packageSearch.gradle.iml" filepath="$PROJECT_DIR$/plugins/package-search/gradle/intellij.packageSearch.gradle.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/package-search/gradle/tooling/intellij.packageSearch.gradle.tooling.iml" filepath="$PROJECT_DIR$/plugins/package-search/gradle/tooling/intellij.packageSearch.gradle.tooling.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/package-search/kotlin/intellij.packageSearch.kotlin.iml" filepath="$PROJECT_DIR$/plugins/package-search/kotlin/intellij.packageSearch.kotlin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/package-search/maven/intellij.packageSearch.maven.iml" filepath="$PROJECT_DIR$/plugins/package-search/maven/intellij.packageSearch.maven.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" />
|
||||
@@ -645,7 +640,6 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-api/intellij.platform.debugger.iml" filepath="$PROJECT_DIR$/platform/xdebugger-api/intellij.platform.debugger.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-impl/intellij.platform.debugger.impl.iml" filepath="$PROJECT_DIR$/platform/xdebugger-impl/intellij.platform.debugger.impl.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml" filepath="$PROJECT_DIR$/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/dependencies-toolwindow/intellij.platform.dependenciesToolwindow.iml" filepath="$PROJECT_DIR$/platform/dependencies-toolwindow/intellij.platform.dependenciesToolwindow.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/build-scripts/dev-server/intellij.platform.devBuildServer.iml" filepath="$PROJECT_DIR$/platform/build-scripts/dev-server/intellij.platform.devBuildServer.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/diagnostic/intellij.platform.diagnostic.iml" filepath="$PROJECT_DIR$/platform/diagnostic/intellij.platform.diagnostic.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/diagnostic/startUpPerformanceReporter/intellij.platform.diagnostic.startUpPerformanceReporter.iml" filepath="$PROJECT_DIR$/platform/diagnostic/startUpPerformanceReporter/intellij.platform.diagnostic.startUpPerformanceReporter.iml" />
|
||||
|
||||
@@ -2014,61 +2014,6 @@
|
||||
"parent": "cNn",
|
||||
"type": 0
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
"id": "cq0",
|
||||
"n": "com.jetbrains.packagesearch.intellij-plugin"
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
"id": "q0",
|
||||
"name": "intellij.packageSearch",
|
||||
"n": "i.packageSearch",
|
||||
"package": "com.jetbrains.packagesearch",
|
||||
"sourceModule": "intellij.packageSearch",
|
||||
"descriptor": "community/plugins/package-search/resources/META-INF/plugin.xml",
|
||||
"pluginId": "com.jetbrains.packagesearch.intellij-plugin",
|
||||
"parent": "cq0",
|
||||
"type": 2
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
"id": "7q",
|
||||
"name": "intellij.packageSearch/gradle",
|
||||
"n": "i.packageSearch/gradle",
|
||||
"package": "com.jetbrains.packagesearch.intellij.plugin.gradle",
|
||||
"sourceModule": "intellij.packageSearch",
|
||||
"descriptor": "community/plugins/package-search/resources/intellij.packageSearch.gradle.xml",
|
||||
"parent": "cq0",
|
||||
"type": 0
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
"id": "En",
|
||||
"name": "intellij.packageSearch/kotlin",
|
||||
"n": "i.packageSearch/kotlin",
|
||||
"package": "com.jetbrains.packagesearch.intellij.plugin.kotlin",
|
||||
"sourceModule": "intellij.packageSearch",
|
||||
"descriptor": "community/plugins/package-search/resources/intellij.packageSearch.kotlin.xml",
|
||||
"parent": "cq0",
|
||||
"type": 0
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
"id": "a0",
|
||||
"name": "intellij.packageSearch/maven",
|
||||
"n": "i.packageSearch/maven",
|
||||
"package": "com.jetbrains.packagesearch.intellij.plugin.maven",
|
||||
"sourceModule": "intellij.packageSearch",
|
||||
"descriptor": "community/plugins/package-search/resources/intellij.packageSearch.maven.xml",
|
||||
"parent": "cq0",
|
||||
"type": 0
|
||||
}
|
||||
}, {
|
||||
"group": "nodes",
|
||||
"data": {
|
||||
|
||||
@@ -147,11 +147,6 @@
|
||||
<orderEntry type="module" module-name="intellij.textmate" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.webp" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.space.java.jps" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch.gradle" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch.gradle.tooling" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch.kotlin" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch.maven" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.emojipicker" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.gradle.dependencyUpdater" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.settingsSync" scope="RUNTIME" />
|
||||
|
||||
@@ -961,8 +961,6 @@ object CommunityLibraryLicenses {
|
||||
.mit("https://github.com/KingSora/OverlayScrollbars/blob/master/LICENSE"),
|
||||
LibraryLicense(name = "Package Search API Models", libraryName = "package-search-api-models",
|
||||
url = "https://github.com/JetBrains/package-search-api-models").apache(),
|
||||
LibraryLicense(name = "Package Search Version Utils", libraryName = "package-search-version-utils",
|
||||
url = "https://github.com/JetBrains/package-search-version-utils").apache(),
|
||||
androidDependency(name = "Perfetto Library", libraryName = "trace-perfetto-library"),
|
||||
androidDependency(name = "Perfetto protos", libraryName = "perfetto-proto"),
|
||||
|
||||
|
||||
@@ -140,12 +140,6 @@ object CommunityRepositoryModules {
|
||||
spec.withProjectLibrary("Gradle", LibraryPackMode.STANDALONE_SEPARATE)
|
||||
spec.withProjectLibrary("Ant", "ant", LibraryPackMode.STANDALONE_SEPARATE)
|
||||
},
|
||||
pluginAuto(listOf(
|
||||
"intellij.packageSearch",
|
||||
"intellij.packageSearch.gradle",
|
||||
)) { spec ->
|
||||
spec.withModule("intellij.packageSearch.gradle.tooling", "pkgs-tooling-extension.jar")
|
||||
},
|
||||
pluginAuto(listOf("intellij.gradle.java", "intellij.gradle.jps")) {
|
||||
it.excludeProjectLibrary("Ant")
|
||||
it.excludeProjectLibrary("Gradle")
|
||||
|
||||
@@ -66,7 +66,6 @@ private val PLATFORM_IMPLEMENTATION_MODULES = java.util.List.of(
|
||||
"intellij.platform.structureView.impl",
|
||||
"intellij.platform.tasks.impl",
|
||||
"intellij.platform.testRunner",
|
||||
"intellij.platform.dependenciesToolwindow",
|
||||
"intellij.platform.rd.community",
|
||||
"intellij.remoteDev.util",
|
||||
"intellij.platform.feedback",
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,8 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg height="13" viewBox="0 0 13 13" width="13" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path d="m0-1h14v14h-14z"/>
|
||||
<path d="m6.5.375 6.125 3.40277778-6.125 3.40277778-6.125-3.40277778zm4.9 5.44444444 1.225.68055556-6.125 3.40277778-6.125-3.40277778 1.225-.68055556 4.9 2.72222223zm0 2.72222223 1.225.68055555-6.125 3.40277778-6.125-3.40277778 1.225-.68055555 4.9 2.72222223z"
|
||||
fill="#6e6e6e"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 603 B |
@@ -1,5 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg height="13" viewBox="0 0 13 13" width="13" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m6.5.375 6.125 3.40277778-6.125 3.40277778-6.125-3.40277778zm4.9 5.44444444 1.225.68055556-6.125 3.40277778-6.125-3.40277778 1.225-.68055556 4.9 2.72222223zm0 2.72222223 1.225.68055555-6.125 3.40277778-6.125-3.40277778 1.225-.68055555 4.9 2.72222223z"
|
||||
fill="#afb1b3" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 530 B |
@@ -1,70 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.ide.ui.LafManager
|
||||
import com.intellij.ide.ui.LafManagerListener
|
||||
import com.intellij.openapi.extensions.ExtensionPointListener
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.extensions.PluginDescriptor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.util.messages.Topic
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.channels.ProducerScope
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.channels.trySendBlocking
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
val <T : Any> ExtensionPointName<T>.extensionsFlow: Flow<List<T>>
|
||||
get() {
|
||||
return callbackFlow {
|
||||
val listener = object : ExtensionPointListener<T> {
|
||||
override fun extensionAdded(extension: T, pluginDescriptor: PluginDescriptor) {
|
||||
trySendBlocking(extensionList)
|
||||
}
|
||||
|
||||
override fun extensionRemoved(extension: T, pluginDescriptor: PluginDescriptor) {
|
||||
trySendBlocking(extensionList)
|
||||
}
|
||||
}
|
||||
send(extensionList)
|
||||
addExtensionPointListener(listener)
|
||||
awaitClose { removeExtensionPointListener(listener) }
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Project.onDispose(action: () -> Unit) = Disposer.register(this, action)
|
||||
|
||||
internal fun <L : Any, K> Project.messageBusFlow(
|
||||
topic: Topic<L>,
|
||||
initialValue: (suspend () -> K)? = null,
|
||||
listener: suspend ProducerScope<K>.() -> L
|
||||
): Flow<K> {
|
||||
return callbackFlow {
|
||||
initialValue?.let { send(it()) }
|
||||
val connection = messageBus.simpleConnect()
|
||||
connection.subscribe(topic, listener())
|
||||
awaitClose { connection.disconnect() }
|
||||
}
|
||||
}
|
||||
|
||||
internal val Project.lookAndFeelFlow: Flow<LafManager>
|
||||
get() = messageBusFlow(LafManagerListener.TOPIC, { LafManager.getInstance()!! }) {
|
||||
LafManagerListener { trySend(it) }
|
||||
}
|
||||
|
||||
internal fun DependenciesToolWindowTabProvider.isAvailableFlow(project: Project): Flow<Boolean> {
|
||||
return callbackFlow {
|
||||
val sub = addIsAvailableChangesListener(project) { trySend(it) }
|
||||
awaitClose { sub.unsubscribe() }
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnusedReceiverParameter")
|
||||
internal fun Dispatchers.toolWindowManager(project: Project): CoroutineDispatcher = object : CoroutineDispatcher() {
|
||||
override fun dispatch(context: CoroutineContext, block: java.lang.Runnable) = ToolWindowManager.getInstance(project).invokeLater(block)
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.content.Content
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.merge
|
||||
import kotlinx.coroutines.flow.transformLatest
|
||||
|
||||
interface DependenciesToolWindowTabProvider {
|
||||
|
||||
interface Id
|
||||
|
||||
companion object {
|
||||
private val extensionPointName = ExtensionPointName<DependenciesToolWindowTabProvider>("com.intellij.dependenciesToolWindow.tabProvider")
|
||||
|
||||
internal suspend fun awaitFirstAvailable(project: Project) = availableTabsFlow(project)
|
||||
.first { it.isNotEmpty() }
|
||||
.first()
|
||||
|
||||
internal fun availableTabsFlow(project: Project): Flow<List<DependenciesToolWindowTabProvider>> {
|
||||
return extensionPointName.extensionsFlow.transformLatest { extensions ->
|
||||
emit(extensions.filter { it.isAvailable(project) })
|
||||
extensions
|
||||
.map { extension -> extension.isAvailableFlow(project) }
|
||||
.merge()
|
||||
.collect {
|
||||
emit(extensions.filter { it.isAvailable(project) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun extensions(project: Project): List<DependenciesToolWindowTabProvider> {
|
||||
return extensionPointName.extensionList.filter { it.isAvailable(project) }
|
||||
}
|
||||
|
||||
fun hasAnyExtensions(): Boolean = extensionPointName.hasAnyExtensions()
|
||||
}
|
||||
|
||||
val id: Id
|
||||
|
||||
fun provideTab(project: Project): Content
|
||||
|
||||
fun isAvailable(project: Project): Boolean
|
||||
|
||||
fun addIsAvailableChangesListener(project: Project, callback: (Boolean) -> Unit): Subscription
|
||||
|
||||
fun interface Subscription {
|
||||
/**
|
||||
* Stops the listeners that generated this subscription.
|
||||
*/
|
||||
fun unsubscribe()
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:Suppress("ReplaceGetOrSet")
|
||||
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.concurrency.ContextAwareRunnable
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.extensions.ExtensionNotApplicableException
|
||||
import com.intellij.openapi.progress.blockingContext
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
import com.intellij.openapi.wm.RegisterToolWindowTask
|
||||
import com.intellij.openapi.wm.ToolWindow
|
||||
import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.openapi.wm.ex.ToolWindowEx
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerListener
|
||||
import icons.PlatformDependencyToolwindowIcons
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
internal class DependencyToolWindowFactory : ProjectActivity {
|
||||
init {
|
||||
val app = ApplicationManager.getApplication()
|
||||
if (app.isUnitTestMode || app.isHeadlessEnvironment) {
|
||||
throw ExtensionNotApplicableException.create()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun execute(project: Project) {
|
||||
ToolWindowManager.awaitToolWindows(project)
|
||||
DependenciesToolWindowTabProvider.awaitFirstAvailable(project)
|
||||
|
||||
project.service<DependencyToolWindowInitializer>()
|
||||
.createToolwindow()
|
||||
}
|
||||
|
||||
private suspend fun ToolWindowManager.Companion.awaitToolWindows(project: Project) = suspendCancellableCoroutine {
|
||||
getInstance(project).invokeLater(ContextAwareRunnable { it.resume(Unit) })
|
||||
}
|
||||
}
|
||||
|
||||
object DependencyToolWindowOpener {
|
||||
fun activateToolWindow(project: Project, id: DependenciesToolWindowTabProvider.Id, action: () -> Unit) {
|
||||
val toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.BUILD_DEPENDENCIES) ?: return
|
||||
toolWindow.activate(action, true, true)
|
||||
DependenciesToolWindowTabProvider.extensions(project)
|
||||
.filter { it.isAvailable(project) }
|
||||
.associateBy { it.id }
|
||||
.get(id)
|
||||
?.provideTab(project)
|
||||
?.let { toolWindow.contentManager.setSelectedContent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
internal class DependencyToolWindowInitializer(
|
||||
private val project: Project,
|
||||
private val coroutineScope: CoroutineScope
|
||||
) {
|
||||
internal suspend fun createToolwindow() {
|
||||
withContext(Dispatchers.EDT) {
|
||||
blockingContext {
|
||||
val toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(
|
||||
RegisterToolWindowTask(
|
||||
id = ToolWindowId.BUILD_DEPENDENCIES,
|
||||
stripeTitle = IdeBundle.messagePointer("toolwindow.stripe.Dependencies"),
|
||||
icon = PlatformDependencyToolwindowIcons.ArtifactSmall,
|
||||
shouldBeAvailable = DependenciesToolWindowTabProvider.hasAnyExtensions()
|
||||
)
|
||||
)
|
||||
initialize(toolWindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initialize(toolWindow: ToolWindow) {
|
||||
toolWindow.contentManager.removeAllContents(true)
|
||||
|
||||
toolWindow.contentManager.addSelectionChangedListener { event ->
|
||||
val actionToolWindow = event.content.component as? HasToolWindowActions
|
||||
if (toolWindow is ToolWindowEx) {
|
||||
toolWindow.setAdditionalGearActions(null)
|
||||
actionToolWindow?.also { toolWindow.setAdditionalGearActions(it.gearActions) }
|
||||
}
|
||||
toolWindow.setTitleActions(emptyList())
|
||||
actionToolWindow?.titleActions
|
||||
?.also { toolWindow.setTitleActions(it.toList()) }
|
||||
}
|
||||
|
||||
val tabsFlow = DependenciesToolWindowTabProvider.availableTabsFlow(project)
|
||||
.shareIn(coroutineScope, SharingStarted.Eagerly, 1)
|
||||
|
||||
tabsFlow.onEach { toolWindow.isAvailable = it.isNotEmpty() }
|
||||
.flowOn(Dispatchers.EDT)
|
||||
.launchIn(coroutineScope)
|
||||
|
||||
coroutineScope.launch {
|
||||
toolWindow.awaitIsVisible()
|
||||
|
||||
tabsFlow
|
||||
.map { it.map { provider -> provider.provideTab(project) } }
|
||||
.onEach { change ->
|
||||
val removedContent = toolWindow.contentManager.contents.filter { it !in change }.toSet()
|
||||
val newContent = change.filter { it !in toolWindow.contentManager.contents }
|
||||
val contentOrder = toolWindow.contentManager
|
||||
.contents
|
||||
.toList()
|
||||
.minus(removedContent)
|
||||
.plus(newContent)
|
||||
.sortedBy { it.toolwindowTitle }
|
||||
.mapIndexed { index, content -> content to index }
|
||||
.toMap()
|
||||
|
||||
for (it in removedContent) {
|
||||
toolWindow.contentManager.removeContent(it, true)
|
||||
}
|
||||
|
||||
for (content in newContent) {
|
||||
contentOrder[content]?.let { order -> toolWindow.contentManager.addContent(content, order) }
|
||||
?: toolWindow.contentManager.addContent(content)
|
||||
}
|
||||
}
|
||||
.flowOn(Dispatchers.EDT)
|
||||
.launchIn(coroutineScope)
|
||||
|
||||
project.lookAndFeelFlow
|
||||
.onEach {
|
||||
toolWindow.contentManager.component.invalidate()
|
||||
toolWindow.contentManager.component.repaint()
|
||||
}
|
||||
.flowOn(Dispatchers.EDT)
|
||||
.launchIn(coroutineScope)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun ToolWindow.awaitIsVisible() {
|
||||
isVisibleFlow.filter { it }.first()
|
||||
}
|
||||
|
||||
private val ToolWindow.isVisibleFlow
|
||||
get() = project.messageBusFlow(ToolWindowManagerListener.TOPIC, { isVisible }) {
|
||||
object : ToolWindowManagerListener {
|
||||
override fun toolWindowShown(toolWindow: ToolWindow) {
|
||||
if (toolWindow == this@messageBusFlow || toolWindow.id == id) {
|
||||
trySend(isVisible)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.openapi.client.ClientProjectSession
|
||||
import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.ui.viewModel.extraction.ToolWindowExtractorMode
|
||||
import com.intellij.ui.viewModel.extraction.ToolWindowViewModelExtractor
|
||||
|
||||
class DependencyToolWindowViewModelExtractor : ToolWindowViewModelExtractor {
|
||||
override fun isApplicable(toolWindowId: String, session: ClientProjectSession): Boolean {
|
||||
return toolWindowId == ToolWindowId.BUILD_DEPENDENCIES && !session.isOwner
|
||||
}
|
||||
|
||||
override fun getMode() = ToolWindowExtractorMode.UNSUPPORTED
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
|
||||
interface HasToolWindowActions {
|
||||
val gearActions: ActionGroup?
|
||||
val titleActions: List<AnAction>
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dependencytoolwindow
|
||||
|
||||
import com.intellij.ui.content.ContentManager
|
||||
import com.intellij.ui.content.ContentManagerEvent
|
||||
import com.intellij.ui.content.ContentManagerListener
|
||||
|
||||
@Suppress("FunctionName")
|
||||
internal fun SelectionChangedListener(action: (ContentManagerEvent) -> Unit): ContentManagerListener {
|
||||
return object : ContentManagerListener {
|
||||
override fun selectionChanged(event: ContentManagerEvent) {
|
||||
action(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ContentManager.addSelectionChangedListener(action: (ContentManagerEvent) -> Unit): ContentManagerListener {
|
||||
return SelectionChangedListener(action).also { addContentManagerListener(it) }
|
||||
}
|
||||
|
||||
internal const val BUNDLE_NAME = "messages.dependenciesToolwindow"
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package icons;
|
||||
|
||||
import com.intellij.ui.IconManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public final class PlatformDependencyToolwindowIcons {
|
||||
private static @NotNull Icon load(@NotNull String path, int cacheKey, int flags) {
|
||||
return IconManager.getInstance().loadRasterizedIcon(path, PlatformDependencyToolwindowIcons.class.getClassLoader(), cacheKey, flags);
|
||||
}
|
||||
/** 13x13 */ public static final @NotNull Icon ArtifactSmall = load("icons/artifactSmall.svg", -501340654, 2);
|
||||
}
|
||||
@@ -59,7 +59,6 @@
|
||||
<orderEntry type="library" scope="RUNTIME" name="slf4j-jdk14" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.configurationStore.impl" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.platform.credentialStore.ui" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.platform.dependenciesToolwindow" scope="RUNTIME" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
<orderEntry type="library" name="netty-codec-http" level="project" />
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
<idea-plugin>
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="com.intellij.dependenciesToolWindow.tabProvider"
|
||||
interface="com.intellij.dependencytoolwindow.DependenciesToolWindowTabProvider"
|
||||
dynamic="true"/>
|
||||
</extensionPoints>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<applicationService serviceInterface="com.intellij.openapi.project.impl.ProjectStoreFactory"
|
||||
serviceImplementation="com.intellij.configurationStore.PlatformLangProjectStoreFactory"
|
||||
@@ -1050,10 +1045,6 @@
|
||||
<toolWindow id="Project" anchor="left" icon="AllIcons.Toolwindows.ToolWindowProject"
|
||||
factoryClass="com.intellij.ide.projectView.impl.ProjectViewToolWindowFactory"/>
|
||||
|
||||
<postStartupActivity implementation="com.intellij.dependencytoolwindow.DependencyToolWindowFactory"/>
|
||||
|
||||
<toolWindowExtractor implementation="com.intellij.dependencytoolwindow.DependencyToolWindowViewModelExtractor"/>
|
||||
|
||||
<toolWindow id="Structure" anchor="left" icon="AllIcons.Toolwindows.ToolWindowStructure" secondary="true"
|
||||
factoryClass="com.intellij.ide.structureView.impl.StructureViewToolWindowFactory"/>
|
||||
<toolWindow id="Bookmarks" anchor="left" icon="AllIcons.Toolwindows.ToolWindowBookmarks" secondary="true"
|
||||
|
||||
@@ -1,348 +0,0 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
max_line_length = 150
|
||||
tab_width = 4
|
||||
ij_continuation_indent_size = 8
|
||||
ij_formatter_off_tag = @formatter:off
|
||||
ij_formatter_on_tag = @formatter:on
|
||||
ij_formatter_tags_enabled = false
|
||||
ij_smart_tabs = false
|
||||
ij_visual_guides = none
|
||||
ij_wrap_on_typing = false
|
||||
|
||||
[*.java]
|
||||
ij_java_align_consecutive_assignments = false
|
||||
ij_java_align_consecutive_variable_declarations = false
|
||||
ij_java_align_group_field_declarations = false
|
||||
ij_java_align_multiline_annotation_parameters = false
|
||||
ij_java_align_multiline_array_initializer_expression = false
|
||||
ij_java_align_multiline_assignment = false
|
||||
ij_java_align_multiline_binary_operation = false
|
||||
ij_java_align_multiline_chained_methods = false
|
||||
ij_java_align_multiline_extends_list = false
|
||||
ij_java_align_multiline_for = true
|
||||
ij_java_align_multiline_method_parentheses = false
|
||||
ij_java_align_multiline_parameters = true
|
||||
ij_java_align_multiline_parameters_in_calls = false
|
||||
ij_java_align_multiline_parenthesized_expression = false
|
||||
ij_java_align_multiline_records = true
|
||||
ij_java_align_multiline_resources = true
|
||||
ij_java_align_multiline_ternary_operation = false
|
||||
ij_java_align_multiline_text_blocks = false
|
||||
ij_java_align_multiline_throws_list = false
|
||||
ij_java_align_subsequent_simple_methods = false
|
||||
ij_java_align_throws_keyword = false
|
||||
ij_java_annotation_parameter_wrap = off
|
||||
ij_java_array_initializer_new_line_after_left_brace = false
|
||||
ij_java_array_initializer_right_brace_on_new_line = false
|
||||
ij_java_array_initializer_wrap = off
|
||||
ij_java_assert_statement_colon_on_next_line = false
|
||||
ij_java_assert_statement_wrap = off
|
||||
ij_java_assignment_wrap = off
|
||||
ij_java_binary_operation_sign_on_next_line = false
|
||||
ij_java_binary_operation_wrap = off
|
||||
ij_java_blank_lines_after_anonymous_class_header = 0
|
||||
ij_java_blank_lines_after_class_header = 0
|
||||
ij_java_blank_lines_after_imports = 1
|
||||
ij_java_blank_lines_after_package = 1
|
||||
ij_java_blank_lines_around_class = 1
|
||||
ij_java_blank_lines_around_field = 0
|
||||
ij_java_blank_lines_around_field_in_interface = 0
|
||||
ij_java_blank_lines_around_initializer = 1
|
||||
ij_java_blank_lines_around_method = 1
|
||||
ij_java_blank_lines_around_method_in_interface = 1
|
||||
ij_java_blank_lines_before_class_end = 0
|
||||
ij_java_blank_lines_before_imports = 1
|
||||
ij_java_blank_lines_before_method_body = 0
|
||||
ij_java_blank_lines_before_package = 0
|
||||
ij_java_block_brace_style = end_of_line
|
||||
ij_java_block_comment_at_first_column = true
|
||||
ij_java_builder_methods = none
|
||||
ij_java_call_parameters_new_line_after_left_paren = false
|
||||
ij_java_call_parameters_right_paren_on_new_line = false
|
||||
ij_java_call_parameters_wrap = off
|
||||
ij_java_case_statement_on_separate_line = true
|
||||
ij_java_catch_on_new_line = false
|
||||
ij_java_class_annotation_wrap = split_into_lines
|
||||
ij_java_class_brace_style = end_of_line
|
||||
ij_java_class_count_to_use_import_on_demand = 5
|
||||
ij_java_class_names_in_javadoc = 1
|
||||
ij_java_do_not_indent_top_level_class_members = false
|
||||
ij_java_do_not_wrap_after_single_annotation = false
|
||||
ij_java_do_while_brace_force = never
|
||||
ij_java_doc_add_blank_line_after_description = true
|
||||
ij_java_doc_add_blank_line_after_param_comments = false
|
||||
ij_java_doc_add_blank_line_after_return = false
|
||||
ij_java_doc_add_p_tag_on_empty_lines = true
|
||||
ij_java_doc_align_exception_comments = true
|
||||
ij_java_doc_align_param_comments = true
|
||||
ij_java_doc_do_not_wrap_if_one_line = false
|
||||
ij_java_doc_enable_formatting = true
|
||||
ij_java_doc_enable_leading_asterisks = true
|
||||
ij_java_doc_indent_on_continuation = false
|
||||
ij_java_doc_keep_empty_lines = true
|
||||
ij_java_doc_keep_empty_parameter_tag = true
|
||||
ij_java_doc_keep_empty_return_tag = true
|
||||
ij_java_doc_keep_empty_throws_tag = true
|
||||
ij_java_doc_keep_invalid_tags = true
|
||||
ij_java_doc_param_description_on_new_line = false
|
||||
ij_java_doc_preserve_line_breaks = false
|
||||
ij_java_doc_use_throws_not_exception_tag = true
|
||||
ij_java_else_on_new_line = false
|
||||
ij_java_enum_constants_wrap = off
|
||||
ij_java_extends_keyword_wrap = off
|
||||
ij_java_extends_list_wrap = off
|
||||
ij_java_field_annotation_wrap = split_into_lines
|
||||
ij_java_finally_on_new_line = false
|
||||
ij_java_for_brace_force = never
|
||||
ij_java_for_statement_new_line_after_left_paren = false
|
||||
ij_java_for_statement_right_paren_on_new_line = false
|
||||
ij_java_for_statement_wrap = off
|
||||
ij_java_generate_final_locals = false
|
||||
ij_java_generate_final_parameters = false
|
||||
ij_java_if_brace_force = never
|
||||
ij_java_imports_layout = *, |, javax.**, java.**, |, $*
|
||||
ij_java_indent_case_from_switch = true
|
||||
ij_java_insert_inner_class_imports = false
|
||||
ij_java_insert_override_annotation = true
|
||||
ij_java_keep_blank_lines_before_right_brace = 2
|
||||
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
|
||||
ij_java_keep_blank_lines_in_code = 2
|
||||
ij_java_keep_blank_lines_in_declarations = 2
|
||||
ij_java_keep_builder_methods_indents = false
|
||||
ij_java_keep_control_statement_in_one_line = true
|
||||
ij_java_keep_first_column_comment = true
|
||||
ij_java_keep_indents_on_empty_lines = false
|
||||
ij_java_keep_line_breaks = true
|
||||
ij_java_keep_multiple_expressions_in_one_line = false
|
||||
ij_java_keep_simple_blocks_in_one_line = false
|
||||
ij_java_keep_simple_classes_in_one_line = false
|
||||
ij_java_keep_simple_lambdas_in_one_line = false
|
||||
ij_java_keep_simple_methods_in_one_line = false
|
||||
ij_java_label_indent_absolute = false
|
||||
ij_java_label_indent_size = 0
|
||||
ij_java_lambda_brace_style = end_of_line
|
||||
ij_java_layout_static_imports_separately = true
|
||||
ij_java_line_comment_add_space = false
|
||||
ij_java_line_comment_at_first_column = true
|
||||
ij_java_method_annotation_wrap = split_into_lines
|
||||
ij_java_method_brace_style = end_of_line
|
||||
ij_java_method_call_chain_wrap = off
|
||||
ij_java_method_parameters_new_line_after_left_paren = false
|
||||
ij_java_method_parameters_right_paren_on_new_line = false
|
||||
ij_java_method_parameters_wrap = off
|
||||
ij_java_modifier_list_wrap = false
|
||||
ij_java_names_count_to_use_import_on_demand = 3
|
||||
ij_java_new_line_after_lparen_in_record_header = false
|
||||
ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.*
|
||||
ij_java_parameter_annotation_wrap = off
|
||||
ij_java_parentheses_expression_new_line_after_left_paren = false
|
||||
ij_java_parentheses_expression_right_paren_on_new_line = false
|
||||
ij_java_place_assignment_sign_on_next_line = false
|
||||
ij_java_prefer_longer_names = true
|
||||
ij_java_prefer_parameters_wrap = false
|
||||
ij_java_record_components_wrap = normal
|
||||
ij_java_repeat_synchronized = true
|
||||
ij_java_replace_instanceof_and_cast = false
|
||||
ij_java_replace_null_check = true
|
||||
ij_java_replace_sum_lambda_with_method_ref = true
|
||||
ij_java_resource_list_new_line_after_left_paren = false
|
||||
ij_java_resource_list_right_paren_on_new_line = false
|
||||
ij_java_resource_list_wrap = off
|
||||
ij_java_rparen_on_new_line_in_record_header = false
|
||||
ij_java_space_after_closing_angle_bracket_in_type_argument = false
|
||||
ij_java_space_after_colon = true
|
||||
ij_java_space_after_comma = true
|
||||
ij_java_space_after_comma_in_type_arguments = true
|
||||
ij_java_space_after_for_semicolon = true
|
||||
ij_java_space_after_quest = true
|
||||
ij_java_space_after_type_cast = true
|
||||
ij_java_space_before_annotation_array_initializer_left_brace = false
|
||||
ij_java_space_before_annotation_parameter_list = false
|
||||
ij_java_space_before_array_initializer_left_brace = false
|
||||
ij_java_space_before_catch_keyword = true
|
||||
ij_java_space_before_catch_left_brace = true
|
||||
ij_java_space_before_catch_parentheses = true
|
||||
ij_java_space_before_class_left_brace = true
|
||||
ij_java_space_before_colon = true
|
||||
ij_java_space_before_colon_in_foreach = true
|
||||
ij_java_space_before_comma = false
|
||||
ij_java_space_before_do_left_brace = true
|
||||
ij_java_space_before_else_keyword = true
|
||||
ij_java_space_before_else_left_brace = true
|
||||
ij_java_space_before_finally_keyword = true
|
||||
ij_java_space_before_finally_left_brace = true
|
||||
ij_java_space_before_for_left_brace = true
|
||||
ij_java_space_before_for_parentheses = true
|
||||
ij_java_space_before_for_semicolon = false
|
||||
ij_java_space_before_if_left_brace = true
|
||||
ij_java_space_before_if_parentheses = true
|
||||
ij_java_space_before_method_call_parentheses = false
|
||||
ij_java_space_before_method_left_brace = true
|
||||
ij_java_space_before_method_parentheses = false
|
||||
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
|
||||
ij_java_space_before_quest = true
|
||||
ij_java_space_before_switch_left_brace = true
|
||||
ij_java_space_before_switch_parentheses = true
|
||||
ij_java_space_before_synchronized_left_brace = true
|
||||
ij_java_space_before_synchronized_parentheses = true
|
||||
ij_java_space_before_try_left_brace = true
|
||||
ij_java_space_before_try_parentheses = true
|
||||
ij_java_space_before_type_parameter_list = false
|
||||
ij_java_space_before_while_keyword = true
|
||||
ij_java_space_before_while_left_brace = true
|
||||
ij_java_space_before_while_parentheses = true
|
||||
ij_java_space_inside_one_line_enum_braces = false
|
||||
ij_java_space_within_empty_array_initializer_braces = false
|
||||
ij_java_space_within_empty_method_call_parentheses = false
|
||||
ij_java_space_within_empty_method_parentheses = false
|
||||
ij_java_spaces_around_additive_operators = true
|
||||
ij_java_spaces_around_assignment_operators = true
|
||||
ij_java_spaces_around_bitwise_operators = true
|
||||
ij_java_spaces_around_equality_operators = true
|
||||
ij_java_spaces_around_lambda_arrow = true
|
||||
ij_java_spaces_around_logical_operators = true
|
||||
ij_java_spaces_around_method_ref_dbl_colon = false
|
||||
ij_java_spaces_around_multiplicative_operators = true
|
||||
ij_java_spaces_around_relational_operators = true
|
||||
ij_java_spaces_around_shift_operators = true
|
||||
ij_java_spaces_around_type_bounds_in_type_parameters = true
|
||||
ij_java_spaces_around_unary_operator = false
|
||||
ij_java_spaces_within_angle_brackets = false
|
||||
ij_java_spaces_within_annotation_parentheses = false
|
||||
ij_java_spaces_within_array_initializer_braces = false
|
||||
ij_java_spaces_within_braces = false
|
||||
ij_java_spaces_within_brackets = false
|
||||
ij_java_spaces_within_cast_parentheses = false
|
||||
ij_java_spaces_within_catch_parentheses = false
|
||||
ij_java_spaces_within_for_parentheses = false
|
||||
ij_java_spaces_within_if_parentheses = false
|
||||
ij_java_spaces_within_method_call_parentheses = false
|
||||
ij_java_spaces_within_method_parentheses = false
|
||||
ij_java_spaces_within_parentheses = false
|
||||
ij_java_spaces_within_record_header = false
|
||||
ij_java_spaces_within_switch_parentheses = false
|
||||
ij_java_spaces_within_synchronized_parentheses = false
|
||||
ij_java_spaces_within_try_parentheses = false
|
||||
ij_java_spaces_within_while_parentheses = false
|
||||
ij_java_special_else_if_treatment = true
|
||||
ij_java_subclass_name_suffix = Impl
|
||||
ij_java_ternary_operation_signs_on_next_line = false
|
||||
ij_java_ternary_operation_wrap = off
|
||||
ij_java_test_name_suffix = Test
|
||||
ij_java_throws_keyword_wrap = off
|
||||
ij_java_throws_list_wrap = off
|
||||
ij_java_use_external_annotations = false
|
||||
ij_java_use_fq_class_names = false
|
||||
ij_java_use_relative_indents = false
|
||||
ij_java_use_single_class_imports = true
|
||||
ij_java_variable_annotation_wrap = off
|
||||
ij_java_visibility = public
|
||||
ij_java_while_brace_force = never
|
||||
ij_java_while_on_new_line = false
|
||||
ij_java_wrap_comments = false
|
||||
ij_java_wrap_first_method_in_call_chain = false
|
||||
ij_java_wrap_long_lines = false
|
||||
|
||||
[*.properties]
|
||||
ij_properties_align_group_field_declarations = false
|
||||
ij_properties_keep_blank_lines = false
|
||||
ij_properties_key_value_delimiter = equals
|
||||
ij_properties_spaces_around_key_value_delimiter = false
|
||||
|
||||
[{*.kt, *.kts}]
|
||||
ij_continuation_indent_size = 4
|
||||
ij_kotlin_align_in_columns_case_branch = false
|
||||
ij_kotlin_align_multiline_binary_operation = false
|
||||
ij_kotlin_align_multiline_extends_list = false
|
||||
ij_kotlin_align_multiline_method_parentheses = false
|
||||
ij_kotlin_align_multiline_parameters = false
|
||||
ij_kotlin_align_multiline_parameters_in_calls = false
|
||||
ij_kotlin_allow_trailing_comma = false
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = false
|
||||
ij_kotlin_assignment_wrap = on_every_item
|
||||
ij_kotlin_blank_lines_after_class_header = 1
|
||||
ij_kotlin_blank_lines_around_block_when_branches = 0
|
||||
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
|
||||
ij_kotlin_block_comment_at_first_column = true
|
||||
ij_kotlin_call_parameters_new_line_after_left_paren = true
|
||||
ij_kotlin_call_parameters_right_paren_on_new_line = true
|
||||
ij_kotlin_call_parameters_wrap = on_every_item
|
||||
ij_kotlin_catch_on_new_line = false
|
||||
ij_kotlin_class_annotation_wrap = on_every_item
|
||||
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
|
||||
ij_kotlin_continuation_indent_for_chained_calls = true
|
||||
ij_kotlin_continuation_indent_for_expression_bodies = true
|
||||
ij_kotlin_continuation_indent_in_argument_lists = true
|
||||
ij_kotlin_continuation_indent_in_elvis = true
|
||||
ij_kotlin_continuation_indent_in_if_conditions = true
|
||||
ij_kotlin_continuation_indent_in_parameter_lists = true
|
||||
ij_kotlin_continuation_indent_in_supertype_lists = true
|
||||
ij_kotlin_else_on_new_line = false
|
||||
ij_kotlin_enum_constants_wrap = on_every_item
|
||||
ij_kotlin_extends_list_wrap = off
|
||||
ij_kotlin_field_annotation_wrap = on_every_item
|
||||
ij_kotlin_finally_on_new_line = false
|
||||
ij_kotlin_if_rparen_on_new_line = false
|
||||
ij_kotlin_import_nested_classes = false
|
||||
ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
|
||||
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
|
||||
ij_kotlin_keep_blank_lines_before_right_brace = 0
|
||||
ij_kotlin_keep_blank_lines_in_code = 1
|
||||
ij_kotlin_keep_blank_lines_in_declarations = 1
|
||||
ij_kotlin_keep_first_column_comment = true
|
||||
ij_kotlin_keep_indents_on_empty_lines = false
|
||||
ij_kotlin_keep_line_breaks = true
|
||||
ij_kotlin_lbrace_on_next_line = false
|
||||
ij_kotlin_line_comment_add_space = false
|
||||
ij_kotlin_line_comment_at_first_column = true
|
||||
ij_kotlin_method_annotation_wrap = on_every_item
|
||||
ij_kotlin_method_call_chain_wrap = on_every_item
|
||||
ij_kotlin_method_parameters_new_line_after_left_paren = true
|
||||
ij_kotlin_method_parameters_right_paren_on_new_line = true
|
||||
ij_kotlin_method_parameters_wrap = on_every_item
|
||||
ij_kotlin_name_count_to_use_star_import = 2147483647
|
||||
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
|
||||
ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**
|
||||
ij_kotlin_parameter_annotation_wrap = on_every_item
|
||||
ij_kotlin_space_after_comma = true
|
||||
ij_kotlin_space_after_extend_colon = true
|
||||
ij_kotlin_space_after_type_colon = true
|
||||
ij_kotlin_space_before_catch_parentheses = true
|
||||
ij_kotlin_space_before_comma = false
|
||||
ij_kotlin_space_before_extend_colon = true
|
||||
ij_kotlin_space_before_for_parentheses = true
|
||||
ij_kotlin_space_before_if_parentheses = true
|
||||
ij_kotlin_space_before_lambda_arrow = true
|
||||
ij_kotlin_space_before_type_colon = false
|
||||
ij_kotlin_space_before_when_parentheses = true
|
||||
ij_kotlin_space_before_while_parentheses = true
|
||||
ij_kotlin_spaces_around_additive_operators = true
|
||||
ij_kotlin_spaces_around_assignment_operators = true
|
||||
ij_kotlin_spaces_around_equality_operators = true
|
||||
ij_kotlin_spaces_around_function_type_arrow = true
|
||||
ij_kotlin_spaces_around_logical_operators = true
|
||||
ij_kotlin_spaces_around_multiplicative_operators = true
|
||||
ij_kotlin_spaces_around_range = false
|
||||
ij_kotlin_spaces_around_relational_operators = true
|
||||
ij_kotlin_spaces_around_unary_operator = false
|
||||
ij_kotlin_spaces_around_when_arrow = true
|
||||
ij_kotlin_variable_annotation_wrap = on_every_item
|
||||
ij_kotlin_while_on_new_line = false
|
||||
ij_kotlin_wrap_elvis_expressions = 1
|
||||
ij_kotlin_wrap_expression_body_functions = 1
|
||||
ij_kotlin_wrap_first_method_in_call_chain = false
|
||||
|
||||
[{*.markdown, *.md}]
|
||||
ij_markdown_force_one_space_after_blockquote_symbol = true
|
||||
ij_markdown_force_one_space_after_header_symbol = true
|
||||
ij_markdown_force_one_space_after_list_bullet = true
|
||||
ij_markdown_force_one_space_between_words = true
|
||||
ij_markdown_keep_indents_on_empty_lines = false
|
||||
ij_markdown_max_lines_around_block_elements = 1
|
||||
ij_markdown_max_lines_around_header = 1
|
||||
ij_markdown_max_lines_between_paragraphs = 1
|
||||
ij_markdown_min_lines_around_block_elements = 1
|
||||
ij_markdown_min_lines_around_header = 1
|
||||
ij_markdown_min_lines_between_paragraphs = 1
|
||||
@@ -1,183 +0,0 @@
|
||||
# Package Search Changelog
|
||||
|
||||
## NEW VERSION
|
||||
|
||||
* Bug: unsupported dependencies formats in the buildscript can crash the plugin
|
||||
([PKGS-610](https://youtrack.jetbrains.com/issue/PKGS-610),
|
||||
[PKGS-611](https://youtrack.jetbrains.com/issue/PKGS-611))
|
||||
|
||||
## Version 1.0.1428-eap (29 Jan 2021)
|
||||
|
||||
* Compatible with IDEA 2020.1—2021.1 EAP (note: full compatibility with 2021.1 EAPs is a work in progress)
|
||||
* Bug: some UI elements render incorrectly on IntelliJ 2020.3.x
|
||||
([PKGS-618](https://youtrack.jetbrains.com/issue/PKGS-618))
|
||||
|
||||
## Version 1.0.1385-eap (14 Dec 2020)
|
||||
|
||||
* Bug: unsupported dependencies formats in the buildscript can crash the plugin
|
||||
([PKGS-610](https://youtrack.jetbrains.com/issue/PKGS-610),
|
||||
[PKGS-611](https://youtrack.jetbrains.com/issue/PKGS-611))
|
||||
|
||||
## Version 1.0.1353-eap (30 Nov 2020)
|
||||
|
||||
* Compatible with IDEA 2020.1—2020.3
|
||||
|
||||
## Version 1.0.1191-eap (28 Aug 2020)
|
||||
|
||||
* Bug: Plugin UI not showing metadata when unsupported platforms are present (PKGS-547)
|
||||
|
||||
## Version 1.0.1174-eap (6 Aug 2020)
|
||||
|
||||
* Cosmetics: package operation confirmation dialog has been removed
|
||||
* Cosmetics: improve inspections names and description
|
||||
* Bug: the update package quick fix would not work correctly sometimes in Maven POMs (PKGS-489)
|
||||
|
||||
## Version 1.0.1145-eap (18 Jun 2020)
|
||||
|
||||
* Bug: Up/down on search box/first result should navigate between controls
|
||||
* Bug: Updating the package deletes the line above and doesn't update version
|
||||
* Bug: Variables cause Update intentions to shown for all packages
|
||||
* Bug: Indicate incomplete Gradle sync state
|
||||
|
||||
## Version 1.0.1119-eap (29 May 2020)
|
||||
|
||||
* Compatible with IDEA 2020.2 EAPs
|
||||
|
||||
## Version 1.0.1112-eap (20 May 2020)
|
||||
|
||||
* Compatible with IDEA 2019.2+
|
||||
* Improvement: Reduce plugin size by about 8%
|
||||
* Improvement: Context menu on installed packages and search results
|
||||
* Bug: Failure to parse some Gradle repository declarations (PKGS-426)
|
||||
|
||||
## Version 1.0.921-eap (1 Apr 2020)
|
||||
|
||||
* Improvement: Flag dependencies that can be updated in the editor, offer quick-fix
|
||||
* Improvement: Navigate to the definition of a dependency in pom.xml/build.gradle
|
||||
* Improvement: Quick Fix to add missing dependencies in editor
|
||||
* Improvement: Allow searching only MPP dependencies
|
||||
* Bug: "Reformat build file when dependency is added" doesn't seem to work
|
||||
* Bug: Package Search IllegalArgumentException 'gwt-lib' is not a valid Maven type value
|
||||
|
||||
## Version 1.0.845-eap (28 Jan 2020)
|
||||
|
||||
* Improvement: add support for IntelliJ 2020.1 EAP
|
||||
* Improvement: minor copy improvements
|
||||
|
||||
## Version 1.0.838-eap (14 Jan 2020)
|
||||
|
||||
* Improvement: in a plain project without Maven/Gradle, the package search tool window is now no longer available
|
||||
* Cosmetics: rename "Install" to "Add to Project"
|
||||
* Cosmetics: normalize package description text indentations
|
||||
* Cosmetics: normalize GitHub repository links in package description
|
||||
* Cosmetics: remove useless tooltips in packages list
|
||||
* Bug: the package search was not always focused after using the "Add package" action
|
||||
* Bug: sometimes clicking the GitHub/SCM link for a dependency could result in an error
|
||||
|
||||
## Version 1.0.826-eap (31 Dec 2019)
|
||||
|
||||
* Improvement: added "only stable" filter to the plugin, which applies to searches and updates
|
||||
* Improvement: don't integrate "Package" in Generate menu for non-Gradle/non-POM files
|
||||
* Cosmetics: show indication on plugin that it's not available while the project is syncing
|
||||
* Cosmetics: wrap authors in package details for long lists
|
||||
|
||||
## Version 1.0.815-eap (22 Nov 2019)
|
||||
|
||||
* Bug: the plugin was not able to handle default (missing) scope for dependencies in Maven POMs
|
||||
* Bug: the plugin was not able to handle non-ascii configuration names in Gradle build scripts
|
||||
|
||||
## Version 1.0.807-eap (19 Nov 2019)
|
||||
|
||||
* Bug: plugin crashes when a Maven POM contains invalid/unparseable XML
|
||||
|
||||
## Version 1.0.804-eap (13 Nov 2019)
|
||||
|
||||
* Bug: fix packages list rendering broken when searching in latest 2019.3 build
|
||||
* Bug: fix package search plugin adds `package` entry in `new` dialog
|
||||
|
||||
## Version 1.0.799-eap (13 Nov 2019)
|
||||
|
||||
* Bug: fix packages list rendering broken when searching in latest 2019.3 build
|
||||
* Bug: fix package search plugin adds `package` entry in `new` dialog
|
||||
|
||||
## Version 1.0.785-eap (7 Nov 2019)
|
||||
|
||||
* Bug: fix "Choose Destination Directory" dialog showing when right-clicking and multiple directories
|
||||
are selected in Project View ([PKGS-353](https://youtrack.jetbrains.com/issue/PKGS-353))
|
||||
* Bug: fix potential freeze when using Find Action
|
||||
* Bug: dependencies followed by comments were not picked up correctly in Gradle files
|
||||
([PKGS-354](https://youtrack.jetbrains.com/issue/PKGS-354))
|
||||
* Improvement: attach additional info to errors when the Gradle build script parser fails, to help troubleshoot
|
||||
— please do submit reports from the IDE with the additional attachments if you can!
|
||||
|
||||
## Version 1.0.763-eap (21 Oct 2019)
|
||||
|
||||
* First public EAP release
|
||||
* Bug: plugin crashes when using K&R braces style in Gradle files
|
||||
* Bug: fix potential crash in 19.1-based IDEs
|
||||
|
||||
## Version 0.11.741 (11 Oct 2019)
|
||||
|
||||
* Improvement: Update default configurations scope list for Gradle projects
|
||||
* Bug: Removing a dependency and reimporting makes plugin get in a weird UI state
|
||||
* Bug: Typing a custom configuration and clicking the + button adds it as the default configuration
|
||||
|
||||
## Version 0.11.734 (10 Oct 2019)
|
||||
|
||||
* Improvement: Works with IntelliJ 2019.3 EAP
|
||||
* Improvement: Use unified API for search and version info
|
||||
* Improvement: Fetching of version info and metadata performance improvement
|
||||
* Improvement: Can exclude results with only non-stable versions by adding `/onlyStable:true`
|
||||
to the search query
|
||||
* Improvement: The plugin looks better on dark themes, such as Darcula
|
||||
* Bug: Updating Maven dependencies with implicit scope failed
|
||||
|
||||
## Version 0.11.542 (12 Aug 2019)
|
||||
|
||||
* Bug: Update All link sometimes displayed incorrectly
|
||||
|
||||
## Version 0.11.539 (12 Aug 2019)
|
||||
|
||||
* Updates to new UI
|
||||
* Improvement: LaF consistent with IntelliJ plugin manager UI
|
||||
* Improvement: Terminology consistent with IntelliJ plugin manager UI
|
||||
* Bug: Custom Gradle configuration when installing package is supported
|
||||
* Improvement: Plugin startup performance
|
||||
|
||||
## Version 0.11.465 (17 Jul 2019)
|
||||
|
||||
* Updates to new UI
|
||||
* Feature: Tool window can now be scoped to All Modules or a specific module
|
||||
* Feature: Upgrade All action in the tool window toolbar
|
||||
* Bug: Packages that have been installed in multiple configurations are now rendered correctly
|
||||
* Bug: Long module names now display a tooltip on hover
|
||||
* Improvement: Improved stability when network connectivity fails
|
||||
|
||||
## Version 0.11.452 (15 Jul 2019)
|
||||
|
||||
* Feature: Brand new UI!
|
||||
* Now a panel rather than a dialog
|
||||
* See installed dependencies, add new ones and update outdated ones
|
||||
* At a glance view of all project modules
|
||||
* Feature: New option to disable update checks
|
||||
* Improvement: Under-the-hood changes to future-proof the code
|
||||
* Compatible with IDEA 2019.1–2019.2
|
||||
|
||||
## Version 0.11.305 (11 Jun 2019)
|
||||
|
||||
* Improvement: Improve dialog UI behaviour when resizing
|
||||
* Improvement: Improve focus handling in dialog and add keyboard shortcuts
|
||||
* Feature: Add link to StackOverflow tags
|
||||
|
||||
## Version 0.11.302 (5 Jun 2019)
|
||||
|
||||
* Bug: Fix crash when adding dependencies that are already declared
|
||||
|
||||
## Version 0.11.295 (4 Jun 2019)
|
||||
|
||||
* Improvement: Minor under-the-hood improvements
|
||||
|
||||
## Version 0.11.292 (4 Jun 2019)
|
||||
|
||||
* Feature: Initial snapshot release for private EAP
|
||||
* Compatible with IDEA 2018.3.1–2019.2 (EAP)
|
||||
@@ -1,18 +0,0 @@
|
||||
# Package Search IntelliJ plugin
|
||||
|
||||
This directory contains the IJ plugin for Package Search.
|
||||
|
||||
## Testing against non-prod backend
|
||||
|
||||
By default, the plugin will use the production backend. If you ever needed to test against a different deployment of the APIs, you can temporarily
|
||||
change the `ServerURLs.base` property value in the
|
||||
[`DefaultPackageServiceConfig.kt`](community/plugins/repository-search/src/main/kotlin/org/jetbrains/idea/packagesearch/DefaultPackageServiceConfig.kt) file, for example pointing it to a local
|
||||
instance of the backend such as `http://localhost:7676`, or a staging environment.
|
||||
|
||||
Please note that some tests in the project are not unit tests, but rather integration tests that hit the backend. By default, those tests will be run
|
||||
against the production environment as per the `ServerURLs.base` value, so changing that will impact those tests. Also, if you make changes to the
|
||||
backend and want to run the plugin integration tests, you should be temporarily changing those tests to hit a local deploy of the backend, not the
|
||||
production one.
|
||||
|
||||
You can identify integration tests as being subclasses of the
|
||||
[`SearchClientTestsBase`](test-src/com/jetbrains/packagesearch/intellij/plugin/api/SearchClientTestsBase.kt) class.
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
set -e -x -u
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Please provide the version name as the first argument and the git repo root path as the second argument"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "The version name must not be blank."
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
echo "The git repo root path must not be blank."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
repoPath=$2
|
||||
|
||||
if [ ! -d "$repoPath" ]; then
|
||||
echo "The git repo root path must be a directory."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cd "$2"
|
||||
|
||||
git add "intellij-plugin/CHANGELOG.md"
|
||||
git status
|
||||
|
||||
if git diff-index --quiet HEAD --; then
|
||||
echo 'The changelog has NOT been updated. Are you sure you''re ready to cut a new plugin version?'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
git config user.email ps-buildbot@kpm.jetbrains.com
|
||||
git config user.name 'Package Search buildbot'
|
||||
|
||||
git commit -m "Update changelog for version $version"
|
||||
|
||||
upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{u})
|
||||
if [ -z "$upstream" ]; then
|
||||
echo "The current branch does not track a remote branch, cannot push."
|
||||
exit 3
|
||||
fi
|
||||
|
||||
git format-patch -1 HEAD --stdout
|
||||
#git pull origin || true
|
||||
#git push origin
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi -opt-in=kotlin.ExperimentalStdlibApi -opt-in=kotlinx.coroutines.FlowPreview -opt-in=kotlin.time.ExperimentalTime -opt-in=kotlinx.serialization.ExperimentalSerializationApi" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="17" />
|
||||
<stringArg name="apiVersion" arg="1.9" />
|
||||
<stringArg name="languageVersion" arg="1.9" />
|
||||
</stringArguments>
|
||||
<arrayArguments>
|
||||
<arrayArg name="pluginClasspaths">
|
||||
<args>$KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar</args>
|
||||
</arrayArg>
|
||||
</arrayArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-json" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-core" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.gradle.common" />
|
||||
<orderEntry type="module" module-name="intellij.gradle.toolingExtension.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem.dependencyUpdater" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.statistics" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch.gradle.tooling" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-protobuf" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,71 +0,0 @@
|
||||
<idea-plugin package="com.jetbrains.packagesearch.intellij.plugin.gradle">
|
||||
|
||||
<dependencies>
|
||||
<plugin id="org.jetbrains.plugins.gradle"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<!--suppress PluginXmlCapitalization -->
|
||||
<localInspection
|
||||
language="UAST"
|
||||
bundle="messages.packageSearchBundle"
|
||||
enabledByDefault="true"
|
||||
groupKey="packagesearch.inspection.upgrade.group"
|
||||
implementationClass="com.jetbrains.packagesearch.intellij.plugin.gradle.GradlePackageUpdateInspection"
|
||||
key="packagesearch.inspection.upgrade.key.gradle"
|
||||
hasStaticDescription="true"
|
||||
level="WEAK WARNING"/>
|
||||
|
||||
<!--suppress PluginXmlCapitalization -->
|
||||
<localInspection
|
||||
language="UAST"
|
||||
bundle="messages.packageSearchBundle"
|
||||
enabledByDefault="true"
|
||||
groupKey="packagesearch.inspection.upgrade.group"
|
||||
implementationClass="com.jetbrains.packagesearch.intellij.plugin.gradle.GradlePackageVersionRangeInspection"
|
||||
key="packagesearch.inspection.range.key.gradle"
|
||||
hasStaticDescription="true"
|
||||
level="WEAK WARNING"/>
|
||||
|
||||
<packagesearch.moduleTransformer
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradleModuleTransformer"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.SmartModeSignalProvider"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradleModuleLinkSignalProvider"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradlePropertiesChangedSignalProvider"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GlobalGradlePropertiesChangedSignalProvider"/>
|
||||
|
||||
<packagesearch.configurableContributor
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.configuration.ui.GradleConfigurableContributor"/>
|
||||
|
||||
<search.optionContributor
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.configuration.GradleSearchableOptionContributor"/>
|
||||
|
||||
<packagesearch.resolvedDependenciesProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradleResolvedDependenciesProvider"/>
|
||||
|
||||
<externalProjectDataService implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradleConfigurationReportNodeProcessor"/>
|
||||
|
||||
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
|
||||
<projectResolve implementation="com.jetbrains.packagesearch.intellij.plugin.gradle.GradleConfigurationResolver"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<action id="PackageSearch.Gradle.DependencyAnalyzer.GoTo"
|
||||
class="com.jetbrains.packagesearch.intellij.plugin.gradle.dependency.analyzer.GradleDependencyAnalyzerGoToPackageSearchAction">
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -1,106 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.FileWatcherSignalProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.FlowModuleChangesSignalProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.awaitSmart
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.dumbService
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.filesChangedEventFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.messageBusFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.trySend
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.flatMapMerge
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.jetbrains.plugins.gradle.settings.DistributionType
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettingsListener
|
||||
import org.jetbrains.plugins.gradle.settings.TestRunner
|
||||
import java.nio.file.Paths
|
||||
|
||||
internal class SmartModeSignalProvider : FlowModuleChangesSignalProvider {
|
||||
|
||||
override fun registerModuleChangesListener(project: Project) = flow {
|
||||
project.dumbService.awaitSmart()
|
||||
emit(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
internal class GradleModuleLinkSignalProvider : FlowModuleChangesSignalProvider {
|
||||
|
||||
override fun registerModuleChangesListener(project: Project) =
|
||||
project.messageBusFlow(GradleSettingsListener.TOPIC) {
|
||||
project.dumbService.awaitSmart()
|
||||
object : GradleSettingsListener {
|
||||
override fun onProjectRenamed(oldName: String, newName: String) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onProjectsLinked(settings: MutableCollection<GradleProjectSettings>) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onProjectsUnlinked(linkedProjectPaths: MutableSet<String>) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onGradleHomeChange(oldPath: String?, newPath: String?, linkedProjectPath: String) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onGradleDistributionTypeChange(currentValue: DistributionType?, linkedProjectPath: String) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onServiceDirectoryPathChange(oldPath: String?, newPath: String?) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onGradleJvmChange(oldGradleJvm: String?, newGradleJvm: String?, linkedProjectPath: String) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onGradleVmOptionsChange(oldOptions: String?, newOptions: String?) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onBuildDelegationChange(delegatedBuild: Boolean, linkedProjectPath: String) {
|
||||
trySend()
|
||||
}
|
||||
|
||||
override fun onTestRunnerChange(currentTestRunner: TestRunner, linkedProjectPath: String) {
|
||||
trySend()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class GradlePropertiesChangedSignalProvider : FlowModuleChangesSignalProvider {
|
||||
|
||||
override fun registerModuleChangesListener(project: Project) =
|
||||
project.filesChangedEventFlow.flatMapMerge { it.asFlow() }
|
||||
.filter { it.file?.name == "gradle.properties" || it.file?.name == "local.properties" }
|
||||
.map { }
|
||||
}
|
||||
|
||||
internal class GlobalGradlePropertiesChangedSignalProvider : FileWatcherSignalProvider(
|
||||
System.getenv("GRADLE_USER_HOME")?.let { Paths.get(it, "gradle.properties") }
|
||||
?: Paths.get(System.getProperty("user.home"), ".gradle", "gradle.properties")
|
||||
)
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.externalSystem.model.DataNode
|
||||
import com.intellij.openapi.externalSystem.model.Key
|
||||
import com.intellij.openapi.externalSystem.model.project.ProjectData
|
||||
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.getProjectDataPath
|
||||
import com.intellij.util.io.createDirectories
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.logDebug
|
||||
import kotlinx.serialization.decodeFromByteArray
|
||||
import kotlinx.serialization.encodeToByteArray
|
||||
import kotlinx.serialization.protobuf.ProtoBuf
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.readBytes
|
||||
import kotlin.io.path.writeBytes
|
||||
|
||||
class GradleConfigurationReportNodeProcessor : AbstractProjectDataService<PublicGradleConfigurationReportModel, Unit>() {
|
||||
|
||||
companion object {
|
||||
|
||||
internal val ESM_REPORTS_KEY: Key<PublicGradleConfigurationReportModel> =
|
||||
Key.create(PublicGradleConfigurationReportModel::class.java, 100)
|
||||
}
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class Cache(private val project: Project) : Disposable {
|
||||
|
||||
private val cacheFile
|
||||
get() = project.getProjectDataPath("pkgs")
|
||||
.also { if (!it.exists()) it.createDirectories() }
|
||||
.resolve("gradle.proto.bin")
|
||||
|
||||
var state = load()
|
||||
internal set
|
||||
|
||||
private fun load(): Map<String, PublicGradleConfigurationReportModel> =
|
||||
cacheFile.takeIf { it.exists() }
|
||||
?.runCatching { ProtoBuf.decodeFromByteArray<Map<String, PublicGradleConfigurationReportModel>>(this.readBytes()) }
|
||||
?.onFailure {
|
||||
logDebug(this::class.qualifiedName + "#load()", it) { "Error while decoding ${cacheFile.absolutePathString()}" }
|
||||
}
|
||||
?.getOrNull()
|
||||
?.let { emptyMap() }
|
||||
?: emptyMap()
|
||||
|
||||
override fun dispose() {
|
||||
cacheFile.writeBytes(ProtoBuf.encodeToByteArray(state))
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTargetDataKey() = ESM_REPORTS_KEY
|
||||
|
||||
override fun importData(
|
||||
toImport: Collection<DataNode<PublicGradleConfigurationReportModel>>,
|
||||
projectData: ProjectData?,
|
||||
project: Project,
|
||||
modelsProvider: IdeModifiableModelsProvider
|
||||
) {
|
||||
project.service<Cache>().state = toImport.associate { it.data.projectDir to it.data }
|
||||
super.importData(toImport, projectData, project, modelsProvider)
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.openapi.externalSystem.model.DataNode
|
||||
import com.intellij.openapi.externalSystem.model.project.ModuleData
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.tooling.GradleConfigurationModelBuilder
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.tooling.GradleConfigurationReportModel
|
||||
import org.gradle.tooling.model.idea.IdeaModule
|
||||
import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension
|
||||
|
||||
class GradleConfigurationResolver : AbstractProjectResolverExtension() {
|
||||
|
||||
override fun getExtraProjectModelClasses(): Set<Class<*>> =
|
||||
setOf(GradleConfigurationReportModel::class.java, Unit::class.java)
|
||||
|
||||
override fun getToolingExtensionsClasses(): Set<Class<*>> =
|
||||
setOf(GradleConfigurationModelBuilder::class.java, Unit::class.java)
|
||||
|
||||
private inline fun <reified T> IdeaModule.getExtraProject(): T? =
|
||||
resolverCtx.getExtraProject(this@getExtraProject, T::class.java)
|
||||
|
||||
override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode<ModuleData>) {
|
||||
gradleModule.getExtraProject<GradleConfigurationReportModel>()
|
||||
?.toPublic()
|
||||
?.also { ideModule.createChild(GradleConfigurationReportNodeProcessor.ESM_REPORTS_KEY, it) }
|
||||
super.populateModuleExtraModels(gradleModule, ideModule)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.buildsystem.model.DeclaredDependency
|
||||
import com.intellij.openapi.application.readAction
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.BuildSystemType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ModuleTransformer
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.dependencyDeclarationCallback
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageScope
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.logDebug
|
||||
import org.jetbrains.plugins.gradle.model.ExternalProject
|
||||
import org.jetbrains.plugins.gradle.service.project.data.ExternalProjectDataCache
|
||||
import org.jetbrains.plugins.gradle.settings.GradleExtensionsSettings
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import java.io.File
|
||||
|
||||
internal class GradleModuleTransformer : ModuleTransformer {
|
||||
|
||||
private object Handler {
|
||||
|
||||
fun findDependencyElementIndex(dependency: DeclaredDependency): DependencyDeclarationIndexes? {
|
||||
val artifactId = dependency.coordinates.artifactId ?: return null
|
||||
val groupId = dependency.coordinates.groupId ?: return null
|
||||
val scope = dependency.unifiedDependency.scope ?: return null
|
||||
val psiElement = dependency.psiElement ?: return null
|
||||
val isKotlinDependencyInKts = dependency.psiElement?.language?.let { it::class }
|
||||
?.qualifiedName == "org.jetbrains.kotlin.idea.KotlinLanguage"
|
||||
&& groupId == "org.jetbrains.kotlin" && artifactId.startsWith("kotlin-")
|
||||
|
||||
val textToSearchFor = buildString {
|
||||
appendEscapedToRegexp(scope)
|
||||
appendEscapedToRegexp("(")
|
||||
if (isKotlinDependencyInKts) {
|
||||
append("((?:kotlin\\(\"|[\"']org.jetbrains.kotlin:kotlin-)")
|
||||
appendEscapedToRegexp(artifactId.removePrefix("kotlin-"))
|
||||
} else {
|
||||
append("\"(")
|
||||
appendEscapedToRegexp("$groupId:$artifactId")
|
||||
}
|
||||
appendEscapedToRegexp(":")
|
||||
append("?(\\$?\\{?")
|
||||
appendEscapedToRegexp("${dependency.coordinates.version}")
|
||||
append("\\}?")
|
||||
append(")?[\"']\\))\\)?")
|
||||
}
|
||||
|
||||
var currentPsi = psiElement
|
||||
var attempts = 0
|
||||
val compiledRegex = Regex(textToSearchFor)
|
||||
|
||||
while (attempts < 5) { // why 5? usually it's 3 parents up, maybe 2, sometimes 4. 5 is a safe bet.
|
||||
val groups = compiledRegex.find(currentPsi.text)?.groups
|
||||
if (groups != null) {
|
||||
return groups[0]?.range?.first?.let {
|
||||
DependencyDeclarationIndexes(
|
||||
wholeDeclarationStartIndex = currentPsi.textOffset,
|
||||
coordinatesStartIndex = groups[1]?.range?.first?.let { currentPsi.textOffset + it }
|
||||
?: error("Cannot find coordinatesStartIndex for dependency $dependency in ${currentPsi.containingFile.virtualFile.path}"),
|
||||
versionStartIndex = groups[2]?.range?.first?.let { currentPsi.textOffset + it }
|
||||
)
|
||||
}
|
||||
}
|
||||
currentPsi = kotlin.runCatching { currentPsi.parent }.getOrNull() ?: break
|
||||
attempts++
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun transformModules(project: Project, nativeModules: List<Module>): List<PackageSearchModule> {
|
||||
val nativeModulesByExternalProjectId = mutableMapOf<String, Module>()
|
||||
|
||||
val rootProjects = nativeModules
|
||||
.filter { it.isNotGradleSourceSetModule() }
|
||||
.onEach { module ->
|
||||
val externalProjectId = ExternalSystemApiUtil.getExternalProjectId(module)
|
||||
if (externalProjectId != null) nativeModulesByExternalProjectId[externalProjectId] = module
|
||||
}
|
||||
.mapNotNull { findRootExternalProjectOrNull(project, it) }
|
||||
.distinctBy { it.buildDir }
|
||||
|
||||
val projectModulesByPackageSearchDir = mutableMapOf<File, PackageSearchModule>()
|
||||
rootProjects.forEach { it.buildProjectModulesRecursively(projectModulesByPackageSearchDir, nativeModulesByExternalProjectId, project) }
|
||||
|
||||
return projectModulesByPackageSearchDir.values.toList()
|
||||
}
|
||||
|
||||
private suspend fun ExternalProject.buildProjectModulesRecursively(
|
||||
projectModulesByPackageSearchDir: MutableMap<File, PackageSearchModule>,
|
||||
nativeModulesByExternalProjectId: Map<String, Module>,
|
||||
project: Project,
|
||||
parent: PackageSearchModule? = null
|
||||
) {
|
||||
val nativeModule = checkNotNull(nativeModulesByExternalProjectId[id]) { "Couldn't find native module for '$id'" }
|
||||
val buildVirtualFile = buildFile?.absolutePath?.let { LocalFileSystem.getInstance().findFileByPath(it) }
|
||||
|
||||
val buildSystemType = when {
|
||||
buildVirtualFile == null -> BuildSystemType.GRADLE_CONTAINER
|
||||
isKotlinDsl(project, buildVirtualFile) -> BuildSystemType.GRADLE_KOTLIN
|
||||
else -> BuildSystemType.GRADLE_GROOVY
|
||||
}
|
||||
val scopes = GradleExtensionsSettings.getInstance(project)
|
||||
.getExtensionsFor(nativeModule)
|
||||
?.configurations
|
||||
?.keys
|
||||
?.map { PackageScope.from(it) }
|
||||
?: emptyList()
|
||||
|
||||
val packageSearchModule = PackageSearchModule(
|
||||
name = name,
|
||||
nativeModule = nativeModule,
|
||||
parent = parent,
|
||||
buildFile = buildVirtualFile,
|
||||
projectDir = projectDir,
|
||||
buildSystemType = buildSystemType,
|
||||
moduleType = GradleProjectModuleType,
|
||||
availableScopes = scopes,
|
||||
dependencyDeclarationCallback = project.dependencyDeclarationCallback { Handler.findDependencyElementIndex(it) }
|
||||
)
|
||||
|
||||
for (childExternalProject in childProjects.values) {
|
||||
childExternalProject.buildProjectModulesRecursively(
|
||||
projectModulesByPackageSearchDir,
|
||||
nativeModulesByExternalProjectId,
|
||||
project,
|
||||
parent = packageSearchModule
|
||||
)
|
||||
}
|
||||
|
||||
projectModulesByPackageSearchDir[projectDir] = packageSearchModule
|
||||
}
|
||||
|
||||
private suspend fun isKotlinDsl(
|
||||
project: Project,
|
||||
buildVirtualFile: VirtualFile
|
||||
) = readAction { runCatching { PsiManager.getInstance(project).findFile(buildVirtualFile) } }
|
||||
.getOrNull()
|
||||
?.language
|
||||
?.displayName
|
||||
?.contains("kotlin", ignoreCase = true) == true
|
||||
|
||||
private fun Module.isNotGradleSourceSetModule(): Boolean {
|
||||
if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, this)) return false
|
||||
return ExternalSystemApiUtil.getExternalModuleType(this) != GradleConstants.GRADLE_SOURCE_SET_MODULE_TYPE_KEY
|
||||
}
|
||||
|
||||
private fun findRootExternalProjectOrNull(project: Project, module: Module): ExternalProject? {
|
||||
val rootProjectPath = ExternalSystemApiUtil.getExternalRootProjectPath(module)
|
||||
if (rootProjectPath == null) {
|
||||
logDebug(this::class.qualifiedName) {
|
||||
"Root external project was not yet imported, project=${project.projectFilePath}, module=${module.moduleFilePath}"
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
val externalProjectDataCache = ExternalProjectDataCache.getInstance(project)
|
||||
return externalProjectDataCache.getRootExternalProject(rootProjectPath)
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageUpdateInspection
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.GradlePackageVersionRangeInspection.Companion.hasSupportFor
|
||||
|
||||
internal class GradlePackageUpdateInspection : PackageUpdateInspection() {
|
||||
|
||||
override fun getStaticDescription(): String = PackageSearchBundle.message("packagesearch.inspection.upgrade.description.gradle")
|
||||
override fun selectPsiElementIndex(dependencyDeclarationIndexes: DependencyDeclarationIndexes): Int {
|
||||
return dependencyDeclarationIndexes.coordinatesStartIndex
|
||||
}
|
||||
|
||||
override fun shouldCheckFile(file: PsiFile): Boolean =
|
||||
hasSupportFor(file)
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageVersionRangeInspection
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ProjectModuleType
|
||||
|
||||
internal class GradlePackageVersionRangeInspection : PackageVersionRangeInspection() {
|
||||
|
||||
companion object {
|
||||
private const val FILE_TYPE_GROOVY = "groovy"
|
||||
private const val FILE_TYPE_KOTLIN = "kotlin"
|
||||
private const val EXTENSION_GRADLE = "gradle"
|
||||
private const val EXTENSION_GRADLE_KTS = "gradle.kts"
|
||||
|
||||
fun hasSupportFor(psiFile: PsiFile?): Boolean {
|
||||
// Logic based on com.android.tools.idea.gradle.project.sync.GradleFiles.isGradleFile()
|
||||
val file = psiFile?.virtualFile ?: return false
|
||||
|
||||
val isGroovyFile = FILE_TYPE_GROOVY.equals(psiFile.fileType.name, ignoreCase = true)
|
||||
val isKotlinFile = FILE_TYPE_KOTLIN.equals(psiFile.fileType.name, ignoreCase = true)
|
||||
|
||||
if (!isGroovyFile && !isKotlinFile) return false
|
||||
return file.name.endsWith(EXTENSION_GRADLE, ignoreCase = true) || file.name.endsWith(EXTENSION_GRADLE_KTS, ignoreCase = true)
|
||||
}
|
||||
|
||||
fun hasSupportFor(projectModuleType: ProjectModuleType): Boolean =
|
||||
projectModuleType is GradleProjectModuleType
|
||||
}
|
||||
|
||||
override fun getStaticDescription(): String = PackageSearchBundle.message("packagesearch.inspection.range.description.gradle")
|
||||
|
||||
override fun selectPsiElementIndex(dependencyDeclarationIndexes: DependencyDeclarationIndexes): Int {
|
||||
return dependencyDeclarationIndexes.coordinatesStartIndex
|
||||
}
|
||||
|
||||
override fun shouldCheckFile(file: PsiFile) = hasSupportFor(file)
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ProjectModuleType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.configuration.PackageSearchGradleConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageScope
|
||||
import icons.GradleIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
internal object GradleProjectModuleType : ProjectModuleType {
|
||||
|
||||
override val icon: Icon
|
||||
get() = GradleIcons.Gradle // TODO use KotlinIcons.MPP if it's a K/MP module
|
||||
|
||||
override val packageIcon: Icon
|
||||
get() = GradleIcons.GradleFile // TODO use KotlinIcons.MPP if it's a K/MP module
|
||||
|
||||
override fun defaultScope(project: Project): PackageScope =
|
||||
PackageScope.from(PackageSearchGradleConfiguration.getInstance(project).determineDefaultGradleScope())
|
||||
|
||||
override fun userDefinedScopes(project: Project): List<PackageScope> =
|
||||
PackageSearchGradleConfiguration.getInstance(project).getGradleScopes()
|
||||
.map { PackageScope.from(it) }
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedDependency
|
||||
import com.intellij.openapi.components.service
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.BuildSystemType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ResolvedDependenciesProvider
|
||||
|
||||
class GradleResolvedDependenciesProvider : ResolvedDependenciesProvider {
|
||||
|
||||
override val supportedBuildSystems
|
||||
get() = setOf(BuildSystemType.GRADLE_CONTAINER, BuildSystemType.GRADLE_KOTLIN, BuildSystemType.GRADLE_GROOVY)
|
||||
|
||||
override fun resolvedDependencies(module: PackageSearchModule) =
|
||||
module.nativeModule.project
|
||||
.service<GradleConfigurationReportNodeProcessor.Cache>()
|
||||
.state[module.projectDir.absolutePath]
|
||||
?.configurations
|
||||
?.flatMap { configuration ->
|
||||
configuration.dependencies.map { UnifiedDependency(it.groupId, it.artifactId, it.version, configuration.name) }
|
||||
}
|
||||
?.toList()
|
||||
?: emptyList()
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.BuildSystemType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.tooling.GradleConfigurationReportModel
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
|
||||
internal fun StringBuilder.appendEscapedToRegexp(text: String) =
|
||||
StringUtil.escapeToRegexp(text, this)
|
||||
|
||||
val BuildSystemType.Companion.GRADLE_GROOVY
|
||||
get() = BuildSystemType(name = "GRADLE", language = "groovy", dependencyAnalyzerKey = GradleConstants.SYSTEM_ID)
|
||||
|
||||
val BuildSystemType.Companion.GRADLE_KOTLIN
|
||||
get() = BuildSystemType(name = "GRADLE", language = "kotlin", dependencyAnalyzerKey = GradleConstants.SYSTEM_ID)
|
||||
|
||||
// for gradle modules which only contain another gradle modules (in other words,for modules without its own build file)
|
||||
val BuildSystemType.Companion.GRADLE_CONTAINER
|
||||
get() = BuildSystemType(name = "GRADLE", language = "any", dependencyAnalyzerKey = GradleConstants.SYSTEM_ID)
|
||||
|
||||
internal fun GradleConfigurationReportModel.toPublic() = PublicGradleConfigurationReportModel(
|
||||
projectDir,
|
||||
configurations.map {
|
||||
PublicGradleConfigurationReportModel.Configuration(
|
||||
it.name,
|
||||
it.dependencies.map { PublicGradleConfigurationReportModel.Dependency(it.groupId, it.artifactId, it.version) }
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PublicGradleConfigurationReportModel(
|
||||
val projectDir: String,
|
||||
val configurations: List<Configuration>
|
||||
) {
|
||||
|
||||
@Serializable
|
||||
data class Configuration(
|
||||
val name: String,
|
||||
val dependencies: List<Dependency>
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Dependency(
|
||||
val groupId: String,
|
||||
val artifactId: String,
|
||||
val version: String
|
||||
)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.configuration
|
||||
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.addSearchConfigurationMap
|
||||
|
||||
internal class GradleSearchableOptionContributor : SearchableOptionContributor() {
|
||||
|
||||
override fun processOptions(processor: SearchableOptionProcessor) {
|
||||
// Make settings searchable
|
||||
addSearchConfigurationMap(
|
||||
processor,
|
||||
"gradle", "configuration"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.configuration
|
||||
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.xmlb.annotations.OptionTag
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
@State(
|
||||
name = "PackageSearchGradleConfiguration",
|
||||
storages = [(Storage(PackageSearchGeneralConfiguration.StorageFileName))],
|
||||
)
|
||||
internal class PackageSearchGradleConfiguration : BaseState(), PersistentStateComponent<PackageSearchGradleConfiguration> {
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(project: Project) = project.service<PackageSearchGradleConfiguration>()
|
||||
}
|
||||
|
||||
override fun getState(): PackageSearchGradleConfiguration = this
|
||||
|
||||
override fun loadState(state: PackageSearchGradleConfiguration) {
|
||||
this.copyFrom(state)
|
||||
}
|
||||
|
||||
@get:OptionTag("GRADLE_SCOPES")
|
||||
var gradleScopes by string(PackageSearchGradleConfigurationDefaults.GradleScopes)
|
||||
|
||||
@get:OptionTag("GRADLE_SCOPES_DEFAULT")
|
||||
var defaultGradleScope by string(PackageSearchGradleConfigurationDefaults.GradleDefaultScope)
|
||||
|
||||
@get:OptionTag("UPDATE_SCOPES_ON_USE")
|
||||
var updateScopesOnUsage by property(true)
|
||||
|
||||
fun determineDefaultGradleScope(): String =
|
||||
if (!defaultGradleScope.isNullOrEmpty()) {
|
||||
defaultGradleScope!!
|
||||
} else {
|
||||
PackageSearchGradleConfigurationDefaults.GradleDefaultScope
|
||||
}
|
||||
|
||||
fun addGradleScope(scope: String) {
|
||||
val currentScopes = getGradleScopes()
|
||||
if (!currentScopes.contains(scope)) {
|
||||
gradleScopes = currentScopes.joinToString(",") + ",$scope"
|
||||
this.incrementModificationCount()
|
||||
}
|
||||
}
|
||||
|
||||
fun getGradleScopes(): List<String> {
|
||||
var scopes = gradleScopes.orEmpty().split(",", ";", "\n")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
|
||||
if (scopes.isEmpty()) {
|
||||
scopes = PackageSearchGradleConfigurationDefaults.GradleScopes.split(",", ";", "\n")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
}
|
||||
return scopes
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.configuration
|
||||
|
||||
internal object PackageSearchGradleConfigurationDefaults {
|
||||
|
||||
const val GradleScopes = "api,implementation,testImplementation,annotationProcessor,kapt"
|
||||
const val GradleDefaultScope = "implementation"
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.configuration.ui
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ConfigurableContributor
|
||||
|
||||
internal class GradleConfigurableContributor(private val project: Project) : ConfigurableContributor {
|
||||
|
||||
override fun createDriver() = GradleConfigurableContributorDriver(project)
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.configuration.ui
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.RelativeFont
|
||||
import com.intellij.ui.TitledSeparator
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.AnalyticsAwareConfigurableContributorDriver
|
||||
import com.jetbrains.packagesearch.intellij.plugin.fus.PackageSearchEventsLogger
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.configuration.PackageSearchGradleConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.gradle.configuration.PackageSearchGradleConfigurationDefaults
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.PackageSearchUI
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.util.addOnTextChangedListener
|
||||
import java.awt.event.ItemEvent
|
||||
|
||||
internal class GradleConfigurableContributorDriver(project: Project) : AnalyticsAwareConfigurableContributorDriver {
|
||||
|
||||
private var isScopesModified: Boolean = false
|
||||
private var isDefaultScopeModified: Boolean = false
|
||||
private var isUpdateScopesModified: Boolean = false
|
||||
|
||||
private val configuration = PackageSearchGradleConfiguration.getInstance(project)
|
||||
|
||||
private val gradleScopesEditor = PackageSearchUI.textField {
|
||||
addOnTextChangedListener {
|
||||
isScopesModified = text.normalizeScopesList() != configuration.gradleScopes
|
||||
}
|
||||
}
|
||||
|
||||
private val gradleDefaultScopeEditor = PackageSearchUI.textField {
|
||||
addOnTextChangedListener {
|
||||
isDefaultScopeModified = text.trim() != configuration.defaultGradleScope
|
||||
}
|
||||
}
|
||||
|
||||
private val updateScopesOnUsageEditor =
|
||||
PackageSearchUI.checkBox(PackageSearchBundle.message("packagesearch.configuration.update.scopes.on.usage")) {
|
||||
addItemListener {
|
||||
val newIsSelected = it.stateChange == ItemEvent.SELECTED
|
||||
isUpdateScopesModified = newIsSelected != configuration.updateScopesOnUsage
|
||||
}
|
||||
}
|
||||
|
||||
override fun contributeUserInterface(builder: FormBuilder) {
|
||||
// Gradle configurations
|
||||
builder.addComponent(
|
||||
TitledSeparator(PackageSearchBundle.message("packagesearch.configuration.gradle.title")),
|
||||
0
|
||||
)
|
||||
builder.addLabeledComponent(
|
||||
PackageSearchBundle.message("packagesearch.configuration.gradle.configurations"),
|
||||
gradleScopesEditor
|
||||
)
|
||||
builder.addComponentToRightColumn(
|
||||
RelativeFont.TINY.install(
|
||||
RelativeFont.ITALIC.install(
|
||||
PackageSearchUI.createLabel(PackageSearchBundle.message("packagesearch.configuration.gradle.configurations.comma.separated"))
|
||||
)
|
||||
)
|
||||
)
|
||||
builder.addComponentToRightColumn(updateScopesOnUsageEditor)
|
||||
builder.addLabeledComponent(
|
||||
PackageSearchBundle.message("packagesearch.configuration.gradle.configurations.default"),
|
||||
gradleDefaultScopeEditor
|
||||
)
|
||||
}
|
||||
|
||||
override fun isModified(): Boolean = isScopesModified || isDefaultScopeModified || isUpdateScopesModified
|
||||
|
||||
override fun reset() {
|
||||
gradleScopesEditor.text = configuration.getGradleScopes().joinToString(", ")
|
||||
updateScopesOnUsageEditor.isSelected = configuration.updateScopesOnUsage
|
||||
gradleDefaultScopeEditor.text = configuration.determineDefaultGradleScope()
|
||||
|
||||
isScopesModified = false
|
||||
isDefaultScopeModified = false
|
||||
isUpdateScopesModified = false
|
||||
}
|
||||
|
||||
override fun restoreDefaults() {
|
||||
val defaultScopesText = PackageSearchGradleConfigurationDefaults.GradleScopes.replace(",", ", ")
|
||||
isScopesModified = gradleScopesEditor.text != defaultScopesText
|
||||
gradleScopesEditor.text = defaultScopesText
|
||||
|
||||
val defaultUpdateScopes = true
|
||||
isUpdateScopesModified = updateScopesOnUsageEditor.isSelected != defaultUpdateScopes
|
||||
updateScopesOnUsageEditor.isSelected = defaultUpdateScopes
|
||||
|
||||
val defaultGradleDefaultScopeName = PackageSearchGradleConfigurationDefaults.GradleDefaultScope
|
||||
isDefaultScopeModified = gradleDefaultScopeEditor.text != defaultGradleDefaultScopeName
|
||||
gradleDefaultScopeEditor.text = defaultGradleDefaultScopeName
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
configuration.gradleScopes = gradleScopesEditor.text.normalizeScopesList()
|
||||
configuration.updateScopesOnUsage = updateScopesOnUsageEditor.isSelected
|
||||
configuration.defaultGradleScope = gradleDefaultScopeEditor.text.trim()
|
||||
|
||||
isScopesModified = false
|
||||
isDefaultScopeModified = false
|
||||
isUpdateScopesModified = false
|
||||
}
|
||||
|
||||
private fun String.normalizeScopesList() =
|
||||
split(",")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
.joinToString(",")
|
||||
|
||||
override fun provideApplyEventAnalyticsData(): List<EventPair<*>> {
|
||||
val hasChangedDefaultScope = configuration.defaultGradleScope != PackageSearchGradleConfigurationDefaults.GradleDefaultScope
|
||||
return listOf(
|
||||
PackageSearchEventsLogger.preferencesGradleScopeCountField.with(configuration.getGradleScopes().size),
|
||||
PackageSearchEventsLogger.preferencesUpdateScopesOnUsageField.with(configuration.updateScopesOnUsage),
|
||||
PackageSearchEventsLogger.preferencesDefaultGradleScopeChangedField.with(hasChangedDefaultScope),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.gradle.dependency.analyzer
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedCoordinates
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerView
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.jetbrains.packagesearch.intellij.plugin.dependency.analyzer.DependencyAnalyzerGoToPackageSearchAction
|
||||
import org.jetbrains.plugins.gradle.dependency.analyzer.getParentModule
|
||||
import org.jetbrains.plugins.gradle.dependency.analyzer.getUnifiedCoordinates
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants.SYSTEM_ID
|
||||
|
||||
class GradleDependencyAnalyzerGoToPackageSearchAction : DependencyAnalyzerGoToPackageSearchAction() {
|
||||
|
||||
override val systemId: ProjectSystemId = SYSTEM_ID
|
||||
|
||||
override fun getModule(e: AnActionEvent): Module? {
|
||||
val project = e.getData(CommonDataKeys.PROJECT) ?: return null
|
||||
val dependency = e.getData(DependencyAnalyzerView.DEPENDENCY) ?: return null
|
||||
return getParentModule(project, dependency)
|
||||
}
|
||||
|
||||
override fun getUnifiedCoordinates(e: AnActionEvent): UnifiedCoordinates? {
|
||||
val dependency = e.getData(DependencyAnalyzerView.DEPENDENCY) ?: return null
|
||||
return getUnifiedCoordinates(dependency)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="jetbrains-annotations" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.gradle.toolingExtension" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,2 +0,0 @@
|
||||
# Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
com.jetbrains.packagesearch.intellij.plugin.gradle.tooling.GradleConfigurationModelBuilder
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle.tooling;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.gradle.tooling.AbstractModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.tooling.Message;
|
||||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GradleConfigurationModelBuilder extends AbstractModelBuilderService {
|
||||
|
||||
@Override
|
||||
public GradleConfigurationReportModel buildAll(@NotNull String modelName, Project project, @NotNull ModelBuilderContext context) {
|
||||
|
||||
List<GradleConfigurationReportModel.Configuration> configurations =
|
||||
new ArrayList<>(project.getConfigurations().size());
|
||||
|
||||
for (Configuration configuration : project.getConfigurations()) {
|
||||
|
||||
List<GradleConfigurationReportModel.Dependency> dependencies =
|
||||
new ArrayList<>(configuration.getDependencies().size());
|
||||
|
||||
for (Dependency dependency : configuration.getDependencies()) {
|
||||
String group = dependency.getGroup();
|
||||
String version = dependency.getVersion();
|
||||
|
||||
if (group == null || version == null) continue;
|
||||
|
||||
dependencies.add(new GradleConfigurationReportModelImpl.DependencyImpl(group, dependency.getName(), version));
|
||||
}
|
||||
configurations.add(new GradleConfigurationReportModelImpl.ConfigurationImpl(configuration.getName(), dependencies));
|
||||
}
|
||||
|
||||
return new GradleConfigurationReportModelImpl(project.getProjectDir().getAbsolutePath(), configurations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(String modelName) {
|
||||
return modelName.equals(GradleConfigurationReportModel.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportErrorMessage(
|
||||
@NotNull String modelName,
|
||||
@NotNull Project project,
|
||||
@NotNull ModelBuilderContext context,
|
||||
@NotNull Exception exception
|
||||
) {
|
||||
context.getMessageReporter().createMessage()
|
||||
.withGroup(this)
|
||||
.withKind(Message.Kind.WARNING)
|
||||
.withTitle("Gradle import errors")
|
||||
.withText(String.format(
|
||||
"Unable to import resolved versions from configurations in project ''%s'' for the Dependencies toolwindow.",
|
||||
project.getName()
|
||||
))
|
||||
.withException(exception)
|
||||
.reportMessage(project);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle.tooling;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public interface GradleConfigurationReportModel extends Serializable {
|
||||
|
||||
String getProjectDir();
|
||||
List<Configuration> getConfigurations();
|
||||
|
||||
interface Configuration extends Serializable {
|
||||
String getName();
|
||||
List<Dependency> getDependencies();
|
||||
}
|
||||
|
||||
interface Dependency extends Serializable {
|
||||
String getGroupId();
|
||||
String getArtifactId();
|
||||
String getVersion();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.gradle.tooling;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GradleConfigurationReportModelImpl implements GradleConfigurationReportModel {
|
||||
|
||||
private final String projectDir;
|
||||
private final List<Configuration> configurations;
|
||||
|
||||
public GradleConfigurationReportModelImpl(String projectDir, List<Configuration> configurations) {
|
||||
this.projectDir = projectDir;
|
||||
this.configurations = configurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectDir() {
|
||||
return projectDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Configuration> getConfigurations() {
|
||||
return configurations;
|
||||
}
|
||||
|
||||
static public class DependencyImpl implements GradleConfigurationReportModel.Dependency {
|
||||
|
||||
private final String group;
|
||||
private final String artifact;
|
||||
private final String version;
|
||||
|
||||
public DependencyImpl(String group, String artifact, String version) {
|
||||
this.group = group;
|
||||
this.artifact = artifact;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArtifactId() {
|
||||
return artifact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
static public class ConfigurationImpl implements GradleConfigurationReportModel.Configuration {
|
||||
|
||||
private final String name;
|
||||
private final List<Dependency> dependencies;
|
||||
|
||||
public ConfigurationImpl(String name, List<Dependency> dependencies) {
|
||||
this.name = name;
|
||||
this.dependencies = dependencies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dependency> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi -opt-in=kotlin.ExperimentalStdlibApi -opt-in=kotlinx.coroutines.FlowPreview -opt-in=kotlin.time.ExperimentalTime -opt-in=kotlinx.coroutines.DelicateCoroutinesApi" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="17" />
|
||||
<stringArg name="apiVersion" arg="1.9" />
|
||||
<stringArg name="languageVersion" arg="1.9" />
|
||||
</stringArguments>
|
||||
<arrayArguments>
|
||||
<arrayArg name="pluginClasspaths">
|
||||
<args>$KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar</args>
|
||||
</arrayArg>
|
||||
</arrayArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test-resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test-src" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/http_specs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/pkgs-tests" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="gson" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit5" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit5Params" level="project" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-core" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-json" level="project" />
|
||||
<orderEntry type="library" name="miglayout-swing" level="project" />
|
||||
<orderEntry type="library" name="netty-buffer" level="project" />
|
||||
<orderEntry type="library" name="netty-codec-http" level="project" />
|
||||
<orderEntry type="library" name="package-search-api-models" level="project" />
|
||||
<orderEntry type="library" name="package-search-version-utils" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.builtInServer.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem.dependencyUpdater" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.util.netty" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="module" module-name="intellij.platform.statistics" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
<orderEntry type="module" module-name="intellij.repository.search" />
|
||||
<orderEntry type="module" module-name="intellij.platform.dependenciesToolwindow" />
|
||||
<orderEntry type="library" scope="TEST" name="kotlinx-coroutines-test" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-datetime-jvm" level="project" />
|
||||
<orderEntry type="library" name="caffeine" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.coroutines" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,11 +0,0 @@
|
||||
<idea-plugin package="com.jetbrains.packagesearch.intellij.plugin.kotlin">
|
||||
|
||||
<dependencies>
|
||||
<plugin id="org.jetbrains.kotlin"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<codeInsight.unresolvedReferenceQuickFixProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.kotlin.KotlinPackageSearchUnresolvedReferenceQuickFixProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,68 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.kotlin
|
||||
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiReference
|
||||
import com.jetbrains.packagesearch.intellij.plugin.intentions.PackageSearchUnresolvedReferenceQuickFixProvider
|
||||
|
||||
class KotlinPackageSearchUnresolvedReferenceQuickFixProvider : PackageSearchUnresolvedReferenceQuickFixProvider<PsiReference>() {
|
||||
|
||||
@Suppress("UNCHECKED_CAST") // We need to return a raw PsiReference as it's the common supertype
|
||||
override fun getReferenceClass(): Class<PsiReference> = try {
|
||||
Class.forName("org.jetbrains.kotlin.idea.references.KtSimpleNameReference") as Class<PsiReference>
|
||||
} catch (e: ClassNotFoundException) {
|
||||
// If for whatever reason we can't find the KtSimpleNameReference class, which is on the Kotlin plugin classpath
|
||||
DummyPsiReference::class.java as Class<PsiReference>
|
||||
}
|
||||
|
||||
private class DummyPsiReference : PsiReference {
|
||||
|
||||
override fun getElement(): PsiElement {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun getRangeInElement(): TextRange {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun resolve(): PsiElement? {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun getCanonicalText(): String {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun handleElementRename(newElementName: String): PsiElement {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun bindToElement(element: PsiElement): PsiElement {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun isReferenceTo(element: PsiElement): Boolean {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
|
||||
override fun isSoft(): Boolean {
|
||||
TODO("This is a fakeReference")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="17" />
|
||||
<stringArg name="apiVersion" arg="1.9" />
|
||||
<stringArg name="languageVersion" arg="1.9" />
|
||||
</stringArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.maven" />
|
||||
<orderEntry type="module" module-name="intellij.packageSearch" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem.dependencyUpdater" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-core" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,57 +0,0 @@
|
||||
<idea-plugin package="com.jetbrains.packagesearch.intellij.plugin.maven">
|
||||
|
||||
<dependencies>
|
||||
<plugin id="org.jetbrains.idea.maven"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<!--suppress PluginXmlCapitalization -->
|
||||
<localInspection
|
||||
bundle="messages.packageSearchBundle"
|
||||
enabledByDefault="true"
|
||||
groupKey="packagesearch.inspection.upgrade.group"
|
||||
implementationClass="com.jetbrains.packagesearch.intellij.plugin.maven.MavenPackageUpdateInspection"
|
||||
key="packagesearch.inspection.upgrade.key.maven"
|
||||
hasStaticDescription="true"
|
||||
language="XML"
|
||||
level="WEAK WARNING"/>
|
||||
|
||||
<localInspection
|
||||
bundle="messages.packageSearchBundle"
|
||||
enabledByDefault="true"
|
||||
groupKey="packagesearch.inspection.upgrade.group"
|
||||
implementationClass="com.jetbrains.packagesearch.intellij.plugin.maven.MavenPackageVersionRangeInspection"
|
||||
key="packagesearch.inspection.range.key.maven"
|
||||
hasStaticDescription="true"
|
||||
language="XML"
|
||||
level="WEAK WARNING"/>
|
||||
|
||||
<packagesearch.resolvedDependenciesProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.MavenResolvedDependenciesProvider"/>
|
||||
|
||||
<packagesearch.moduleTransformer
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.MavenModuleTransformer"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.MavenSyncSignalProvider"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.GlobalMavenSettingsChangedSignalProvider"/>
|
||||
|
||||
<packagesearch.configurableContributor
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.configuration.ui.MavenConfigurableContributor"/>
|
||||
|
||||
<search.optionContributor
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.maven.configuration.MavenSearchableOptionContributor"/>
|
||||
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<action id="PackageSearch.Maven.DependencyAnalyzer.GoTo"
|
||||
class="com.jetbrains.packagesearch.intellij.plugin.maven.dependency.analyzer.MavenDependencyAnalyzerGoToPackageSearchAction">
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.openapi.application.readAction
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.pom.Navigatable
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.psi.xml.XmlText
|
||||
import com.intellij.util.asSafely
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.BuildSystemType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ModuleTransformer
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.dependencyDeclarationCallback
|
||||
import com.jetbrains.packagesearch.intellij.plugin.maven.configuration.PackageSearchMavenConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.logDebug
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.parallelMap
|
||||
import org.jetbrains.idea.maven.project.MavenProject
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil
|
||||
|
||||
internal class MavenModuleTransformer : ModuleTransformer {
|
||||
|
||||
override suspend fun transformModules(
|
||||
project: Project,
|
||||
nativeModules: List<Module>
|
||||
): List<PackageSearchModule> =
|
||||
nativeModules.parallelMap { nativeModule ->
|
||||
readAction { runCatching { MavenProjectsManager.getInstance(project).findProject(nativeModule) } }
|
||||
.onFailure { logDebug("MavenModuleTransformer", it) { "Error finding Maven module ${nativeModule.name}" } }
|
||||
.getOrNull()
|
||||
?.toPackageSearchModule(project, nativeModule)
|
||||
}.filterNotNull()
|
||||
|
||||
private suspend fun MavenProject.toPackageSearchModule(
|
||||
project: Project,
|
||||
nativeModule: Module
|
||||
): PackageSearchModule {
|
||||
val buildFile = file
|
||||
return PackageSearchModule(
|
||||
name = name ?: nativeModule.name,
|
||||
nativeModule = nativeModule,
|
||||
parent = null,
|
||||
buildFile = buildFile,
|
||||
projectDir = directoryFile.toNioPath().toFile(),
|
||||
buildSystemType = BuildSystemType.MAVEN,
|
||||
moduleType = MavenProjectModuleType,
|
||||
availableScopes = PackageSearchMavenConfiguration.getInstance(project).getMavenScopes(),
|
||||
dependencyDeclarationCallback = project.dependencyDeclarationCallback { dependency ->
|
||||
val children: Array<PsiElement> = dependency.psiElement.asSafely<XmlTag>()
|
||||
?.children
|
||||
?: return@dependencyDeclarationCallback null
|
||||
val xmlTag = children.filterIsInstance<XmlText>()
|
||||
.find { it is Navigatable && it.canNavigate() }
|
||||
?: return@dependencyDeclarationCallback null
|
||||
DependencyDeclarationIndexes(
|
||||
wholeDeclarationStartIndex = xmlTag.textOffset,
|
||||
coordinatesStartIndex = xmlTag.textOffset,
|
||||
versionStartIndex = children.filterIsInstance<XmlTag>()
|
||||
.find { it.name == "version" }
|
||||
?.children
|
||||
?.filterIsInstance<XmlText>()
|
||||
?.firstOrNull()
|
||||
?.textOffset
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val BuildSystemType.Companion.MAVEN
|
||||
get() = BuildSystemType(name = "MAVEN", language = "xml", dependencyAnalyzerKey = MavenUtil.SYSTEM_ID)
|
||||
@@ -1,33 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageUpdateInspection
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil
|
||||
|
||||
internal class MavenPackageUpdateInspection : PackageUpdateInspection() {
|
||||
|
||||
override fun getStaticDescription(): String = PackageSearchBundle.message("packagesearch.inspection.upgrade.description.maven")
|
||||
override fun selectPsiElementIndex(dependencyDeclarationIndexes: DependencyDeclarationIndexes): Int? {
|
||||
return dependencyDeclarationIndexes.versionStartIndex
|
||||
}
|
||||
|
||||
override fun shouldCheckFile(file: PsiFile) = MavenUtil.isPomFile(file.project, file.virtualFile)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.DependencyDeclarationIndexes
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageVersionRangeInspection
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil
|
||||
|
||||
internal class MavenPackageVersionRangeInspection : PackageVersionRangeInspection() {
|
||||
override fun getStaticDescription(): String = PackageSearchBundle.message("packagesearch.inspection.range.description.maven")
|
||||
override fun selectPsiElementIndex(dependencyDeclarationIndexes: DependencyDeclarationIndexes): Int? {
|
||||
return dependencyDeclarationIndexes.versionStartIndex
|
||||
}
|
||||
|
||||
override fun shouldCheckFile(file: PsiFile) = MavenUtil.isPomFile(file.project, file.virtualFile)
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ProjectModuleType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.maven.configuration.PackageSearchMavenConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageScope
|
||||
import icons.OpenapiIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
internal object MavenProjectModuleType : ProjectModuleType {
|
||||
|
||||
override val icon: Icon
|
||||
get() = OpenapiIcons.RepositoryLibraryLogo
|
||||
|
||||
override val packageIcon: Icon
|
||||
get() = icon
|
||||
|
||||
override fun defaultScope(project: Project): PackageScope =
|
||||
PackageSearchMavenConfiguration.getInstance(project).determineDefaultMavenScope()
|
||||
.let { if (it == "compile") PackageScope.Missing else PackageScope.from(it) }
|
||||
|
||||
override fun userDefinedScopes(project: Project): List<PackageScope> =
|
||||
PackageSearchMavenConfiguration.getInstance(project).getMavenScopes()
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedDependency
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.BuildSystemType
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ResolvedDependenciesProvider
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager
|
||||
|
||||
class MavenResolvedDependenciesProvider : ResolvedDependenciesProvider {
|
||||
|
||||
override val supportedBuildSystems: Set<BuildSystemType>
|
||||
get() = setOf(BuildSystemType.MAVEN)
|
||||
|
||||
override fun resolvedDependencies(module: PackageSearchModule): List<UnifiedDependency> =
|
||||
MavenProjectsManager.getInstance(module.nativeModule.project)
|
||||
.findProject(module.nativeModule)
|
||||
?.dependencies
|
||||
?.map { UnifiedDependency(it.groupId, it.artifactId, it.version, it.scope) }
|
||||
?: emptyList()
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.FileWatcherSignalProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.FlowModuleChangesSignalProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.awaitSmart
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.dumbService
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.logDebug
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.messageBusFlow
|
||||
import org.jetbrains.idea.maven.project.MavenImportListener
|
||||
import org.jetbrains.idea.maven.project.MavenProject
|
||||
import java.nio.file.Paths
|
||||
|
||||
internal class MavenSyncSignalProvider : FlowModuleChangesSignalProvider {
|
||||
|
||||
override fun registerModuleChangesListener(project: Project) =
|
||||
project.messageBusFlow(MavenImportListener.TOPIC) {
|
||||
project.dumbService.awaitSmart()
|
||||
object : MavenImportListener {
|
||||
override fun importFinished(importedProjects: MutableCollection<MavenProject>, newModules: MutableList<Module>) {
|
||||
logDebug("MavenModuleChangesSignalProvider#registerModuleChangesListener#ProjectDataImportListener")
|
||||
trySend(Unit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class GlobalMavenSettingsChangedSignalProvider
|
||||
: FileWatcherSignalProvider(Paths.get(System.getProperty("user.home"), ".m2", "settings.xml"))
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven.configuration
|
||||
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.addSearchConfigurationMap
|
||||
|
||||
internal class MavenSearchableOptionContributor : SearchableOptionContributor() {
|
||||
|
||||
override fun processOptions(processor: SearchableOptionProcessor) {
|
||||
// Make settings searchable
|
||||
addSearchConfigurationMap(
|
||||
processor,
|
||||
"maven", "scope"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven.configuration
|
||||
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.xmlb.annotations.OptionTag
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageScope
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
@State(
|
||||
name = "PackageSearchMavenConfiguration",
|
||||
storages = [(Storage(PackageSearchGeneralConfiguration.StorageFileName))],
|
||||
)
|
||||
internal class PackageSearchMavenConfiguration : BaseState(), PersistentStateComponent<PackageSearchMavenConfiguration> {
|
||||
|
||||
companion object {
|
||||
|
||||
const val DEFAULT_MAVEN_SCOPE = "compile"
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(project: Project) = project.service<PackageSearchMavenConfiguration>()
|
||||
}
|
||||
|
||||
override fun getState(): PackageSearchMavenConfiguration = this
|
||||
|
||||
override fun loadState(state: PackageSearchMavenConfiguration) {
|
||||
this.copyFrom(state)
|
||||
}
|
||||
|
||||
@get:OptionTag("MAVEN_SCOPES_DEFAULT")
|
||||
var defaultMavenScope by string(DEFAULT_MAVEN_SCOPE)
|
||||
|
||||
fun determineDefaultMavenScope() = if (!defaultMavenScope.isNullOrEmpty()) defaultMavenScope!! else DEFAULT_MAVEN_SCOPE
|
||||
|
||||
fun getMavenScopes() = listOf(DEFAULT_MAVEN_SCOPE, "provided", "runtime", "test", "system", "import")
|
||||
.map { PackageScope.from(it) }
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven.configuration.ui
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ConfigurableContributor
|
||||
|
||||
internal class MavenConfigurableContributor(private val project: Project) : ConfigurableContributor {
|
||||
|
||||
override fun createDriver() = MavenConfigurableContributorDriver(project)
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven.configuration.ui
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.RelativeFont
|
||||
import com.intellij.ui.TitledSeparator
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.AnalyticsAwareConfigurableContributorDriver
|
||||
import com.jetbrains.packagesearch.intellij.plugin.fus.PackageSearchEventsLogger
|
||||
import com.jetbrains.packagesearch.intellij.plugin.maven.configuration.PackageSearchMavenConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.PackageSearchUI
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.util.addOnTextChangedListener
|
||||
import javax.swing.JLabel
|
||||
|
||||
internal class MavenConfigurableContributorDriver(project: Project) : AnalyticsAwareConfigurableContributorDriver {
|
||||
|
||||
private var isMavenDefaultScopeChanged: Boolean = false
|
||||
|
||||
private val configuration = PackageSearchMavenConfiguration.getInstance(project)
|
||||
|
||||
private val mavenScopeEditor = PackageSearchUI.textField {
|
||||
addOnTextChangedListener {
|
||||
isMavenDefaultScopeChanged = text != configuration.defaultMavenScope
|
||||
}
|
||||
}
|
||||
|
||||
override fun contributeUserInterface(builder: FormBuilder) {
|
||||
builder.addComponent(
|
||||
TitledSeparator(PackageSearchBundle.message("packagesearch.configuration.maven.title")),
|
||||
0
|
||||
)
|
||||
builder.addLabeledComponent(
|
||||
PackageSearchBundle.message("packagesearch.configuration.maven.scopes.default"),
|
||||
mavenScopeEditor
|
||||
)
|
||||
|
||||
val label = JLabel(
|
||||
" ${PackageSearchBundle.message("packagesearch.configuration.maven.scopes")} " +
|
||||
configuration.getMavenScopes().joinToString(", ")
|
||||
)
|
||||
builder.addComponentToRightColumn(
|
||||
RelativeFont.TINY.install(RelativeFont.ITALIC.install(label))
|
||||
)
|
||||
}
|
||||
|
||||
override fun isModified() = isMavenDefaultScopeChanged
|
||||
|
||||
override fun reset() {
|
||||
mavenScopeEditor.text = configuration.determineDefaultMavenScope()
|
||||
isMavenDefaultScopeChanged = false
|
||||
}
|
||||
|
||||
override fun restoreDefaults() {
|
||||
val defaultMavenScope = configuration.determineDefaultMavenScope()
|
||||
isMavenDefaultScopeChanged = mavenScopeEditor.text != defaultMavenScope
|
||||
mavenScopeEditor.text = defaultMavenScope
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
configuration.defaultMavenScope = mavenScopeEditor.text
|
||||
isMavenDefaultScopeChanged = false
|
||||
}
|
||||
|
||||
override fun provideApplyEventAnalyticsData(): List<EventPair<*>> = listOf(
|
||||
PackageSearchEventsLogger.preferencesDefaultMavenScopeChangedField
|
||||
.with(configuration.defaultMavenScope != PackageSearchMavenConfiguration.DEFAULT_MAVEN_SCOPE)
|
||||
)
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.maven.dependency.analyzer
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedCoordinates
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerView
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.jetbrains.packagesearch.intellij.plugin.dependency.analyzer.DependencyAnalyzerGoToPackageSearchAction
|
||||
import org.jetbrains.idea.maven.project.actions.getParentModule
|
||||
import org.jetbrains.idea.maven.project.actions.getUnifiedCoordinates
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil.SYSTEM_ID
|
||||
|
||||
class MavenDependencyAnalyzerGoToPackageSearchAction : DependencyAnalyzerGoToPackageSearchAction() {
|
||||
|
||||
override val systemId: ProjectSystemId = SYSTEM_ID
|
||||
|
||||
override fun getModule(e: AnActionEvent): Module? {
|
||||
val project = e.getData(CommonDataKeys.PROJECT) ?: return null
|
||||
val dependency = e.getData(DependencyAnalyzerView.DEPENDENCY) ?: return null
|
||||
return getParentModule(project, dependency)
|
||||
}
|
||||
|
||||
override fun getUnifiedCoordinates(e: AnActionEvent): UnifiedCoordinates? {
|
||||
val dependency = e.getData(DependencyAnalyzerView.DEPENDENCY) ?: return null
|
||||
return getUnifiedCoordinates(dependency)
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"name": "Package Search",
|
||||
"fixed": false,
|
||||
"ui": [
|
||||
{
|
||||
"key": "PackageSearch.PackageTag.background",
|
||||
"description": "Dependency tag (e.g., 'multiplatform') background color",
|
||||
"source": "",
|
||||
"since": "2022.1"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTag.foreground",
|
||||
"description": "Dependency tag (e.g., 'multiplatform') foreground color",
|
||||
"source": "",
|
||||
"since": "2022.1"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackagesList.rowHeight",
|
||||
"description": "Height (in pixels) of the rows of the packages list",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTag.selectedBackground",
|
||||
"description": "Dependency tag (e.g., 'multiplatform') selected background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTag.selectedForeground",
|
||||
"description": "Dependency tag (e.g., 'multiplatform') selected foreground color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTag.hoverBackground",
|
||||
"description": "Dependency tag (e.g., 'multiplatform') hover background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTagSelected.foreground",
|
||||
"description": "[DEPRECATED: use PackageTag.selectedForeground] Dependency tag (e.g., 'multiplatform') selected foreground color",
|
||||
"source": "",
|
||||
"since": "2022.1",
|
||||
"deprecated": true
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.PackageTagSelected.background",
|
||||
"description": "[DEPRECATED: use PackageTag.selectedBackground] Dependency tag (e.g., 'multiplatform') selected background color",
|
||||
"source": "",
|
||||
"since": "2022.1",
|
||||
"deprecated": true
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.background",
|
||||
"description": "Search results row background color",
|
||||
"source": "",
|
||||
"since": "2022.1"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.hoverBackground",
|
||||
"description": "Search results row hover background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.PackageTag.background",
|
||||
"description": "Search result dependency tag (e.g., 'multiplatform') background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.PackageTag.foreground",
|
||||
"description": "Search result dependency tag (e.g., 'multiplatform') foreground color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.PackageTag.selectedBackground",
|
||||
"description": "Search result dependency tag (e.g., 'multiplatform') selected background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.PackageTag.selectedForeground",
|
||||
"description": "Search result dependency tag (e.g., 'multiplatform') selected foreground color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
},
|
||||
{
|
||||
"key": "PackageSearch.SearchResult.PackageTag.hoverBackground",
|
||||
"description": "Search result dependency tag (e.g., 'multiplatform') hover background color",
|
||||
"source": "",
|
||||
"since": "2022.3"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
<idea-plugin package="com.jetbrains.packagesearch">
|
||||
<id>com.jetbrains.packagesearch.intellij-plugin</id>
|
||||
<name>Package Search</name>
|
||||
<vendor>JetBrains</vendor>
|
||||
<resource-bundle>messages.packageSearchBundle</resource-bundle>
|
||||
<description><![CDATA[
|
||||
Find and manage dependencies for JVM and Kotlin Multiplatform projects.
|
||||
<br>
|
||||
Supports Maven and Gradle projects.
|
||||
<br>
|
||||
<a href="https://package-search.jetbrains.com">Package Search on the web</a><br>
|
||||
]]></description>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.configurableContributor"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.ConfigurableContributor"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.moduleChangesSignalProvider"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.ModuleChangesSignalProvider"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.flowModuleChangesSignalProvider"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.FlowModuleChangesSignalProvider"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.asyncModuleTransformer"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.AsyncModuleTransformer"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.moduleTransformer"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.ModuleTransformer"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.packagesearch.resolvedDependenciesProvider"
|
||||
interface="com.jetbrains.packagesearch.intellij.plugin.extensibility.ResolvedDependenciesProvider"
|
||||
dynamic="true"/>
|
||||
|
||||
</extensionPoints>
|
||||
|
||||
<content>
|
||||
<module name="intellij.packageSearch.gradle"/>
|
||||
<module name="intellij.packageSearch.kotlin"/>
|
||||
<module name="intellij.packageSearch.maven"/>
|
||||
</content>
|
||||
<dependencies>
|
||||
<plugin id="com.intellij.java"/>
|
||||
<plugin id="org.jetbrains.idea.reposearch"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<codeInsight.unresolvedReferenceQuickFixProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.intentions.JavaPackageSearchUnresolvedReferenceQuickFixProvider"/>
|
||||
|
||||
<search.optionContributor
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchSearchableOptionContributor"/>
|
||||
|
||||
<projectConfigurable groupId="build" key="packagesearch.configuration.title" bundle="messages.packageSearchBundle"
|
||||
id="preferences.packagesearch.PackageSearchGeneralConfigurable"
|
||||
instance="com.jetbrains.packagesearch.intellij.plugin.configuration.ui.PackageSearchGeneralConfigurable"/>
|
||||
|
||||
<packagesearch.flowModuleChangesSignalProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.extensibility.ExternalProjectSignalProvider"/>
|
||||
|
||||
<dependenciesToolWindow.tabProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.PackagesListPanelProvider"/>
|
||||
|
||||
<dependenciesToolWindow.tabProvider
|
||||
implementation="com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.RepositoryManagementPanelProvider"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.ui.services.DependencyNavigationService"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.data.PackageSearchProjectCachesService"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.data.PackageSearchProjectService"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.lifecycle.PackageSearchLifecycleScope"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.PackagesListPanelProvider$PanelContainer"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.panels.management.PackageManagementPanel$UIState"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.ui.PkgsUiCommandsService"
|
||||
client="all"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.data.LoadingContainer"
|
||||
client="all"/>
|
||||
|
||||
<projectService
|
||||
serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.RepositoryManagementPanelProvider$PanelContainer"
|
||||
client="all"/>
|
||||
|
||||
<applicationService serviceImplementation="com.jetbrains.packagesearch.intellij.plugin.data.PackageSearchCachesService"
|
||||
client="all"/>
|
||||
|
||||
<recoveryAction implementation="com.jetbrains.packagesearch.intellij.plugin.extensibility.DeletePackageSearchProjectCachesAction"/>
|
||||
|
||||
<recoveryAction implementation="com.jetbrains.packagesearch.intellij.plugin.extensibility.DeletePackageSearchCachesAction"/>
|
||||
|
||||
<registryKey id="packagesearch.plugin.debug.logging"
|
||||
key="packagesearch.plugin.debug.logging"
|
||||
defaultValue="false"
|
||||
description="Emit in-depth debug logging (warning: very spammy, only useful for debugging data flow issues). Make sure you have this line in Help | Diagnostic Tools | Debug Log Settings: '#com.jetbrains.packagesearch.intellij-plugin:trace'."
|
||||
restartRequired="false"/>
|
||||
|
||||
<registryKey id="packagesearch.plugin.repositories.tab"
|
||||
key="packagesearch.plugin.repositories.tab"
|
||||
defaultValue="false"
|
||||
description="Display the Repositories tab in the Package Search toolwindow. It may not work correctly, or at all."
|
||||
restartRequired="false"/>
|
||||
|
||||
<registryKey id="packagesearch.plugin.smart.kotlin.multiplatform.checkbox"
|
||||
key="packagesearch.plugin.smart.kotlin.multiplatform.checkbox"
|
||||
defaultValue="false"
|
||||
description="Only display the Kotlin Multiplatform checkbox when at least one supported module has the Kotlin facet applied. When false, it only depends on the Kotlin IntelliJ plugin being enabled."
|
||||
restartRequired="false"/>
|
||||
|
||||
<statistics.counterUsagesCollector
|
||||
implementationClass="com.jetbrains.packagesearch.intellij.plugin.fus.PackageSearchEventsLogger"/>
|
||||
|
||||
<!--suppress PluginXmlCapitalization -->
|
||||
<notificationGroup displayType="BALLOON"
|
||||
id="packagesearch.notification"
|
||||
bundle="messages.packageSearchBundle"
|
||||
key="packagesearch.title"/>
|
||||
|
||||
<themeMetadataProvider path="/META-INF/PackageSearch.themeMetadata.json"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<action id="com.jetbrains.packagesearch.intellij.plugin.actions.AddDependencyAction"
|
||||
class="com.jetbrains.packagesearch.intellij.plugin.actions.AddDependencyAction"
|
||||
icon="com.jetbrains.packagesearch.PackageSearchIcons.Artifact">
|
||||
<add-to-group group-id="GenerateGroup" anchor="first"/>
|
||||
</action>
|
||||
<action id="com.jetbrains.packagesearch.intellij.plugin.actions.PkgsToDAAction"
|
||||
class="com.jetbrains.packagesearch.intellij.plugin.actions.PkgsToDAAction">
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/>
|
||||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -1,18 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
|
||||
<path fill="#6E6E6E" fill-rule="evenodd"
|
||||
d="M17.5,0 L35,9.72222222 L17.5,19.4444444 L0,9.72222222 L17.5,0 Z M31.5,15.5555556 L35,17.5 L17.5,27.2222222 L0,17.5 L3.5,15.5555556 L17.5,23.3333333 L31.5,15.5555556 Z M31.5,23.3333333 L35,25.2777778 L17.5,35 L0,25.2777778 L3.5,23.3333333 L17.5,31.1111111 L31.5,23.3333333 Z"
|
||||
transform="translate(2.5 2.5)"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,18 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
|
||||
<path fill="#AFB1B3" fill-rule="evenodd"
|
||||
d="M17.5,0 L35,9.72222222 L17.5,19.4444444 L0,9.72222222 L17.5,0 Z M31.5,15.5555556 L35,17.5 L17.5,27.2222222 L0,17.5 L3.5,15.5555556 L17.5,23.3333333 L31.5,15.5555556 Z M31.5,23.3333333 L35,25.2777778 L17.5,35 L0,25.2777778 L3.5,23.3333333 L17.5,31.1111111 L31.5,23.3333333 Z"
|
||||
transform="translate(2.5 2.5)"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,17 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m8 1 7 3.88888889-7 3.88888889-7-3.88888889zm5.6 6.22222222 1.4.77777778-7 3.8888889-7-3.8888889 1.4-.77777778 5.6 3.11111108zm0 3.11111108 1.4.7777778-7 3.8888889-7-3.8888889 1.4-.7777778 5.6 3.1111111z"
|
||||
fill="#6e6e6e" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,20 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg height="13" viewBox="0 0 13 13" width="13" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path d="m0-1h14v14h-14z"/>
|
||||
<path d="m6.5.375 6.125 3.40277778-6.125 3.40277778-6.125-3.40277778zm4.9 5.44444444 1.225.68055556-6.125 3.40277778-6.125-3.40277778 1.225-.68055556 4.9 2.72222223zm0 2.72222223 1.225.68055555-6.125 3.40277778-6.125-3.40277778 1.225-.68055555 4.9 2.72222223z"
|
||||
fill="#6e6e6e"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,17 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg height="13" viewBox="0 0 13 13" width="13" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m6.5.375 6.125 3.40277778-6.125 3.40277778-6.125-3.40277778zm4.9 5.44444444 1.225.68055556-6.125 3.40277778-6.125-3.40277778 1.225-.68055556 4.9 2.72222223zm0 2.72222223 1.225.68055555-6.125 3.40277778-6.125-3.40277778 1.225-.68055555 4.9 2.72222223z"
|
||||
fill="#afb1b3" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,17 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m8 1 7 3.88888889-7 3.88888889-7-3.88888889zm5.6 6.22222222 1.4.77777778-7 3.8888889-7-3.8888889 1.4-.77777778 5.6 3.11111108zm0 3.11111108 1.4.7777778-7 3.8888889-7-3.8888889 1.4-.7777778 5.6 3.1111111z"
|
||||
fill="#afb1b3" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,16 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg fill="none" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m3.7002 9.15 2.967 3.15 5.633-8.6" stroke="#6e6e6e" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.3"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 927 B |
@@ -1,16 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg fill="none" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m3.7002 9.15 2.967 3.15 5.633-8.6" stroke="#afb1b3" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.3"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 927 B |
@@ -1,17 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. -->
|
||||
<!-- -->
|
||||
<!-- 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 -->
|
||||
<!-- -->
|
||||
<!-- https://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. -->
|
||||
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m8 1 7 3.88888889-7 3.88888889-7-3.88888889zm5.6 6.22222222 1.4.77777778-7 3.8888889-7-3.8888889 1.4-.77777778 5.6 3.11111108zm0 3.11111108 1.4.7777778-7 3.8888889-7-3.8888889 1.4-.7777778 5.6 3.1111111z"
|
||||
fill="#9aa7b0" fill-opacity=".8" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,181 +0,0 @@
|
||||
action.com.jetbrains.packagesearch.intellij.plugin.actions.AddDependencyAction.description=Add new dependency to the current module
|
||||
action.com.jetbrains.packagesearch.intellij.plugin.actions.AddDependencyAction.text=Add dependency\u2026
|
||||
packagesearch.actions.showDetails.description=Show dependency details
|
||||
packagesearch.actions.showDetails.text=Show Package Details
|
||||
packagesearch.actions.showSettings.description=Show Package Search Settings
|
||||
packagesearch.actions.showSettings.text=Package Search Settings\u2026
|
||||
packagesearch.actions.showToolWindow.text=Go to Package Search
|
||||
packagesearch.actions.showToolWindow.not.found.module=Parent module in the package search is not found
|
||||
packagesearch.actions.showToolWindow.not.found.dependency=Dependency in the package search is not found
|
||||
|
||||
packagesearch.configuration.automatically.add.repositories=Automatically add missing repositories when adding or changing dependencies
|
||||
packagesearch.configuration.general=General
|
||||
packagesearch.configuration.gradle.configurations.comma.separated=Comma-separated list of configurations
|
||||
packagesearch.configuration.gradle.configurations.default=Default Gradle configuration:
|
||||
packagesearch.configuration.gradle.configurations=Gradle configurations:
|
||||
packagesearch.configuration.gradle.title=Gradle
|
||||
packagesearch.configuration.maven.scopes.default=Default Maven scope:
|
||||
packagesearch.configuration.maven.scopes=Maven scopes:
|
||||
packagesearch.configuration.maven.title=Maven
|
||||
packagesearch.configuration.restore.defaults=Restore defaults
|
||||
packagesearch.configuration.recovery.caches=Delete Package Search project caches
|
||||
packagesearch.configuration.recovery.caches.global=Delete Package Search global caches
|
||||
packagesearch.configuration.title=Package Search
|
||||
packagesearch.configuration.update.scopes.on.usage=Save configurations to this list when using them for the first time
|
||||
packagesearch.inspection.range.key.gradle=Check for ranges in dependency versions (Gradle)
|
||||
packagesearch.inspection.range.key.maven=Check for ranges in dependency versions (Maven)
|
||||
packagesearch.inspection.range.description.gradle=Detects whether a dependency version is a range in Gradle projects
|
||||
packagesearch.inspection.range.description.maven=Detects whether a dependency version is a range in Maven projects
|
||||
packagesearch.inspection.upgrade.description.gradle=Detects when a newer version is available for a dependency in Gradle projects
|
||||
packagesearch.inspection.upgrade.description.maven=Detects when a newer version is available for a dependency in Maven projects
|
||||
packagesearch.inspection.upgrade.description=Package ''{0}'' can be upgraded to version ''{1}''
|
||||
packagesearch.inspection.upgrade.excluded.dependencies=Excluded dependencies:
|
||||
packagesearch.inspection.upgrade.group=Package Search
|
||||
packagesearch.inspection.upgrade.key.gradle=Check for new dependency versions (Gradle)
|
||||
packagesearch.inspection.upgrade.key.maven=Check for new dependency versions (Maven)
|
||||
packagesearch.inspection.upgrade.range.withVersion=<html><body>Version ''{0}'' declaration can cause unforeseen issues at build time, because it does not pin a specific version of the dependency. Depending on when and where a build is made, the resulting artifact may contain different versions of this dependency, making builds non-deterministic. See <a href="https://reproducible-builds.org/">https://reproducible-builds.org/</a> for further information.</html></body>
|
||||
packagesearch.inspection.upgrade.range=<html><body>This version declaration can cause unforeseen issues at build time, because it does not pin a specific version of the dependency. Depending on when and where a build is made, the resulting artifact may contain different versions of this dependency, making builds non-deterministic. See <a href="https://reproducible-builds.org/">https://reproducible-builds.org/</a> for further information.</html></body>
|
||||
|
||||
packagesearch.logging.error=An error has occurred while logging an analytics event: ''{0}''. This error doesn''t impact the plugin functionality. Use Exception Analyzer to report this error.
|
||||
|
||||
packagesearch.operation.error.gradle.missing.configuration=Missing Gradle configuration
|
||||
packagesearch.operation.error.subtitle.someFailed=Some operations failed
|
||||
packagesearch.operation.verb.change=change
|
||||
packagesearch.operation.verb.install=install
|
||||
packagesearch.operation.verb.remove=remove
|
||||
packagesearch.package.copyableInfo.availableVersions=Available versions:
|
||||
packagesearch.package.copyableInfo.githubStats.forks={0} forks
|
||||
packagesearch.package.copyableInfo.githubStats.stars={0} stars
|
||||
packagesearch.package.copyableInfo.githubStats=GitHub statistics:
|
||||
packagesearch.package.copyableInfo.installedVersions=Installed versions:
|
||||
packagesearch.package.copyableInfo.stackOverflowTags=StackOverflow tags:
|
||||
packagesearch.quickfix.packagesearch.action=Search for dependency\u2026
|
||||
action.com.jetbrains.packagesearch.intellij.plugin.actions.PkgsToDAAction.text=Show in Dependency Analyzer\u2026
|
||||
action.com.jetbrains.packagesearch.intellij.plugin.actions.PkgsToDAAction.description=Opens the Dependency Analyzer tab and highlights the selected dependency in the Dependency view. If needed, you will disambiguate the module with a popup.
|
||||
packagesearch.quickfix.packagesearch.action.da.withIdentifier=Show ''{0}'' in Dependency Analyzer\u2026
|
||||
packagesearch.quickfix.packagesearch.action.da.description.withParam=Opens the Dependency Analyzer tab and highlights ''{0}'' in the view. If needed, you will disambiguate the module with a popup.
|
||||
packagesearch.quickfix.packagesearch.action.da.selectModule=Select module for ''{0}'':
|
||||
packagesearch.quickfix.packagesearch.family=Package Search
|
||||
packagesearch.quickfix.upgrade.action=Upgrade ''{0}'' to version ''{1}''
|
||||
packagesearch.quickfix.upgrade.exclude.action=Don''t check for ''{0}'' updates
|
||||
packagesearch.quickfix.upgrade.exclude.family=Skip dependency upgrade
|
||||
packagesearch.quickfix.upgrade.family=Upgrade dependency
|
||||
packagesearch.repository.canBeSearched=(indexed in Package Search)
|
||||
packagesearch.repository.copyableInfo.id=ID: {0}
|
||||
packagesearch.repository.copyableInfo.name=Name: {0}
|
||||
packagesearch.repository.copyableInfo.url=URL: {0}
|
||||
packagesearch.repository.willBeAddedOnInstall={0} repository will be added.
|
||||
packagesearch.repository.willBeAddedOnInstall.withModules={0} repository will be added to {1}.
|
||||
packagesearch.restService.readyForInstallation=The dependency is ready for installation. Select a module to add the dependency to.
|
||||
|
||||
packagesearch.search.client.error.no.versions.for.range=Requested range should not contain version numbers.
|
||||
packagesearch.search.client.error.too.many.requests.for.range=The requested range is larger than the maximum allowed items (should be <= 25).
|
||||
packagesearch.search.client.response.body.is.empty=Response body is empty
|
||||
packagesearch.search.hint=Search for installed and available dependencies
|
||||
|
||||
packagesearch.terminology.dependency.configuration=Configuration
|
||||
packagesearch.terminology.dependency.scope=Scope
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.android_jvm=Android JVM
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.common=Common
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.js=Javascript
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.jvm=JVM
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.native=Native
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.android_arm32=Android (arm32)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.android_arm64=Android (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.android_x64=Android (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.android_x86=Android (x86)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.browser=browser
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.ios_arm32=iOS (arm32)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.ios_arm64=iOS (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.ios_x64=iOS (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.linux_arm32_hfp=Linux (arm32_hfp)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.linux_arm64=Linux (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.linux_mips32=Linux (mips32)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.linux_mipsel32=Linux (mips32 little endian)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.linux_x64=Linux (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.macos_arm64=macOS (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.macos_x64=macOS (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.mingw_x64=mingw (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.mingw_x86=mingw (x86)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.node=Node.js
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.tvos_arm64=tvOS (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.tvos_x64=tvOS (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.wasm32=WebAssembly (wasm32)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.watchos_arm32=watchOS (arm32)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.watchos_arm64=watchOS (arm64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.watchos_x64=watchOS (x64)
|
||||
packagesearch.terminology.kotlinMultiplatform.platform.target.watchos_x86=watchOS (x86)
|
||||
packagesearch.terminology.kotlinMultiplatform.tooltip=Kotlin Multiplatform
|
||||
packagesearch.terminology.kotlinMultiplatform=multiplatform
|
||||
|
||||
packagesearch.title=Package Search
|
||||
|
||||
packagesearch.ui.loading=Processing build files for dependencies analysis\u2026
|
||||
packagesearch.ui.modifyingDependencies=Modifying project ''{0}''
|
||||
packagesearch.ui.resume=Resume
|
||||
packagesearch.ui.missingScope=[default]
|
||||
|
||||
packagesearch.ui.toolwindow.actions.add.text=Add
|
||||
packagesearch.ui.toolwindow.actions.remove.text=Remove
|
||||
packagesearch.ui.toolwindow.actions.upgrade.text=Upgrade
|
||||
packagesearch.ui.toolwindow.actions.upgradeAll.text.withCount=Upgrade all ({0})
|
||||
packagesearch.ui.toolwindow.actions.upgradeAll.text=Upgrade all
|
||||
|
||||
packagesearch.ui.toolwindow.allModules=All Modules
|
||||
|
||||
packagesearch.ui.toolwindow.link.documentation.capitalized=Documentation
|
||||
packagesearch.ui.toolwindow.link.documentation=documentation
|
||||
packagesearch.ui.toolwindow.link.github.capitalized=GitHub
|
||||
packagesearch.ui.toolwindow.link.github=GitHub
|
||||
packagesearch.ui.toolwindow.link.license.capitalized=License
|
||||
packagesearch.ui.toolwindow.link.license=license
|
||||
packagesearch.ui.toolwindow.link.projectSite.capitalized=Project site
|
||||
packagesearch.ui.toolwindow.link.projectSite=project site
|
||||
packagesearch.ui.toolwindow.link.readme.capitalized=Readme
|
||||
packagesearch.ui.toolwindow.link.readme=readme
|
||||
packagesearch.ui.toolwindow.link.scm.capitalized=Sources
|
||||
packagesearch.ui.toolwindow.link.scm=Sources
|
||||
packagesearch.ui.toolwindow.modulesTree.empty=No modules to display.
|
||||
packagesearch.ui.missingVersion=[not set]
|
||||
packagesearch.ui.toolwindow.packages.actions.set=Set
|
||||
packagesearch.ui.toolwindow.packages.actions.install=Add
|
||||
packagesearch.ui.toolwindow.packages.actions.upgrade=Upgrade
|
||||
packagesearch.ui.toolwindow.packages.columns.actions=Actions
|
||||
packagesearch.ui.toolwindow.packages.columns.name=Dependency name
|
||||
packagesearch.ui.toolwindow.packages.columns.scope=Scope
|
||||
packagesearch.ui.toolwindow.packages.columns.score=Score
|
||||
packagesearch.ui.toolwindow.packages.columns.versions=Versions
|
||||
packagesearch.ui.toolwindow.packages.details.emptyState=No dependency selected
|
||||
packagesearch.ui.toolwindow.packages.details.noData=No information is available on Package Search
|
||||
packagesearch.ui.toolwindow.packages.details.info.author=Author: {0}
|
||||
packagesearch.ui.toolwindow.packages.details.info.authors=Authors: {0}
|
||||
packagesearch.ui.toolwindow.packages.details.info.kotlinPlatforms=Supported Kotlin platforms:
|
||||
packagesearch.ui.toolwindow.packages.details.info.license=License: {0}
|
||||
packagesearch.ui.toolwindow.packages.details.info.repositories=Repositories: {0}
|
||||
packagesearch.ui.toolwindow.packages.details.info.repository=Repository: {0}
|
||||
packagesearch.ui.toolwindow.packages.details.info.usages.caption=Used in:
|
||||
packagesearch.ui.toolwindow.packages.details.menu.copy=Copy
|
||||
packagesearch.ui.toolwindow.packages.empty.allModules=any modules
|
||||
packagesearch.ui.toolwindow.packages.empty.base=No dependencies to display.
|
||||
packagesearch.ui.toolwindow.packages.empty.noModule=Select a module from the tree to manage its dependencies.
|
||||
packagesearch.ui.toolwindow.packages.empty.packagesOnly=No supported dependencies were found in {0}. Search for dependencies to add to the project.
|
||||
packagesearch.ui.toolwindow.packages.empty.loading=Processing build scripts\u2026
|
||||
packagesearch.ui.toolwindow.packages.empty.powerSaveMode=Disable power save mode to show dependencies.
|
||||
packagesearch.ui.toolwindow.packages.empty.learnMore=Learn more\u2026
|
||||
packagesearch.ui.toolwindow.packages.empty.interrupted=Build files analysis has been interrupted manually.
|
||||
packagesearch.ui.toolwindow.packages.empty.interrupted.restart=Restart it\u2026
|
||||
packagesearch.ui.toolwindow.packages.empty.searching=No dependencies found
|
||||
packagesearch.ui.toolwindow.packages.filter.onlyMpp=Kotlin multiplatform
|
||||
packagesearch.ui.toolwindow.packages.filter.onlyStable=Only stable
|
||||
packagesearch.ui.toolwindow.packages.sort.by=Sort by:
|
||||
|
||||
packagesearch.ui.toolwindow.tab.packages.installedPackages.addedIn=Added in {0}
|
||||
packagesearch.ui.toolwindow.tab.packages.searchResults=Search Results
|
||||
packagesearch.ui.toolwindow.tab.packages.selectedPackage=Selected dependency
|
||||
packagesearch.ui.toolwindow.tab.packages.title=Manage
|
||||
packagesearch.ui.toolwindow.tab.repositories.no.repositories.configured=There are no repositories configured in the current project
|
||||
packagesearch.ui.toolwindow.tab.repositories.title=Repositories
|
||||
|
||||
packagesearch.ui.util.numberWithThousandsSymbol={0}k
|
||||
|
||||
packagesearch.version.undefined=Plugin version undefined
|
||||
@@ -1,4 +0,0 @@
|
||||
packagesearch.actions.addDependency.description=Add new dependency to the current module
|
||||
packagesearch.actions.addDependency.text=Add dependency\u2026
|
||||
packagesearch.quickfix.packagesearch.action.da=Show in Dependency Analyzer\u2026
|
||||
packagesearch.quickfix.packagesearch.action.da.description=Opens the Dependency Analyzer tab and highlights the selected dependency in the Dependency view. If needed, you will disambiguate the module with a popup.
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.jetbrains.packagesearch;
|
||||
|
||||
import com.intellij.ui.IconManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run "Generate icon classes" configuration instead
|
||||
*/
|
||||
public final class PackageSearchIcons {
|
||||
private static @NotNull Icon load(@NotNull String path, int cacheKey, int flags) {
|
||||
return IconManager.getInstance().loadRasterizedIcon(path, PackageSearchIcons.class.getClassLoader(), cacheKey, flags);
|
||||
}
|
||||
/** 16x16 */ public static final @NotNull Icon Artifact = load("icons/artifact.svg", 725041929, 2);
|
||||
/** 13x13 */ public static final @NotNull Icon ArtifactSmall = load("icons/artifactSmall.svg", 875420445, 2);
|
||||
/** 16x16 */ public static final @NotNull Icon Checkmark = load("icons/checkmark.svg", 695878700, 2);
|
||||
/** 16x16 */ public static final @NotNull Icon Package = load("icons/package.svg", -1188756150, 0);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin
|
||||
|
||||
import com.intellij.DynamicBundle
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
private const val BUNDLE = "messages.packageSearchBundle"
|
||||
|
||||
object PackageSearchBundle {
|
||||
private val bundle = DynamicBundle(PackageSearchBundle::class.java, BUNDLE)
|
||||
@Nls
|
||||
fun message(
|
||||
@PropertyKey(resourceBundle = BUNDLE) key: String,
|
||||
vararg params: Any
|
||||
): String = if (bundle.containsKey(key)) bundle.getMessage(key, *params) else PackageSearchDeprecatedMessagesBundle.message(key, *params)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin
|
||||
|
||||
import com.intellij.DynamicBundle
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
private const val BUNDLE = "messages.packageSearchDeprecatedMessagesBundle"
|
||||
|
||||
object PackageSearchDeprecatedMessagesBundle {
|
||||
private val bundle = DynamicBundle(PackageSearchDeprecatedMessagesBundle::class.java, BUNDLE)
|
||||
@Nls
|
||||
fun message(
|
||||
@PropertyKey(resourceBundle = BUNDLE) key: String,
|
||||
vararg params: Any
|
||||
): String = bundle.getMessage(key, *params)
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin
|
||||
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.openapi.application.ApplicationInfo
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
|
||||
internal object PluginEnvironment {
|
||||
|
||||
const val PACKAGE_SEARCH_NOTIFICATION_GROUP_ID = "packagesearch.notification"
|
||||
|
||||
const val PLUGIN_ID = "com.jetbrains.packagesearch.intellij-plugin"
|
||||
|
||||
val pluginVersion
|
||||
get() = PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID))?.version
|
||||
?: PackageSearchBundle.message("packagesearch.version.undefined")
|
||||
|
||||
val ideVersion
|
||||
get() = ApplicationInfo.getInstance().strictVersion
|
||||
|
||||
val ideBuildNumber
|
||||
get() = ApplicationInfo.getInstance().build
|
||||
|
||||
private val isTestEnvironment
|
||||
get() = ApplicationManager.getApplication().isUnitTestMode || ApplicationManager.getApplication().isHeadlessEnvironment
|
||||
|
||||
val isNonModalLoadingEnabled
|
||||
get() = System.getProperty("idea.pkgs.disableLoading") != "true" && !isTestEnvironment
|
||||
|
||||
object Caches {
|
||||
|
||||
val version
|
||||
get() = 3
|
||||
|
||||
val maxAttempts
|
||||
get() = System.getProperty("idea.pkgs.caches.attempts")?.toInt() ?: 30
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.InstalledDependency
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.asInstalledDependencyOrNull
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.versions.NormalizedPackageVersion
|
||||
import java.nio.file.Path
|
||||
|
||||
internal fun looksLikeGradleVariable(version: NormalizedPackageVersion<*>): Boolean = version.versionName.startsWith("$")
|
||||
|
||||
@NlsSafe
|
||||
internal fun @receiver:NlsSafe String?.normalizeWhitespace(): String? = this?.replace("\\s+".toRegex(), " ")?.trim()
|
||||
|
||||
internal fun String?.nullIfBlank(): String? = if (isNullOrBlank()) null else this
|
||||
|
||||
fun VirtualFile.toNioPathOrNull(): Path? = fileSystem.getNioPath(this)
|
||||
|
||||
internal fun Map<PackageSearchModule, PackageSearchModule.Dependencies>.getInstalledDependencies(): Set<InstalledDependency> {
|
||||
return asSequence().flatMap { it.value.declared.mapNotNull { it.asInstalledDependencyOrNull() } }.toSet()
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.actions
|
||||
|
||||
import com.intellij.dependencytoolwindow.DependencyToolWindowOpener
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys
|
||||
import com.intellij.openapi.application.runReadAction
|
||||
import com.intellij.openapi.module.ModuleManager
|
||||
import com.intellij.openapi.module.ModuleUtilCore
|
||||
import com.intellij.psi.PsiDirectory
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.PackagesListPanelProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.TargetModules
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.packageSearchProjectService
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.pkgsUiStateModifier
|
||||
|
||||
class AddDependencyAction : AnAction() {
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
e.presentation.isEnabledAndVisible = isEnabled(e)
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return
|
||||
|
||||
val modules = project.packageSearchProjectService.packageSearchModulesStateFlow.value
|
||||
if (modules.isEmpty()) return
|
||||
|
||||
val selectedModule = findSelectedModule(e, modules) ?: return
|
||||
|
||||
DependencyToolWindowOpener.activateToolWindow(project, PackagesListPanelProvider) {
|
||||
project.pkgsUiStateModifier.setTargetModules(TargetModules.One(selectedModule))
|
||||
}
|
||||
}
|
||||
|
||||
private fun findSelectedModule(e: AnActionEvent, modules: List<PackageSearchModule>): PackageSearchModule? {
|
||||
val project = e.project ?: return null
|
||||
val file = obtainSelectedProjectDirIfSingle(e)?.virtualFile ?: return null
|
||||
val selectedModule = runReadAction { ModuleUtilCore.findModuleForFile(file, project) } ?: return null
|
||||
|
||||
// Sanity check that the module we got actually exists
|
||||
ModuleManager.getInstance(project).findModuleByName(selectedModule.name)
|
||||
?: return null
|
||||
|
||||
return modules.firstOrNull { module -> module.nativeModule == selectedModule }
|
||||
}
|
||||
|
||||
private fun obtainSelectedProjectDirIfSingle(e: AnActionEvent): PsiDirectory? {
|
||||
val dataContext = e.dataContext
|
||||
val ideView = LangDataKeys.IDE_VIEW.getData(dataContext)
|
||||
val selectedDirectories = ideView?.directories ?: return null
|
||||
|
||||
if (selectedDirectories.size != 1) return null
|
||||
|
||||
return selectedDirectories.first()
|
||||
}
|
||||
|
||||
private fun isEnabled(e: AnActionEvent): Boolean {
|
||||
val project = e.project ?: return false
|
||||
val file = e.getData(CommonDataKeys.EDITOR)?.virtualFile ?: return false
|
||||
|
||||
val module = findSelectedModule(e, project.packageSearchProjectService.packageSearchModulesStateFlow.value)
|
||||
return module?.buildFile?.path?.equals(file.path) ?: false
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.actions
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.DataKey
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.externalSystem.dependency.analyzer.DAArtifact
|
||||
import com.intellij.openapi.externalSystem.dependency.analyzer.DependencyAnalyzerManager
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageModel
|
||||
import org.jetbrains.annotations.Nls
|
||||
|
||||
internal class PkgsToDAAction : AnAction() {
|
||||
|
||||
companion object {
|
||||
|
||||
val PACKAGES_LIST_PANEL_DATA_KEY: DataKey<PackageModel.Installed?> = DataKey.create("packageSearch.packagesListPanelDataKey")
|
||||
}
|
||||
|
||||
override fun isDumbAware() = true
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
val data = e.getData(PACKAGES_LIST_PANEL_DATA_KEY)
|
||||
with(e.presentation) {
|
||||
val hasData = data != null && data.usagesByModule.values.flatten()
|
||||
.any { it.module.buildSystemType.dependencyAnalyzerKey != null }
|
||||
isEnabledAndVisible = hasData
|
||||
if (hasData) {
|
||||
text = PackageSearchBundle.message(
|
||||
"packagesearch.quickfix.packagesearch.action.da.withIdentifier",
|
||||
data!!.identifier.rawValue
|
||||
)
|
||||
description = PackageSearchBundle.message(
|
||||
"packagesearch.quickfix.packagesearch.action.da.description.withParam",
|
||||
data.identifier.rawValue
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val data = e.getData(PACKAGES_LIST_PANEL_DATA_KEY) ?: return
|
||||
val allUsages = data.usagesByModule.values.flatten()
|
||||
val dependencyAnalyzerSupportedUsages = allUsages
|
||||
.filter { it.module.buildSystemType.dependencyAnalyzerKey != null }
|
||||
if (dependencyAnalyzerSupportedUsages.size > 1) {
|
||||
val defaultActionGroup = buildActionGroup {
|
||||
dependencyAnalyzerSupportedUsages.forEach { usage ->
|
||||
add(usage.module.name) {
|
||||
navigateToDA(
|
||||
group = data.groupId,
|
||||
artifact = data.artifactId,
|
||||
version = usage.getDeclaredVersionOrFallback().versionName,
|
||||
module = usage.module.nativeModule,
|
||||
systemId = usage.module.buildSystemType.dependencyAnalyzerKey!!
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DialogTitleCapitalization")
|
||||
val popup = JBPopupFactory.getInstance().createActionGroupPopup(
|
||||
PackageSearchBundle.message("packagesearch.quickfix.packagesearch.action.da.selectModule", data.identifier.rawValue),
|
||||
defaultActionGroup,
|
||||
e.dataContext,
|
||||
JBPopupFactory.ActionSelectionAid.NUMBERING,
|
||||
true,
|
||||
null,
|
||||
10
|
||||
)
|
||||
|
||||
e.project?.let { popup.showCenteredInCurrentWindow(it) } ?: popup.showInBestPositionFor(e.dataContext)
|
||||
} else {
|
||||
val usage = allUsages.single()
|
||||
navigateToDA(
|
||||
group = data.groupId,
|
||||
artifact = data.artifactId,
|
||||
version = usage.getDeclaredVersionOrFallback().versionName,
|
||||
module = usage.module.nativeModule,
|
||||
systemId = usage.module.buildSystemType.dependencyAnalyzerKey!!
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("HardCodedStringLiteral")
|
||||
private fun navigateToDA(group: String, artifact: String, version: String, module: Module, systemId: ProjectSystemId) =
|
||||
DependencyAnalyzerManager.getInstance(module.project)
|
||||
.getOrCreate(systemId)
|
||||
.setSelectedDependency(
|
||||
module = module,
|
||||
data = DAArtifact(group, artifact, version)
|
||||
)
|
||||
}
|
||||
|
||||
fun buildActionGroup(builder: DefaultActionGroup.() -> Unit) = DefaultActionGroup().apply(builder)
|
||||
|
||||
private fun DefaultActionGroup.add(@Nls title: String, actionPerformed: (AnActionEvent) -> Unit) =
|
||||
add(object : AnAction(title) {
|
||||
override fun actionPerformed(e: AnActionEvent) = actionPerformed(e)
|
||||
})
|
||||
@@ -1,39 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.actions
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.ui.PackageSearchGeneralConfigurable
|
||||
|
||||
@Suppress("DialogTitleCapitalization")
|
||||
class ShowSettingsAction(private val currentProject: Project? = null) :
|
||||
AnAction(
|
||||
PackageSearchBundle.message("packagesearch.actions.showSettings.text"),
|
||||
PackageSearchBundle.message("packagesearch.actions.showSettings.description"),
|
||||
AllIcons.General.Settings
|
||||
) {
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: currentProject ?: return
|
||||
ShowSettingsUtil.getInstance().showSettingsDialog(project, PackageSearchGeneralConfigurable::class.java)
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.actions
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ToggleAction
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
|
||||
|
||||
class TogglePackageDetailsAction(
|
||||
private val project: Project,
|
||||
private val selectedCallback: (Boolean) -> Unit
|
||||
) : ToggleAction(
|
||||
PackageSearchBundle.message("packagesearch.actions.showDetails.text"),
|
||||
PackageSearchBundle.message("packagesearch.actions.showDetails.description"),
|
||||
AllIcons.Actions.PreviewDetails
|
||||
) {
|
||||
|
||||
override fun isSelected(e: AnActionEvent) = PackageSearchGeneralConfiguration.getInstance(project).packageDetailsVisible
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
PackageSearchGeneralConfiguration.getInstance(project).packageDetailsVisible = state
|
||||
selectedCallback.invoke(state)
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.configuration
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.xmlb.annotations.OptionTag
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
@State(
|
||||
name = "PackageSearchGeneralConfiguration",
|
||||
storages = [Storage(PackageSearchGeneralConfiguration.StorageFileName)]
|
||||
)
|
||||
class PackageSearchGeneralConfiguration : BaseState(), PersistentStateComponent<PackageSearchGeneralConfiguration> {
|
||||
|
||||
companion object {
|
||||
|
||||
const val StorageFileName = "packagesearch.xml"
|
||||
const val DefaultPackageDetailsSplitterProportion = 0.8f
|
||||
|
||||
fun getInstance(project: Project): PackageSearchGeneralConfiguration =
|
||||
project.service()
|
||||
}
|
||||
|
||||
override fun getState(): PackageSearchGeneralConfiguration = this
|
||||
|
||||
override fun loadState(state: PackageSearchGeneralConfiguration) = copyFrom(state)
|
||||
|
||||
@get:OptionTag("AUTO_SCROLL_TO_SOURCE")
|
||||
var autoScrollToSource by property(true)
|
||||
|
||||
@get:OptionTag("AUTOMATICALLY_ADD_REPOSITORIES")
|
||||
var autoAddMissingRepositories by property(true)
|
||||
|
||||
@get:OptionTag("PACKAGE_DETAILS_VISIBLE")
|
||||
var packageDetailsVisible by property(true)
|
||||
|
||||
@get:OptionTag("PACKAGE_DETAILS_SPLITTER_PROPORTION")
|
||||
var packageDetailsSplitterProportion by property(DefaultPackageDetailsSplitterProportion)
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.configuration
|
||||
|
||||
import com.intellij.ide.ui.search.SearchableOptionContributor
|
||||
import com.intellij.ide.ui.search.SearchableOptionProcessor
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.ui.PackageSearchGeneralConfigurable
|
||||
|
||||
class PackageSearchSearchableOptionContributor : SearchableOptionContributor() {
|
||||
|
||||
override fun processOptions(processor: SearchableOptionProcessor) {
|
||||
// Make settings searchable
|
||||
addSearchConfigurationMap(
|
||||
processor,
|
||||
"packagesearch", "package", "search", "dependency", "dependencies",
|
||||
"gradle", "configuration", "maven", "scope"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun addSearchConfigurationMap(processor: SearchableOptionProcessor, vararg entries: String) {
|
||||
for (entry in entries) {
|
||||
processor.addOptions(entry, null, entry, PackageSearchGeneralConfigurable.ID, null, false)
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.configuration.ui
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.openapi.options.SearchableConfigurable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.TitledSeparator
|
||||
import com.intellij.ui.components.labels.LinkLabel
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.AnalyticsAwareConfigurableContributorDriver
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.ConfigurableContributor
|
||||
import com.jetbrains.packagesearch.intellij.plugin.fus.PackageSearchEventsLogger
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.PackageSearchUI
|
||||
import java.awt.event.ItemEvent.SELECTED
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
|
||||
class PackageSearchGeneralConfigurable(project: Project) : SearchableConfigurable {
|
||||
|
||||
private val extensions = ConfigurableContributor.extensionsForProject(project)
|
||||
.sortedBy { it.javaClass.simpleName }
|
||||
.map { it.createDriver() }
|
||||
|
||||
private val isAnyContributorModified: Boolean
|
||||
get() = extensions.any { it.isModified() }
|
||||
|
||||
private var isAutoAddRepositoriesModified: Boolean = false
|
||||
|
||||
private val builder = FormBuilder.createFormBuilder()
|
||||
|
||||
private val configuration = PackageSearchGeneralConfiguration.getInstance(project)
|
||||
|
||||
private val autoAddRepositoriesCheckBox = PackageSearchUI.checkBox(
|
||||
PackageSearchBundle.message("packagesearch.configuration.automatically.add.repositories")
|
||||
) {
|
||||
isSelected = configuration.autoAddMissingRepositories
|
||||
addItemListener {
|
||||
val newIsSelected = it.stateChange == SELECTED
|
||||
isAutoAddRepositoriesModified = newIsSelected != configuration.autoAddMissingRepositories
|
||||
}
|
||||
}
|
||||
|
||||
override fun getId(): String = ID
|
||||
|
||||
override fun getDisplayName(): String = PackageSearchBundle.message("packagesearch.configuration.title")
|
||||
|
||||
override fun createComponent(): JComponent? {
|
||||
// Extensions
|
||||
extensions.forEach {
|
||||
it.contributeUserInterface(builder)
|
||||
}
|
||||
|
||||
// General options
|
||||
builder.addComponent(
|
||||
TitledSeparator(PackageSearchBundle.message("packagesearch.configuration.general")),
|
||||
0
|
||||
)
|
||||
|
||||
// Reset defaults
|
||||
builder.addComponent(autoAddRepositoriesCheckBox)
|
||||
builder.addComponent(
|
||||
LinkLabel<Any>(
|
||||
PackageSearchBundle.message("packagesearch.configuration.restore.defaults"),
|
||||
null
|
||||
) { _, _ -> restoreDefaults() }
|
||||
)
|
||||
|
||||
builder.addComponentFillVertically(JPanel(), 0)
|
||||
|
||||
return builder.panel
|
||||
}
|
||||
|
||||
override fun isModified() = isAutoAddRepositoriesModified || isAnyContributorModified
|
||||
|
||||
override fun reset() {
|
||||
for (contributor in extensions) {
|
||||
contributor.reset()
|
||||
}
|
||||
|
||||
autoAddRepositoriesCheckBox.isSelected = configuration.autoAddMissingRepositories
|
||||
|
||||
isAutoAddRepositoriesModified = false
|
||||
}
|
||||
|
||||
private fun restoreDefaults() {
|
||||
for (contributor in extensions) {
|
||||
contributor.restoreDefaults()
|
||||
}
|
||||
|
||||
val defaultAutoAddRepositories = true
|
||||
isAutoAddRepositoriesModified = autoAddRepositoriesCheckBox.isSelected == defaultAutoAddRepositories
|
||||
autoAddRepositoriesCheckBox.isSelected = defaultAutoAddRepositories
|
||||
|
||||
PackageSearchEventsLogger.logPreferencesRestoreDefaults()
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
val analyticsFields = mutableSetOf<EventPair<*>>()
|
||||
for (contributor in extensions) {
|
||||
contributor.apply()
|
||||
if (contributor is AnalyticsAwareConfigurableContributorDriver) {
|
||||
analyticsFields.addAll(contributor.provideApplyEventAnalyticsData())
|
||||
}
|
||||
}
|
||||
|
||||
configuration.autoAddMissingRepositories = autoAddRepositoriesCheckBox.isSelected
|
||||
analyticsFields += PackageSearchEventsLogger.preferencesAutoAddRepositoriesField.with(configuration.autoAddMissingRepositories)
|
||||
PackageSearchEventsLogger.logPreferencesChanged(*analyticsFields.toTypedArray())
|
||||
|
||||
isAutoAddRepositoriesModified = false
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val ID = "preferences.packagesearch.PackageSearchGeneralConfigurable"
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.PackageSearchModule
|
||||
import com.jetbrains.packagesearch.intellij.plugin.extensibility.asUnifiedDependencyKeyOrNull
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.*
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.DependencyUsageInfo
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.InstalledDependenciesUsages
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.InstalledDependency
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageModel
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.ProjectDataProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.versions.NormalizedPackageVersion
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.packageVersionNormalizer
|
||||
import kotlinx.coroutines.future.await
|
||||
|
||||
internal suspend fun installedDependenciesUsages(
|
||||
project: Project,
|
||||
packageSearchModules: Map<PackageSearchModule, PackageSearchModule.Dependencies>,
|
||||
remoteData: Map<InstalledDependency, ProjectDataProvider.ParsedApiStandardPackage>
|
||||
): InstalledDependenciesUsages {
|
||||
val installedVersions: MutableMap<InstalledDependency, MutableList<NormalizedPackageVersion<*>>> = mutableMapOf()
|
||||
val usages = buildMap<InstalledDependency, MutableList<DependencyUsageInfo>> {
|
||||
packageSearchModules.forEach { (module, dependencies) ->
|
||||
val resolvedDependencies = buildMap {
|
||||
dependencies.resolved.forEach { unifiedDependency ->
|
||||
val key = unifiedDependency.asUnifiedDependencyKeyOrNull()
|
||||
if (key != null) put(key, unifiedDependency)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies.declared
|
||||
.groupBy { it.asInstalledDependency() }
|
||||
.forEach { (installedDependencyKey, declaredDependencies) ->
|
||||
declaredDependencies.map { declaredDependency ->
|
||||
val usage = DependencyUsageInfo(
|
||||
module = module,
|
||||
declaredVersion = packageVersionNormalizer.parse(PackageVersion.from(declaredDependency.coordinates.version)),
|
||||
resolvedVersion = declaredDependency.unifiedDependency.asUnifiedDependencyKeyOrNull()
|
||||
?.let { unifiedDependencyKey -> resolvedDependencies[unifiedDependencyKey] }
|
||||
?.coordinates
|
||||
?.version
|
||||
.let { packageVersionNormalizer.parse(PackageVersion.Companion.from(it)) },
|
||||
scope = PackageScope.from(declaredDependency.unifiedDependency.scope),
|
||||
userDefinedScopes = module.moduleType.userDefinedScopes(project),
|
||||
declarationIndexInBuildFile = module.dependencyDeclarationCallback(declaredDependency).await()
|
||||
)
|
||||
getOrPut(installedDependencyKey) { mutableListOf() }.add(usage)
|
||||
installedVersions.getOrPut(installedDependencyKey) { mutableListOf() }.add(usage.declaredVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val installedPackagesByModule = mutableMapOf<Module, MutableList<PackageModel.Installed>>()
|
||||
val allInstalledPackages = usages.asSequence()
|
||||
.map { (installedDependency, usages) ->
|
||||
val parsedRemoteVersions = (remoteData[installedDependency]?.parsedVersions ?: emptyList())
|
||||
.sortedDescending()
|
||||
val allVersions = installedVersions.getValue(installedDependency)
|
||||
.plus(remoteData[installedDependency]?.parsedVersions ?: emptyList())
|
||||
.sortedDescending()
|
||||
PackageModel.Installed(
|
||||
groupId = installedDependency.groupId,
|
||||
artifactId = installedDependency.artifactId,
|
||||
remoteInfo = remoteData[installedDependency]?.data,
|
||||
remoteVersions = parsedRemoteVersions,
|
||||
usagesByModule = usages.groupBy { it.module.nativeModule },
|
||||
latestInstalledVersion = installedVersions.getValue(installedDependency).max(),
|
||||
highestStableVersion = allVersions.firstOrNull { it.isStable } ?: allVersions.first(),
|
||||
highestUnstableVersion = allVersions.first(),
|
||||
declaredVersions = installedVersions.getValue(installedDependency)
|
||||
)
|
||||
}
|
||||
.onEach { packageModel ->
|
||||
packageModel.usagesByModule.forEach { (_, usages) ->
|
||||
usages.forEach { usage ->
|
||||
installedPackagesByModule.getOrPut(usage.module.nativeModule) { mutableListOf() }
|
||||
.add(packageModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
.toList()
|
||||
return InstalledDependenciesUsages(allInstalledPackages, installedPackagesByModule)
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.lifecycleScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class LoadingContainer(private val project: Project) {
|
||||
|
||||
enum class LoadingState {
|
||||
LOADING, IDLE
|
||||
}
|
||||
|
||||
private val loadingStates: Channel<MutableStateFlow<LoadingState>> = Channel()
|
||||
|
||||
fun addLoadingState(): MutableStateFlow<LoadingState> {
|
||||
val newFlow = MutableStateFlow(LoadingState.IDLE)
|
||||
project.lifecycleScope.launch { loadingStates.send(newFlow) }
|
||||
return newFlow
|
||||
}
|
||||
|
||||
val loadingFlow = channelFlow {
|
||||
val allFlows = mutableListOf<MutableStateFlow<LoadingState>>()
|
||||
loadingStates.consumeAsFlow()
|
||||
.collect {
|
||||
allFlows.add(it)
|
||||
send(combine(allFlows) {
|
||||
if (it.any { it == LoadingState.LOADING }) LoadingState.LOADING else LoadingState.IDLE
|
||||
})
|
||||
}
|
||||
}.flatMapLatest { it }
|
||||
.stateIn(project.lifecycleScope, SharingStarted.Lazily, LoadingState.IDLE)
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.appSystemDir
|
||||
import com.intellij.util.io.delete
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.PackageVersion
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.versions.NormalizedPackageVersion
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.versions.PackageVersionNormalizer
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.CoroutineLRUCache
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
internal class PackageSearchCachesService : Disposable {
|
||||
|
||||
private val normalizerCacheFile = appSystemDir.resolve("caches/pkgs/normalizedVersions.json")
|
||||
|
||||
private val json = Json {
|
||||
prettyPrint = true
|
||||
allowStructuredMapKeys = true
|
||||
}
|
||||
|
||||
private val normalizerCache: CoroutineLRUCache<PackageVersion.Named, NormalizedPackageVersion<PackageVersion.Named>> =
|
||||
// TODO compilation bug due to https://github.com/Kotlin/kotlinx.serialization/issues/1264
|
||||
// normalizerCacheFile.takeIf { it.exists() }
|
||||
// ?.runCatching {
|
||||
// json.decodeFromString(
|
||||
// CoroutineLRUCache.serializer<PackageVersion.Named, NormalizedPackageVersion<PackageVersion.Named>>(),
|
||||
// readText()
|
||||
// )
|
||||
// }
|
||||
// ?.getOrNull()
|
||||
// ?:
|
||||
CoroutineLRUCache(4_000)
|
||||
|
||||
val normalizer = PackageVersionNormalizer(normalizerCache)
|
||||
|
||||
override fun dispose() {
|
||||
// TODO compilation bug due to https://github.com/Kotlin/kotlinx.serialization/issues/1264
|
||||
// normalizerCacheFile
|
||||
// .apply { if (!parent.exists()) Files.createDirectories(parent) }
|
||||
// .writeText(json.encodeToString(CoroutineLRUCache.serializer(), normalizerCache))
|
||||
}
|
||||
|
||||
suspend fun clear() = coroutineScope {
|
||||
launch { normalizerCache.clear() }
|
||||
launch(Dispatchers.IO) { normalizerCacheFile.delete() }
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.getProjectDataPath
|
||||
import com.intellij.util.io.createDirectories
|
||||
import com.intellij.util.io.delete
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.InstalledDependency
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.ProjectDataProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.UiPackageModel
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.panels.management.packages.PackagesListPanel
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.panels.management.packages.UiPackageModelCacheKey
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.CoroutineLRUCache
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.packagesearch.api.v2.ApiStandardPackage
|
||||
import kotlin.io.path.exists
|
||||
|
||||
internal class PackageSearchProjectCachesService(project: Project) {
|
||||
|
||||
val searchCache: CoroutineLRUCache<PackagesListPanel.SearchCommandModel, ProjectDataProvider.ParsedSearchResponse> =
|
||||
CoroutineLRUCache(200)
|
||||
|
||||
private val searchPackageModelCache: CoroutineLRUCache<UiPackageModelCacheKey, UiPackageModel.SearchResult> =
|
||||
CoroutineLRUCache(1000)
|
||||
|
||||
val installedDependencyCache: CoroutineLRUCache<InstalledDependency, ApiStandardPackage> =
|
||||
CoroutineLRUCache(500)
|
||||
|
||||
private val projectCacheDirectory = project.getProjectDataPath("pkgs")
|
||||
.also { if (!it.exists()) it.createDirectories() }
|
||||
|
||||
suspend fun clear() = coroutineScope {
|
||||
launch { searchCache.clear() }
|
||||
launch { searchPackageModelCache.clear() }
|
||||
launch { installedDependencyCache.clear() }
|
||||
launch(Dispatchers.IO) {
|
||||
projectCacheDirectory.delete(true)
|
||||
projectCacheDirectory.createDirectories()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.readAction
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.platform.util.coroutines.flow.debounceBatch
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PluginEnvironment
|
||||
import com.jetbrains.packagesearch.intellij.plugin.getInstalledDependencies
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.InstalledDependenciesUsages
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.ProjectDataProvider
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.toolwindow.models.RepositoryModel
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.BackgroundLoadingBarController
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.PowerSaveModeState
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.TraceInfo
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.TraceInfo.TraceSource.SEARCH_QUERY
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.catchAndLog
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.combineLatest
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.fileOpenedFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.filesChangedEventFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.lifecycleScope
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.loadingContainer
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.map
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.modifiedBy
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.moduleChangesSignalFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.moduleTransformers
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.nativeModulesFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.packageSearchProjectCachesService
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.parallelMap
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.powerSaveModeFlow
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.replayOn
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.send
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.shareInAndCatchAndLog
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.showBackgroundLoadingBar
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.stateInAndCatchAndLog
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.throttle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.timer
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.trustedProjectFlow
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
import kotlinx.coroutines.flow.flatMapMerge
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.flow.receiveAsFlow
|
||||
import kotlinx.coroutines.flow.shareIn
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.flow.take
|
||||
import org.jetbrains.idea.packagesearch.api.PackageSearchApiClient
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
internal class PackageSearchProjectService(private val project: Project) : Disposable {
|
||||
|
||||
val dataProvider = ProjectDataProvider(
|
||||
apiClient = PackageSearchApiClient(),
|
||||
packageCache = project.packageSearchProjectCachesService.installedDependencyCache
|
||||
)
|
||||
|
||||
private val restartChannel = Channel<Unit>()
|
||||
private val restartFlow = restartChannel.receiveAsFlow()
|
||||
.shareIn(project.lifecycleScope, SharingStarted.Lazily)
|
||||
|
||||
val allKnownRepositoriesFlow by timer(1.hours)
|
||||
.map(project.loadingContainer) {
|
||||
dataProvider.fetchKnownRepositories()
|
||||
.map { RepositoryModel(it.id, it.friendlyName, it.url, it) }
|
||||
}
|
||||
.stateInAndCatchAndLog(project.lifecycleScope, SharingStarted.Lazily, emptyList())
|
||||
|
||||
private val packageSearchModulesFlow by combine(
|
||||
project.trustedProjectFlow,
|
||||
ApplicationManager.getApplication().powerSaveModeFlow.map { it == PowerSaveModeState.DISABLED }
|
||||
) { results: Array<Boolean> -> results.all { it } }
|
||||
.flatMapLatest { isPkgsEnabled -> if (isPkgsEnabled) project.nativeModulesFlow else emptyFlow() }
|
||||
.replayOn(project.moduleChangesSignalFlow, restartFlow)
|
||||
.map(project.loadingContainer) { nativeModules ->
|
||||
project.moduleTransformers.parallelMap { it.transformModules(project, nativeModules) }
|
||||
.flatten()
|
||||
}
|
||||
.catchAndLog()
|
||||
|
||||
val packageSearchModulesStateFlow = packageSearchModulesFlow
|
||||
.stateIn(project.lifecycleScope, SharingStarted.Lazily, emptyList())
|
||||
|
||||
val isAvailable
|
||||
get() = packageSearchModulesStateFlow.value.isNotEmpty()
|
||||
|
||||
private val moduleChangesFlow by combine(
|
||||
packageSearchModulesFlow,
|
||||
project.filesChangedEventFlow.map { it.mapNotNull { it.file } }
|
||||
) { modules, fileChanges ->
|
||||
modules.filter { it.buildFile in fileChanges }
|
||||
}
|
||||
.filter { it.isNotEmpty() }
|
||||
.debounceBatch(1.seconds)
|
||||
.map { it.flatten().distinct() }
|
||||
.catchAndLog()
|
||||
|
||||
private val repositoryChangesFlow = combine(
|
||||
moduleChangesFlow,
|
||||
allKnownRepositoriesFlow
|
||||
) { changes, knownRepositories ->
|
||||
changes to knownRepositories
|
||||
}
|
||||
|
||||
val repositoriesDeclarationsByModuleFlow by combineLatest(
|
||||
packageSearchModulesFlow,
|
||||
allKnownRepositoriesFlow,
|
||||
project.loadingContainer
|
||||
) { modules, knownRepositories -> modules.associateWith { it.getDeclaredRepositories(knownRepositories) } }
|
||||
.modifiedBy(
|
||||
repositoryChangesFlow,
|
||||
project.loadingContainer
|
||||
) { repositoriesDeclarationsByModule, (changes, knownRepositories) ->
|
||||
repositoriesDeclarationsByModule.toMutableMap()
|
||||
.apply { putAll(changes.associateWith { it.getDeclaredRepositories(knownRepositories) }) }
|
||||
}
|
||||
.stateInAndCatchAndLog(project.lifecycleScope, SharingStarted.Lazily, emptyMap())
|
||||
|
||||
private val declarationsChanges by moduleChangesFlow
|
||||
.map { it.associateWith { it.getDependencies() } }
|
||||
.shareInAndCatchAndLog(project.lifecycleScope, SharingStarted.Lazily)
|
||||
|
||||
private val declaredDependenciesByModuleFlow by packageSearchModulesFlow
|
||||
.map(project.loadingContainer) { modules -> modules.associateWith { it.getDependencies() } }
|
||||
.modifiedBy(
|
||||
declarationsChanges,
|
||||
project.loadingContainer
|
||||
) { declaredDependenciesByModule, changes ->
|
||||
declaredDependenciesByModule.toMutableMap().apply { putAll(changes) }
|
||||
}
|
||||
.stateInAndCatchAndLog(project.lifecycleScope, SharingStarted.Lazily, emptyMap())
|
||||
|
||||
private val remoteData by declaredDependenciesByModuleFlow
|
||||
.filter { it.isNotEmpty() }
|
||||
.take(1)
|
||||
.map(project.loadingContainer) { it.getInstalledDependencies() }
|
||||
.map(project.loadingContainer) { dataProvider.fetchInfoFor(it, TraceInfo(SEARCH_QUERY)) }
|
||||
.modifiedBy(
|
||||
declarationsChanges.map { it.getInstalledDependencies() },
|
||||
project.loadingContainer
|
||||
) { apiResults, changes ->
|
||||
val newPackages = changes - apiResults.keys
|
||||
if (newPackages.isNotEmpty()) {
|
||||
apiResults.toMutableMap().apply { putAll(dataProvider.fetchInfoFor(newPackages, TraceInfo(SEARCH_QUERY))) }
|
||||
} else apiResults
|
||||
}
|
||||
.catchAndLog()
|
||||
|
||||
val installedDependenciesFlow = combineLatest(
|
||||
flow1 = declaredDependenciesByModuleFlow,
|
||||
flow2 = remoteData,
|
||||
loadingContainer = project.loadingContainer
|
||||
) { packageSearchModules, remoteData ->
|
||||
installedDependenciesUsages(project, packageSearchModules, remoteData)
|
||||
}.stateIn(project.lifecycleScope, SharingStarted.Lazily, InstalledDependenciesUsages.EMPTY)
|
||||
|
||||
init {
|
||||
|
||||
val openedBuildFilesFlow = combine(
|
||||
project.fileOpenedFlow,
|
||||
packageSearchModulesFlow.map { it.mapNotNull { it.buildFile }.toSet() }
|
||||
) { openedFiles, buildFiles ->
|
||||
openedFiles intersect buildFiles
|
||||
}.shareIn(project.lifecycleScope, SharingStarted.Eagerly, 1)
|
||||
|
||||
openedBuildFilesFlow
|
||||
.filter { it.isNotEmpty() }
|
||||
.take(1)
|
||||
.flatMapLatest { installedDependenciesFlow }
|
||||
.flatMapLatest { openedBuildFilesFlow }
|
||||
.flatMapMerge { it.asFlow() }
|
||||
.mapNotNull { readAction { PsiManager.getInstance(project).findFile(it) } }
|
||||
.onEach { readAction { DaemonCodeAnalyzer.getInstance(project).restart(it) } }
|
||||
.flowOn(Dispatchers.EDT)
|
||||
.launchIn(project.lifecycleScope)
|
||||
|
||||
var controller: BackgroundLoadingBarController? = null
|
||||
|
||||
if (PluginEnvironment.isNonModalLoadingEnabled) {
|
||||
project.loadingContainer.loadingFlow
|
||||
.throttle(1.seconds)
|
||||
.onEach { controller?.clear() }
|
||||
.filter { it == LoadingContainer.LoadingState.LOADING }
|
||||
.onEach {
|
||||
controller = showBackgroundLoadingBar(
|
||||
project = project,
|
||||
title = IdeBundle.message("toolwindow.stripe.Dependencies"),
|
||||
upperMessage = PackageSearchBundle.message("packagesearch.ui.loading"),
|
||||
cancellable = false,
|
||||
isPausable = false
|
||||
)
|
||||
}
|
||||
.launchIn(project.lifecycleScope)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun restart() {
|
||||
restartChannel.send()
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
dataProvider.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.data
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedCoordinates
|
||||
import com.intellij.buildsystem.model.unified.UnifiedDependency
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.descriptors.buildClassSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.element
|
||||
import kotlinx.serialization.encoding.CompositeDecoder.Companion.DECODE_DONE
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.encoding.decodeStructure
|
||||
import kotlinx.serialization.encoding.encodeStructure
|
||||
|
||||
internal object UnifiedCoordinatesSerializer : KSerializer<UnifiedCoordinates> {
|
||||
|
||||
override val descriptor = buildClassSerialDescriptor(UnifiedCoordinates::class.qualifiedName!!) {
|
||||
element<String>("groupId", isOptional = true)
|
||||
element<String>("artifactId", isOptional = true)
|
||||
element<String>("version", isOptional = true)
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder) = decoder.decodeStructure(descriptor) {
|
||||
var groupId: String? = null
|
||||
var artifactId: String? = null
|
||||
var version: String? = null
|
||||
loop@ while (true) {
|
||||
when (val index = decodeElementIndex(descriptor)) {
|
||||
DECODE_DONE -> break@loop
|
||||
0 -> groupId = decodeStringElement(descriptor, 0)
|
||||
1 -> artifactId = decodeStringElement(descriptor, 1)
|
||||
2 -> version = decodeStringElement(descriptor, 2)
|
||||
else -> throw SerializationException("Unexpected index $index")
|
||||
}
|
||||
}
|
||||
UnifiedCoordinates(groupId, artifactId, version)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: UnifiedCoordinates) = encoder.encodeStructure(descriptor) {
|
||||
value.groupId?.let { encodeStringElement(descriptor, 0, it) }
|
||||
value.artifactId?.let { encodeStringElement(descriptor, 1, it) }
|
||||
value.version?.let { encodeStringElement(descriptor, 2, it) }
|
||||
}
|
||||
}
|
||||
|
||||
internal object UnifiedDependencySerializer : KSerializer<UnifiedDependency> {
|
||||
|
||||
override val descriptor = buildClassSerialDescriptor(UnifiedDependency::class.qualifiedName!!) {
|
||||
element("coordinates", UnifiedCoordinatesSerializer.descriptor)
|
||||
element<String>("scope", isOptional = true)
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder) = decoder.decodeStructure(descriptor) {
|
||||
var coordinates: UnifiedCoordinates? = null
|
||||
var scope: String? = null
|
||||
loop@ while (true) {
|
||||
when (val index = decodeElementIndex(descriptor)) {
|
||||
DECODE_DONE -> break@loop
|
||||
0 -> coordinates = decodeSerializableElement(descriptor, 0, UnifiedCoordinatesSerializer)
|
||||
1 -> scope = decodeStringElement(descriptor, 1)
|
||||
else -> throw SerializationException("Unexpected index $index")
|
||||
}
|
||||
}
|
||||
UnifiedDependency(
|
||||
coordinates = requireNotNull(coordinates) { "coordinates property missing while deserializing ${UnifiedDependency::class.qualifiedName}" },
|
||||
scope = scope
|
||||
)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: UnifiedDependency) = encoder.encodeStructure(descriptor) {
|
||||
encodeSerializableElement(descriptor, 0, UnifiedCoordinatesSerializer, value.coordinates)
|
||||
value.scope?.let { encodeStringElement(descriptor, 1, it) }
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.dependency.analyzer
|
||||
|
||||
import com.intellij.buildsystem.model.unified.UnifiedCoordinates
|
||||
import com.intellij.ide.IdeTooltipManager
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.ui.popup.Balloon
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.util.getBestBalloonPosition
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.jetbrains.packagesearch.intellij.plugin.PackageSearchBundle
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.services.DependencyNavigationService
|
||||
import com.jetbrains.packagesearch.intellij.plugin.ui.services.NavigationResult
|
||||
import javax.swing.JLabel
|
||||
|
||||
abstract class DependencyAnalyzerGoToPackageSearchAction : DumbAwareAction() {
|
||||
|
||||
abstract val systemId: ProjectSystemId
|
||||
|
||||
abstract fun getModule(e: AnActionEvent): Module?
|
||||
|
||||
abstract fun getUnifiedCoordinates(e: AnActionEvent): UnifiedCoordinates?
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val module = getModule(e) ?: return
|
||||
val coordinates = getUnifiedCoordinates(e) ?: return
|
||||
val navigationService = DependencyNavigationService.getInstance(module.project)
|
||||
val navigationResultMessage = when (navigationService.navigateToDependency(module, coordinates)) {
|
||||
is NavigationResult.CoordinatesNotFound -> PackageSearchBundle.message("packagesearch.actions.showToolWindow.not.found.dependency")
|
||||
is NavigationResult.DependencyNotFound -> PackageSearchBundle.message("packagesearch.actions.showToolWindow.not.found.dependency")
|
||||
is NavigationResult.ModuleNotSupported -> PackageSearchBundle.message("packagesearch.actions.showToolWindow.not.found.module")
|
||||
NavigationResult.Success -> null
|
||||
}
|
||||
if (navigationResultMessage != null) {
|
||||
showBalloon(e.dataContext, navigationResultMessage)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBalloon(dataContext: DataContext, message: @NlsContexts.Label String) {
|
||||
val tooltipManager = IdeTooltipManager.getInstance()
|
||||
val foreground = tooltipManager.getTextForeground(false)
|
||||
val background = tooltipManager.getTextBackground(false)
|
||||
val borderColor = JBUI.CurrentTheme.Tooltip.borderColor()
|
||||
val label = JLabel(message)
|
||||
label.foreground = foreground
|
||||
label.background = background
|
||||
JBPopupFactory.getInstance()
|
||||
.createBalloonBuilder(label)
|
||||
.setFillColor(background)
|
||||
.setBorderColor(borderColor)
|
||||
.createBalloon()
|
||||
.show(getBestBalloonPosition(dataContext), Balloon.Position.above)
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
e.presentation.isEnabledAndVisible =
|
||||
systemId == e.getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID) &&
|
||||
getModule(e) != null &&
|
||||
getUnifiedCoordinates(e) != null
|
||||
}
|
||||
|
||||
init {
|
||||
templatePresentation.text = PackageSearchBundle.message("packagesearch.actions.showToolWindow.text")
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.codeInspection.InspectionManager
|
||||
import com.intellij.codeInspection.LocalInspectionTool
|
||||
import com.intellij.codeInspection.ProblemDescriptor
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.module.ModuleUtil
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.logWarn
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.packageSearchProjectService
|
||||
|
||||
abstract class AbstractPackageUpdateInspectionCheck : LocalInspectionTool() {
|
||||
|
||||
protected open fun shouldCheckFile(file: PsiFile): Boolean = false
|
||||
|
||||
protected open fun selectPsiElementIndex(dependencyDeclarationIndexes: DependencyDeclarationIndexes): Int? = null
|
||||
|
||||
final override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<ProblemDescriptor> {
|
||||
val isFileNotTracked = file.virtualFile !in file.project.packageSearchProjectService
|
||||
.packageSearchModulesStateFlow
|
||||
.value
|
||||
.map { it.buildFile }
|
||||
val shouldNotCheckFile by lazy { !shouldCheckFile(file) }
|
||||
if (isFileNotTracked || shouldNotCheckFile) {
|
||||
return emptyArray()
|
||||
}
|
||||
|
||||
val fileModule = ModuleUtil.findModuleForFile(file)
|
||||
if (fileModule == null) {
|
||||
logWarn("Inspecting file $file belonging to an unknown module")
|
||||
return emptyArray()
|
||||
}
|
||||
|
||||
val problemsHolder = ProblemsHolder(manager, file, isOnTheFly)
|
||||
|
||||
problemsHolder.checkFile(file, fileModule)
|
||||
|
||||
return problemsHolder.resultsArray
|
||||
}
|
||||
|
||||
abstract fun ProblemsHolder.checkFile(file: PsiFile, fileModule: Module)
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
|
||||
/**
|
||||
* A [ConfigurableContributorDriver] that is also able to provide analytics data for events.
|
||||
* Only for internal usage, due to FUS policy of explicitly allow-listing logged data.
|
||||
*/
|
||||
interface AnalyticsAwareConfigurableContributorDriver : ConfigurableContributorDriver {
|
||||
|
||||
fun provideApplyEventAnalyticsData(): List<EventPair<*>>
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.openapi.extensions.AreaInstance
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.jetbrains.packagesearch.intellij.plugin.util.asCoroutine
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
interface AsyncModuleTransformer {
|
||||
|
||||
companion object {
|
||||
private val extensionPointName = ExtensionPointName<AsyncModuleTransformer>("com.intellij.packagesearch.asyncModuleTransformer")
|
||||
|
||||
internal fun extensions(areaInstance: AreaInstance): List<ModuleTransformer> {
|
||||
return extensionPointName.getExtensionList(areaInstance).asSequence().map { it.asCoroutine() }.toList()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IMPORTANT: This function is NOT invoked inside a read action.
|
||||
*
|
||||
* Transforms [nativeModules] in a [PackageSearchModule] module if possible, else returns an empty list.
|
||||
* Its implementation should use the IntelliJ platform APIs for a given build system (eg.
|
||||
* Gradle or Maven), detect if and which [nativeModules] are controlled by said build system
|
||||
* and transform them accordingly.
|
||||
*
|
||||
* NOTE: some [Module]s in [nativeModules] may be already disposed or about to be. Be sure to
|
||||
* handle any exceptions and filter out the ones not working.
|
||||
*
|
||||
* @param nativeModules The native [Module]s that will be transformed.
|
||||
* @return [PackageSearchModule]s wrapping [nativeModules] or an empty list.
|
||||
*/
|
||||
fun transformModules(project: Project, nativeModules: List<Module>): CompletableFuture<List<PackageSearchModule>>
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
|
||||
data class BuildSystemType(
|
||||
val name: String,
|
||||
val language: String,
|
||||
val dependencyAnalyzerKey: ProjectSystemId? = null
|
||||
) {
|
||||
|
||||
companion object
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
/**
|
||||
* Provider interface for creating [ConfigurableContributorDriver]s.
|
||||
*/
|
||||
interface ConfigurableContributor {
|
||||
|
||||
companion object {
|
||||
|
||||
private val extensionPointName: ExtensionPointName<ConfigurableContributor> =
|
||||
ExtensionPointName.create("com.intellij.packagesearch.configurableContributor")
|
||||
|
||||
/**
|
||||
* Returns all known [ConfigurableContributor] implementations.
|
||||
*/
|
||||
fun extensionsForProject(project: Project): List<ConfigurableContributor> =
|
||||
extensionPointName.getExtensionList(project)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a [ConfigurableContributorDriver] that allows to modify the settings UI panel for Package Search.
|
||||
*/
|
||||
fun createDriver(): ConfigurableContributorDriver
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2000-2022 JetBrains s.r.o. and contributors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.jetbrains.packagesearch.intellij.plugin.extensibility
|
||||
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
|
||||
/**
|
||||
* Provides an entrypoint to add custom UI to the settings panel under Package Search entry.
|
||||
*/
|
||||
interface ConfigurableContributorDriver {
|
||||
|
||||
/**
|
||||
* Invoked with a [builder] to use to build the interface. Use [builder] to add custom UI to the settings panel.
|
||||
*/
|
||||
fun contributeUserInterface(builder: FormBuilder)
|
||||
|
||||
/**
|
||||
* Checks if the users has modified some settings.
|
||||
*/
|
||||
fun isModified(): Boolean
|
||||
|
||||
/**
|
||||
* Resets the settings to a state before the user has modified any of them.
|
||||
*/
|
||||
fun reset()
|
||||
|
||||
/**
|
||||
* Restores defaults settings.
|
||||
*/
|
||||
fun restoreDefaults()
|
||||
|
||||
/**
|
||||
* Applies all changes made by the user.
|
||||
*/
|
||||
fun apply()
|
||||
}
|
||||