User: rednesto Date: 20 Jan 23 17:25 Revision: a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5 Summary: 2023.1 EAP TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=8235&personal=false Index: gradle.properties =================================================================== --- gradle.properties (revision 7aa54bc92bfc7d51d13f90e27444386455ff2c64) +++ gradle.properties (revision a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5) @@ -11,13 +11,13 @@ # suppress inspection "UnusedProperty" for whole file kotlin.code.style=official -ideaVersion = 223-EAP-SNAPSHOT -ideaVersionName = 2022.3 +ideaVersion = 231-EAP-SNAPSHOT +ideaVersionName = 2023.1 coreVersion = 1.5.21 downloadIdeaSources = true -pluginTomlVersion = 223.4884.72 +pluginTomlVersion = 231.4840.388 # Silences a build-time warning because we are bundling our own kotlin library kotlin.stdlib.default.dependency = true Index: gradle/libs.versions.toml =================================================================== --- gradle/libs.versions.toml (revision 7aa54bc92bfc7d51d13f90e27444386455ff2c64) +++ gradle/libs.versions.toml (revision a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5) @@ -19,7 +19,7 @@ grammarKit = "org.jetbrains.idea:grammar-kit:1.5.1" # Gradle Tooling -gradleToolingExtension = "com.jetbrains.intellij.gradle:gradle-tooling-extension:223-EAP-SNAPSHOT" +gradleToolingExtension = "com.jetbrains.intellij.gradle:gradle-tooling-extension:231-EAP-SNAPSHOT" annotations = "org.jetbrains:annotations:23.0.0" groovy = "org.codehaus.groovy:groovy-all:2.5.18" Index: src/main/kotlin/platform/forge/inspections/simpleimpl/AddEmptyConstructorInspectionGadgetsFix.kt =================================================================== --- src/main/kotlin/platform/forge/inspections/simpleimpl/AddEmptyConstructorInspectionGadgetsFix.kt (revision 7aa54bc92bfc7d51d13f90e27444386455ff2c64) +++ src/main/kotlin/platform/forge/inspections/simpleimpl/AddEmptyConstructorInspectionGadgetsFix.kt (revision a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5) @@ -22,7 +22,7 @@ private val pointer: SmartPsiElementPointer = element.createSmartPointer() - override fun doFix(project: Project, descriptor: ProblemDescriptor?) { + override fun doFix(project: Project, descriptor: ProblemDescriptor) { val clazz = pointer.element ?: return clazz.addBefore(JavaPsiFacade.getElementFactory(project).createConstructor(), clazz.methods[0]) } Index: src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision 7aa54bc92bfc7d51d13f90e27444386455ff2c64) +++ src/main/kotlin/platform/mcp/actions/GotoAtEntryAction.kt (revision a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5) @@ -17,15 +17,11 @@ import com.demonwav.mcdev.util.ActionData import com.demonwav.mcdev.util.getDataFromActionEvent import com.demonwav.mcdev.util.gotoTargetElement -import com.demonwav.mcdev.util.invokeLater import com.demonwav.mcdev.util.qualifiedMemberReference import com.demonwav.mcdev.util.simpleQualifiedMemberReference import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.ui.popup.Balloon -import com.intellij.openapi.ui.popup.JBPopupFactory -import com.intellij.openapi.wm.WindowManager import com.intellij.psi.PsiField import com.intellij.psi.PsiIdentifier import com.intellij.psi.PsiManager @@ -34,8 +30,6 @@ import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.PsiSearchHelper import com.intellij.psi.search.UsageSearchContext -import com.intellij.ui.LightColors -import com.intellij.ui.awt.RelativePoint class GotoAtEntryAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { @@ -107,16 +101,6 @@ } private fun showBalloon(e: AnActionEvent) { - val balloon = JBPopupFactory.getInstance() - .createHtmlTextBalloonBuilder("No access transformer entry found", null, LightColors.YELLOW, null) - .setHideOnAction(true) - .setHideOnClickOutside(true) - .setHideOnKeyOutside(true) - .createBalloon() - - val project = e.project ?: return - val statusBar = WindowManager.getInstance().getStatusBar(project) - - invokeLater { balloon.show(RelativePoint.getCenterOf(statusBar.component), Balloon.Position.atRight) } + SrgActionBase.showBalloon("No access transformer entry found", e) } } Index: src/main/kotlin/platform/mcp/actions/SrgActionBase.kt =================================================================== --- src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision 7aa54bc92bfc7d51d13f90e27444386455ff2c64) +++ src/main/kotlin/platform/mcp/actions/SrgActionBase.kt (revision a0e4482c23bb9be3b963d5cdf3b8a4acf38e5ef5) @@ -29,6 +29,8 @@ import com.intellij.psi.PsiReference import com.intellij.ui.LightColors import com.intellij.ui.awt.RelativePoint +import java.awt.Point +import javax.swing.JComponent abstract class SrgActionBase : AnAction() { @@ -74,22 +76,37 @@ .createBalloon() val project = e.project ?: return - val statusBar = WindowManager.getInstance().getStatusBar(project) invokeLater { val element = getDataFromActionEvent(e)?.element val editor = getDataFromActionEvent(e)?.editor - val at = if (element != null && editor != null) { + if (element != null && editor != null) { val pos = editor.offsetToVisualPosition(element.textRange.endOffset - element.textLength / 2) - RelativePoint( + val at = RelativePoint( editor.contentComponent, editor.visualPositionToXY(VisualPosition(pos.line + 1, pos.column)) ) - } else RelativePoint.getCenterOf(statusBar.component) - balloon.show(at, Balloon.Position.below) + balloon.show(at, Balloon.Position.below) + return@invokeLater - } + } + + val statusBar = WindowManager.getInstance().getStatusBar(project) + val statusBarComponent = statusBar.component + if (statusBarComponent != null) { + balloon.show(RelativePoint.getCenterOf(statusBarComponent), Balloon.Position.below) + return@invokeLater - } + } + val focused = WindowManager.getInstance().getFocusedComponent(project) + if (focused is JComponent) { + balloon.show(RelativePoint.getCenterOf(focused), Balloon.Position.below) + return@invokeLater + } + + balloon.show(RelativePoint.fromScreen(Point()), Balloon.Position.below) + } + } + fun showSuccessBalloon(editor: Editor, element: PsiElement, text: String) { val balloon = JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(text, null, LightColors.SLIGHTLY_GREEN, null)