Skip to content

Commit

Permalink
Released 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyr committed May 6, 2020
1 parent 6618657 commit e3962be
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
Binary file modified GoogleLibraryVersionQuerier.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.wuyr.google_library_query</id>
<name>Google Library Version Querier</name>
<version>2.0</version>
<version>2.1</version>
<vendor email="ifxcyr@gmail.com" url="https://github.com/wuyr">陈小缘</vendor>

<description><![CDATA[
Expand All @@ -13,12 +13,13 @@
]]></description>

<change-notes><![CDATA[
<p><li><strong>2.1 </strong>Bug fixes.</li></p>
<p><li><strong>2.0 </strong>Add build.gradle dependency code completion and free choice of historical version.</li></p>
<p><li><strong>1.0 </strong>Completed the function of finding and replacing the latest version of Google Library.</li></p>
<br>
]]>
</change-notes>
]]></change-notes>

<idea-version since-build="173.0"/>

Expand Down
Binary file modified previews/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.wuyr.google_library_query</id>
<name>Google Library Version Querier</name>
<version>2.0</version>
<version>2.1</version>
<vendor email="ifxcyr@gmail.com" url="https://github.com/wuyr">陈小缘</vendor>

<description><![CDATA[
Expand All @@ -13,12 +13,13 @@
]]></description>

<change-notes><![CDATA[
<p><li><strong>2.1 </strong>Bug fixes.</li></p>
<p><li><strong>2.0 </strong>Add build.gradle dependency code completion and free choice of historical version.</li></p>
<p><li><strong>1.0 </strong>Completed the function of finding and replacing the latest version of Google Library.</li></p>
<br>
]]>
</change-notes>
]]></change-notes>

<idea-version since-build="173.0"/>

Expand Down
1 change: 0 additions & 1 deletion src/com/wuyr/google_library_query/NetworkRequstter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ fun getAvailableVersions(libraryGroup: String, libraryName: String) = search("$l
}
}

@Throws(java.lang.Exception::class)
fun matchingLibraries(keyword: String) = ArrayList<Pair<String, String>>().apply {
runSafely {
search(keyword) { dataList ->
Expand Down
14 changes: 8 additions & 6 deletions src/com/wuyr/google_library_query/QueryAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class QueryAction : AnAction() {

val semicolon = ":"
if (!currentLineContent.contains(semicolon)) {
Messages.showErrorDialog("Please locate the line of the target library.", "Library Not Found")
return
}

Expand All @@ -50,22 +51,23 @@ class QueryAction : AnAction() {

try {
getAvailableVersions(libraryGroup, libraryName)?.let {
VersionSelectorDialog.show(DefaultListModel<String>().apply {
getAvailableVersions(libraryGroup, libraryName)?.forEach { addElement(it) }
}) { latestVersion ->
VersionSelectorDialog.show(DefaultListModel<String>().apply { it.forEach { addElement(it) } }) { selectedVersion ->
val oldVersionStart = currentLineContent.lastIndexOf(semicolon)
val oldVersionEnd = currentLineContent.lastIndexOf(if (isSingleQuotation) singleQuotation else doubleQuotation)
val oldVersionString = currentLineContent.substring(oldVersionStart, oldVersionEnd)
val newLineContent = currentLineContent.replace(oldVersionString, semicolon + latestVersion)
val newLineContent = currentLineContent.replace(oldVersionString, semicolon + selectedVersion)

WriteCommandAction.runWriteCommandAction(event.project) {
editor.document.replaceString(lineStartPosition, lineEndPosition, newLineContent)
}
}
}
?: Messages.showErrorDialog("Please check if the library belongs to Google.", "Library Not Found!")
?: Messages.showErrorDialog("Please check if the library belongs to Google.", "Library Not Found")
} catch (e: Exception) {
Messages.showErrorDialog(StringWriter().apply { PrintWriter(this).apply { RuntimeException().printStackTrace(this) } }.toString(), "Error")
Messages.showErrorDialog(StringWriter().apply { PrintWriter(this).apply {
println("Please copy the following log and go to https://github.com/wuyr/GoogleLibraryVersionQuerier to create a issues:\n")
e.printStackTrace(this)
} }.toString(), "Error")
}
}
}
Expand Down

0 comments on commit e3962be

Please sign in to comment.