Skip to content

Commit

Permalink
proper way to pass context from the current UI component into an acti…
Browse files Browse the repository at this point in the history
…on (even though it's an experimental API)
  • Loading branch information
dkandalov committed Sep 26, 2024
1 parent 34030ae commit a8fcd1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/activitytracker/PluginUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class PluginUI(
override fun getAlignment() = Component.CENTER_ALIGNMENT
override fun getTooltipText() = "Click to open menu"
override fun getClickConsumer() = Consumer { mouseEvent: MouseEvent ->
val popup = createListPopup(MapDataContext().put(PlatformDataKeys.CONTEXT_COMPONENT.name, mouseEvent.component))
@Suppress("UnstableApiUsage")
val popup = createListPopup(IdeUiService.getInstance().createUiDataContext(mouseEvent.component))
val point = Point(0, -popup.content.preferredSize.height)
popup.show(RelativePoint(mouseEvent.component, point))
}
Expand Down

0 comments on commit a8fcd1a

Please sign in to comment.