void (SelectionEvent selectionEvent) { TextRange newSelectionRange = selectionEvent.getNewRange(); if (newSelectionRange == null || newSelectionRange.isEmpty()) { targetSelectionState.isExists = false; } else { int startOffset = newSelectionRange.getStartOffset(); int endOffset = newSelectionRange.getEndOffset(); AbsoluteSymbolPosition startAbsolutePosition = documentOfPagesModel.offsetToAbsoluteSymbolPosition(startOffset); AbsoluteSymbolPosition endAbsolutePosition = documentOfPagesModel.offsetToAbsoluteSymbolPosition(endOffset); targetSelectionState.set(startAbsolutePosition, endAbsolutePosition); targetSelectionState.isExists = true; } }