Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated API usage #224

Merged
merged 7 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

### Changed

- Fix deprecated API usages

## [2.0.8] - 2025-01-16

### Changed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.jfrog.conan.clion
pluginName = Conan
pluginRepositoryUrl = https://github.com/conan-io/conan-clion-plugin/
# SemVer format -> https://semver.org
pluginVersion = 2.0.8
pluginVersion = 2.0.9

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 241
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package com.jfrog.conan.clion.conan.extensions

import com.intellij.openapi.diagnostic.thisLogger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.io.File
import java.net.URL
import java.net.URI

fun File.downloadFromUrl(url: String) {
val targetFile = this

try {
val fileUrl = URL(url)
val fileUrl = URI(url).toURL()
fileUrl.openStream().use { input ->
targetFile.outputStream().use { output ->
input.copyTo(output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ import javax.swing.BoxLayout
import javax.swing.JComponent
import javax.swing.JPanel

object ConanExecutableChooserDescriptor : FileChooserDescriptor(true, true, false, false, false, false) {
object ConanExecutableChooserDescriptor : FileChooserDescriptor(true, false, false, false, false, false) {
init {
withFileFilter { it.isConanExecutable }
withTitle("Select Conan executable")
}

AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
override fun isFileSelectable(file: VirtualFile?): Boolean {
return super.isFileSelectable(file) && file != null && !file.isDirectory
}
}

val VirtualFile.isConanExecutable: Boolean
Expand Down Expand Up @@ -128,7 +124,8 @@ class ConanExecutableDialogWrapper(val project: Project) : DialogWrapper(true) {
updateOkButtonState()
updateOkButtonState()
}
conanExecutablePathField.textField.whenTextChanged {

conanExecutablePathField.whenTextChanged {
updateOkButtonState()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ConanService(val project: Project) {

private val onConfiguredListeners: HashMap<String, (isConfigured: Boolean) -> Unit> = hashMapOf()
private val onLibraryDataChangeListeners: HashMap<String, (newLibraryData: LibraryData) -> Unit> = hashMapOf()
private val jsoner = Json { ignoreUnknownKeys = true }

fun addOnConfiguredListener(name: String, callback: (isConfigured: Boolean)->Unit) {
onConfiguredListeners[name] = callback
Expand Down Expand Up @@ -190,7 +191,7 @@ class ConanService(val project: Project) {
val libraryData = targetFile.readText()

try {
val parsedJson = Json{ignoreUnknownKeys=true}.decodeFromString<LibraryData>(libraryData)
val parsedJson = jsoner.decodeFromString<LibraryData>(libraryData)
fireOnLibraryDataChanged(parsedJson)
} catch (e: SerializationException) {
thisLogger().error(e)
Expand All @@ -202,7 +203,7 @@ class ConanService(val project: Project) {
fun getTargetData(): LibraryData {
return try {
val targetData = getTargetDataText()
Json { ignoreUnknownKeys = true }.decodeFromString<LibraryData>(targetData)
jsoner.decodeFromString<LibraryData>(targetData)
} catch (e: SerializationException) {
thisLogger().error(e)
LibraryData(hashMapOf())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@
}

private fun generateThemeStyles(): String {
val themeScheme = LafManager.getInstance().currentLookAndFeel
val themeScheme = LafManager.getInstance().currentUIThemeLookAndFeel

Check warning on line 115 in src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'getCurrentUIThemeLookAndFeel()' is unstable because its signature references unstable 'com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo' marked with @ApiStatus.Experimental

val lafClassName = themeScheme.className ?: "com.intellij.ide.ui.laf.intellij.IntelliJLookAndFeel"
// TODO: make more advanced theme detection?
val isDarkTheme = lafClassName.contains("Darcula", ignoreCase = true)
val isDarkTheme = themeScheme.isDark

Check warning on line 117 in src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'isDark()' is declared in unstable 'com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo' marked with @ApiStatus.Experimental
val foregroundColor = if (isDarkTheme) Color(187, 187, 187) else Color(0, 0, 0)
val backgroundColor = if (isDarkTheme) Color(60, 63, 65) else Color(242, 242, 242)
val linkColor = if (isDarkTheme) Color(187, 134, 252) else Color(0, 0, 238)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@
}

private fun generateThemeStyles(): String {
val themeScheme = LafManager.getInstance().currentLookAndFeel
val themeScheme = LafManager.getInstance().currentUIThemeLookAndFeel

Check warning on line 116 in src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'getCurrentUIThemeLookAndFeel()' is unstable because its signature references unstable 'com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo' marked with @ApiStatus.Experimental

val lafClassName = themeScheme.className ?: "com.intellij.ide.ui.laf.intellij.IntelliJLookAndFeel"
// TODO: make more advanced theme detection?
val isDarkTheme = lafClassName.contains("Darcula", ignoreCase = true)
val isDarkTheme = themeScheme.isDark

Check warning on line 118 in src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'isDark()' is declared in unstable 'com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo' marked with @ApiStatus.Experimental
val foregroundColor = if (isDarkTheme) Color(187, 187, 187) else Color(0, 0, 0)
val backgroundColor = if (isDarkTheme) Color(60, 63, 65) else Color(242, 242, 242)
val linkColor = if (isDarkTheme) Color(187, 134, 252) else Color(0, 0, 238)
Expand Down
Loading