Skip to content

Commit

Permalink
Compatibility with IntelliJ 2023.2, version 1.24.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueBoxWare committed Jun 5, 2023
1 parent 5b2c096 commit 1ab61b9
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.24.6
# Fix [#36](https://github.com/BlueBoxWare/LibGDXPlugin/issues/36): UnsupportedOperationException in LibGDXFileTypeOverrider.
# Compatibility with IntelliJ 2023.2.

### 1.24.5
# Compatibility with IntelliJ 2023.1.1.

Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
pluginGroup = com.gmail.blueboxware
pluginName = LibGDX Plugin
pluginVersion = 1.24.5
pluginVersion = 1.24.6

pluginSinceBuild = 231.8770.53
pluginSinceBuild = 232.6095.10
pluginUntilBuild =

# See https://www.jetbrains.com/intellij-repository/snapshots/ for available build versions.
pluginVerifierIdeVersions = 231.8770.53
# https://www.jetbrains.com/intellij-repository/snapshots/
# https://www.jetbrains.com/intellij-repository/releases/
pluginVerifierIdeVersions = 232.6095.10

platformType = IC
platformVersion = 231.8770-EAP-CANDIDATE-SNAPSHOT
platformVersion = 232.6095-EAP-CANDIDATE-SNAPSHOT
platformDownloadSources = true

platformPlugins = java, Kotlin, Groovy, properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.psi.PsiFile
import com.intellij.ui.ColorChooser
import com.intellij.ui.ColorChooserService
import com.intellij.ui.JBColor


Expand Down Expand Up @@ -59,11 +59,12 @@ class CreateColorAction : SimpleCodeInsightAction() {
return
}

ColorChooser.chooseColor(editor.component, "Choose Color To Create", JBColor.WHITE, true)?.let { color ->
ApplicationManager.getApplication().runWriteAction {
file.addColor(result.first, color = color, useComponents = result.second ?: false)
ColorChooserService.instance.showDialog(editor.component, "Choose Color To Create", JBColor.WHITE, true)
?.let { color ->
ApplicationManager.getApplication().runWriteAction {
file.addColor(result.first, color = color, useComponents = result.second ?: false)
}
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.ApplicationManager
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiEditorUtil
import com.intellij.ui.ColorChooser
import com.intellij.ui.ColorChooserService

/*
* Copyright 2016 Blue Box Ware
Expand Down Expand Up @@ -63,7 +63,14 @@ class SkinColorAnnotator : Annotator {

val editor = PsiEditorUtil.findEditor(element) ?: return

val newColor = ColorChooser.chooseColor(editor.component, "Choose Color", color, true, true)
val newColor = ColorChooserService.instance.showDialog(
editor.component,
"Choose Color",
color,
true,
emptyList(),
true
)

if (newColor != null) {
ApplicationManager.getApplication().runWriteAction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class KotlinGDXAssetsInspection : LibGDXKotlinBaseInspection() {
if (argumentExpression is KtCallExpression) {
argumentExpression.valueArgumentList?.arguments?.map { it.getArgumentExpression() }
} else {
(argumentExpression as? KtCollectionLiteralExpression)?.getInnerExpressions()
(argumentExpression as? KtCollectionLiteralExpression)?.innerExpressions
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.gmail.blueboxware.libgdxplugin.utils
import com.intellij.codeInsight.AnnotationUtil
import com.intellij.psi.*
import com.intellij.psi.search.searches.AnnotatedElementsSearch
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.PsiUtil
import org.jetbrains.kotlin.asJava.elements.KtLightAnnotationForSourceEntry
import org.jetbrains.kotlin.asJava.elements.KtLightField
Expand Down Expand Up @@ -49,7 +50,10 @@ class KtAnnotationWrapper(private val ktAnnotationEntry: KtAnnotationEntry) : An
if (name == key) {
val arguments = when (val argumentExpression = argument.getArgumentExpression()) {
is KtCallExpression -> argumentExpression.valueArguments.map { it.getArgumentExpression() }
is KtCollectionLiteralExpression -> argumentExpression.getInnerExpressions()
is KtCollectionLiteralExpression -> PsiTreeUtil.getChildrenOfTypeAsList(
argumentExpression, KtExpression::class.java
)

is KtStringTemplateExpression -> listOf(argumentExpression)
else -> listOf()
}
Expand Down Expand Up @@ -130,8 +134,8 @@ internal fun KtCallExpression.getAnnotation(annotationClass: PsiClass): Annotati

(context as? KtQualifiedExpression)?.receiverExpression?.unwrap()?.let { receiverExpression ->

val annotationTarget = (receiverExpression as? KtQualifiedExpression)?.selectorExpression?.unwrap()
?: receiverExpression
val annotationTarget =
(receiverExpression as? KtQualifiedExpression)?.selectorExpression?.unwrap() ?: receiverExpression

annotationTarget.references.mapNotNull { it.resolve() }.filter { it is KtProperty || it is PsiField }
.let { origins ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import com.intellij.util.PathUtil
import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.idea.base.psi.deleteSingle
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.core.deleteSingle
import org.jetbrains.kotlin.idea.intentions.calleeName
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.allChildren
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

<change-notes><![CDATA[
<ul>
<li>Compatibility with IntelliJ 2023.1.1.</li>
<li>Fix #36: UnsupportedOperationException in LibGDXFileTypeOverrider.</li>
<li>Compatibility with IntelliJ 2023.2.</li>
</ul>
]]>
</change-notes>
Expand Down

0 comments on commit 1ab61b9

Please sign in to comment.