/**
   * Focuses the editor to the text of the selected item.
   *
   * @param event the selection event
   */
  @Override
  public void selectionChanged(SelectionChangedEvent event) {
    super.selectionChanged(event);
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
      editor.resetHighlightRange();
    } else {
      OutlineNode node = (OutlineNode) ((IStructuredSelection) selection).getFirstElement();
      IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());

      Position position = computePosition(node.getAst(), doc);
      if (position != null) {
        try {
          editor.setHighlightRange(position.getOffset(), position.getLength(), true);
          editor.getViewer().revealRange(position.getOffset(), position.getLength());
        } catch (IllegalArgumentException x) {
          editor.resetHighlightRange();
        }
      } else {
        editor.resetHighlightRange();
      }
    }
  }