override fun mousePressed()

in code/debugger/src/main/kotlin/org/fbme/debugger/simulator/ui/SimulatorPanel.kt [35:62]


            override fun mousePressed(e: MouseEvent) {
                if (e.isPopupTrigger) {
                    val popup = JBPopupMenu()
                    val watchPath = watchesTree
                        .selectionPath
                        ?.path
                        ?.toList()
                        ?.map { it.toString() }
                        ?.drop(1)
                        ?.joinToString(".")
                        ?.split(".")
                    val triggerItem = JBMenuItem("Trigger event", AllIcons.Actions.Execute)
                    triggerItem.addActionListener {
                        if (watchPath != null) {
                            val resolvedSimulator = simulator
                                .resolveSimulator(watchPath.dropLast(1))!! as FBSimulator
                            resolvedSimulator.triggerEvent(watchPath.last())
                        }
                    }
                    popup.add(triggerItem)
                    val explainItem = JBMenuItem("Why?", AllIcons.Debugger.Question_badge)
                    explainItem.addActionListener {
                        showExplanation(e)
                    }
                    popup.add(explainItem)
                    popup.show(e.component, e.x, e.y)
                }
            }