public void setJsonNodes(List<JsonNode> jsonNodes) {
    fContentProvider.setJsonNodes(jsonNodes);
    if (fContentProvider.rootObject == null) {
      update();
    } else {
      TreeViewer viewer = getTreeViewer();

      if (viewer != null) {
        viewer.refresh();
      }
    }
  }
  /** Moves the outline view to show the element where the cursor in the text editor is placed. */
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {

    if (selection instanceof ITextSelection) {
      ITextSelection textSelection = (ITextSelection) selection;
      int start = textSelection.getOffset();
      int length = textSelection.getLength();

      JsonTreeNode element = fContentProvider.findNearestElement(start, length);
      if (element != null) {
        element.setTextSelection(true);
        getTreeViewer().reveal(element);
        TreeSelection treeSelection = new TreeSelection(new TreePath(new Object[] {element}));
        getTreeViewer().setSelection(treeSelection);
      }
    }
  }
  /* (non-Javadoc)
   * Method declared on ContentOutlinePage
   */
  @Override
  public void createControl(Composite parent) {

    super.createControl(parent);

    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(fContentProvider);
    DelegatingStyledCellLabelProvider delegatingStyledCellLabelProvider =
        new DelegatingStyledCellLabelProvider(new JsonLabelProvider());
    viewer.setLabelProvider(delegatingStyledCellLabelProvider);
    getSite().getPage().addPostSelectionListener(this);

    if (fInput != null) {
      viewer.setInput(fInput);
      fContentProvider.setInput(fInput);
    }
  }
 /**
  * Sets the input of the outline page
  *
  * @param input the input of this outline page
  */
 public void setInput(Object input) {
   fInput = input;
   fContentProvider.setInput(fInput);
   update();
 }