/** Selects the text in the editor associated with the item selected in the outline view tree. */
  public void selectionChanged(SelectionChangedEvent event) {

    ISelection selection = event.getSelection();

    if (selection.isEmpty()) fTextEditor.resetHighlightRange();
    else {
      JsonTreeNode jsonTreeNode =
          (JsonTreeNode) ((IStructuredSelection) selection).getFirstElement();
      if (jsonTreeNode.isTextSelection()) {
        jsonTreeNode.setTextSelection(false);
        return;
      }

      int start = jsonTreeNode.getStart();
      int length = jsonTreeNode.getLength();
      try {
        fTextEditor.selectAndReveal(start, length);
      } catch (IllegalArgumentException x) {
        fTextEditor.resetHighlightRange();
      }
    }
  }