/** * Features for a [FilePosition]. * * For example, if we detect an error message, the the message can be highlighted, * and right-clicking the text will show the available features. * * See Diff.feather - It uses FilePosition for each change. */ class BasicFilePosition : SimpleComponent() { // ==== Register ==== override meth register() { addFeatures( Context.FILE_POSITION ).apply { val jumpTo = contextAction( "Jump to", ::jumpTo ) contextMenu( jumpTo ) } } // ==== Actions ==== func jumpTo( context : Context ) { val position = context.value as FilePosition val container = openFile( position.file ) if (container != null) { val behaviour = container.behaviour if (behaviour is TextBehaviour) { (behaviour as TextBehaviour).moveTo( position.row, position.column ) } } } }