diff --git a/bpmn-intellij-plugin-commons/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/commons/actions/DefaultAttachBpmnDebuggerToDbAction.kt b/bpmn-intellij-plugin-commons/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/commons/actions/DefaultAttachBpmnDebuggerToDbAction.kt index 3898bbb50..5b52aec8c 100644 --- a/bpmn-intellij-plugin-commons/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/commons/actions/DefaultAttachBpmnDebuggerToDbAction.kt +++ b/bpmn-intellij-plugin-commons/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/commons/actions/DefaultAttachBpmnDebuggerToDbAction.kt @@ -74,7 +74,7 @@ abstract class IntelliJBpmnDebugger(private val schema: DbElement): BpmnDebugger private fun fetchFromDb(project: Project, processId: String): ExecutedElements? { try { val connProvider = DbImplUtil.getDatabaseConnection(schema, DGDepartment.INTROSPECTION)?.get() - // Old IntelliJ provides only getJdbcConnection + // TODO !COMPATIBILITY: Old IntelliJ provides only getJdbcConnection try { val jdbcSupplier = connProvider?.javaClass?.getMethod("getJdbcConnection") if (true != jdbcSupplier?.isAccessible) { diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/CanvasConstants.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/CanvasConstants.kt index 4a92d8e51..02d12049a 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/CanvasConstants.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/CanvasConstants.kt @@ -1,6 +1,5 @@ package com.valb3r.bpmn.intellij.plugin.core.render -import com.intellij.util.ui.UIUtil import java.awt.geom.Point2D interface CanvasConstants { @@ -12,9 +11,20 @@ interface CanvasConstants { } data class DefaultCanvasConstants( - override val epsilon: Float = 0.1f, - override val anchorAttractionThreshold: Float = 5.0f, - override val baseCursorSize: Float = if (UIUtil.isJreHiDPIEnabled()) 20.0f else 10.0f, - override val defaultCameraOrigin: Point2D.Float = Point2D.Float(0f, 0f), - override val defaultZoomRatio: Float = 1f + override val epsilon: Float = 0.1f, + override val anchorAttractionThreshold: Float = 5.0f, + override val baseCursorSize: Float = if (isJreHiDPIEnabled()) 20.0f else 10.0f, + override val defaultCameraOrigin: Point2D.Float = Point2D.Float(0f, 0f), + override val defaultZoomRatio: Float = 1f ): CanvasConstants + +fun isJreHiDPIEnabled(): Boolean { + return try { + val jreHighDpiUtil = Class.forName("com.intellij.ui.JreHiDpiUtil") + jreHighDpiUtil.getMethod("isJreHiDPIEnabled").invoke(null) as Boolean + } catch (ex: Exception) { + // TODO !COMPATIBILITY: com.intellij.util.ui.UIUtil.isJreHiDPIEnabled is scheduled for removal in 2021.3, keeping it as fallback for 2018.1 + val uiUtil = Class.forName("com.intellij.util.ui.UIUtil") + uiUtil.getMethod("isJreHiDPIEnabled").invoke(null) as Boolean + } +} \ No newline at end of file