in code/scenes/src/main/kotlin/org/fbme/scenes/ext/contextMenu/CellSelectionOnPopupTrigger.kt [16:32]
override fun mousePressed(event: MouseEvent) {
if (!(event.isPopupTrigger || SwingUtilities.isRightMouseButton(event))) {
return
}
val selectionManager = editorComponent.selectionManager
val selection = selectionManager.selection
if (selection != null && isTrivialSelection(selection!!)) {
var leaf = editorComponent.rootCell.findLeaf(event.x, event.y)
if (leaf != null && CellTraversalUtil.getFoldedParent(leaf) != null) {
return
}
if (leaf == null || !leaf.isSelectable) {
leaf = editorComponent.rootCell.findNearestLeafOnLine(event.x, event.y, CellConditions.SELECTABLE)
}
selectionManager.setSelection(leaf)
}
}