diff --git a/src/main/kotlin/com/jfrog/conan/clion/services/ConanPluginInit.kt b/src/main/kotlin/com/jfrog/conan/clion/services/ConanPluginInit.kt deleted file mode 100644 index 58e7cfa8..00000000 --- a/src/main/kotlin/com/jfrog/conan/clion/services/ConanPluginInit.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.jfrog.conan.clion.services - -import com.intellij.openapi.components.service -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupActivity - - -class ConanPluginInit : StartupActivity { - override fun runActivity(project: Project) { - project.service().downloadLibraryData() - } -} diff --git a/src/main/kotlin/com/jfrog/conan/clion/services/ConanService.kt b/src/main/kotlin/com/jfrog/conan/clion/services/ConanService.kt index c79cdc44..1640b30a 100644 --- a/src/main/kotlin/com/jfrog/conan/clion/services/ConanService.kt +++ b/src/main/kotlin/com/jfrog/conan/clion/services/ConanService.kt @@ -30,7 +30,7 @@ class ConanService(val project: Project) { fun onWindowReady() { fireOnConfiguredListeners(isPluginConfigured()) - fireOnLibraryDataChanged(getRemoteData()) + fireOnLibraryDataChanged(getTargetData()) } fun fireOnConfiguredListeners(isConfigured: Boolean) { @@ -161,6 +161,9 @@ class ConanService(val project: Project) { if (!targetFile.exists() || update && ConanPluginUtils.fileHasOverwriteComment(targetFile)) { targetFile.parentFile.mkdirs() targetFile.downloadFromUrl(cmakeProviderURL) + // TODO: Check if cmakeProviderURL was downloaded correctly, + // else save the copy from the plugin into the project + // Re-write it, but adding the overwrite header ConanPluginUtils.writeToFileWithOverwriteComment(targetFile, targetFile.readText()) LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile) @@ -196,9 +199,9 @@ class ConanService(val project: Project) { } } - fun getRemoteData(): LibraryData { + fun getTargetData(): LibraryData { return try { - val targetData = getRemoteDataText() + val targetData = getTargetDataText() Json { ignoreUnknownKeys = true }.decodeFromString(targetData) } catch (e: SerializationException) { thisLogger().error(e) @@ -206,7 +209,7 @@ class ConanService(val project: Project) { } } - fun getRemoteDataText(): String { + fun getTargetDataText(): String { val userHomeFile = getRemoteDataFile() if (!userHomeFile.exists()) { val defaultFile = ConanService::class.java.classLoader.getResource("conan/targets-data.json") diff --git a/src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt b/src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt index 3cd508fa..043d26c5 100644 --- a/src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt +++ b/src/main/kotlin/com/jfrog/conan/clion/toolWindow/ReadmePanel.kt @@ -23,8 +23,8 @@ class ReadmePanel(val project: Project) { } } - private val targetsData = project.service().getRemoteDataText() - private val libraryData = project.service().getRemoteData() + private val targetsDataAsText = project.service().getTargetDataText() + private val libraryData = project.service().getTargetData() fun getTitleHtml(name: String): String { val description = libraryData.libraries[name]?.description @@ -43,7 +43,7 @@ class ReadmePanel(val project: Project) { private fun getScript(name: String): String { return """ function fillExtraData() { - const data = $targetsData; + const data = $targetsDataAsText; const libraries = data["libraries"] const infoDiv = document.getElementById("info"); const selected_lib = "$name"; diff --git a/src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt b/src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt index af5255da..5e0d545f 100644 --- a/src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt +++ b/src/main/kotlin/com/jfrog/conan/clion/toolWindow/UsedPackagesPanel.kt @@ -19,7 +19,7 @@ class UsedPackagesPanel(val project: Project) { setOpenLinksInExternalBrowser(true) } - private val libraryData = project.service().getRemoteData() + private val libraryData = project.service().getTargetData() private fun getScript(names: List): String { val filteredLibraryData = LibraryData(libraries = HashMap()) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 897fc695..725afaf8 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -29,7 +29,6 @@ -