/*
  * Extends this method to update check box states.
  */
 protected void doUpdateItem(Item item, Object element) {
   super.doUpdateItem(item, element);
   if (!item.isDisposed() && checkStateProvider != null) {
     setChecked(element, checkStateProvider.isChecked(element));
     setGrayed(element, checkStateProvider.isGrayed(element));
   }
 }
    @Override
    public void handleEvent(Event e) {

      Item selection = getSelection(e.widget);

      if (selection == null || selection.isDisposed() || this.selection == selection) {
        return;
      }

      Item[] items = getItems(e.widget);
      int selectionIndex = getSelectionIndex(e.widget);

      boolean selectionSet = false;

      CSSStyleDeclaration selectedStyle =
          engine.getViewCSS().getComputedStyle(engine.getElement(selection), "selected");
      if (selectedStyle != null) {
        CSSValue value = selectedStyle.getPropertyCSSValue("show-close");
        if (value != null) {
          setShowClose(selection, Boolean.parseBoolean(value.getCssText()));
          selectionSet = true;
        }
      }

      CSSStyleDeclaration unselectedStyle =
          engine.getViewCSS().getComputedStyle(engine.getElement(selection), null);
      if (unselectedStyle == null) {
        for (int i = 0; i < items.length; i++) {
          if (selectionSet && i != selectionIndex) {
            setShowClose(items[i], false);
          }
        }
      } else {
        CSSValue value = unselectedStyle.getPropertyCSSValue("show-close");
        boolean unselectedShowClose =
            value == null ? false : Boolean.parseBoolean(value.getCssText());
        for (int i = 0; i < items.length; i++) {
          if (selectionSet && i != selectionIndex) {
            setShowClose(items[i], unselectedShowClose);
          }
        }
      }

      this.selection = selection;
    }
  private void updateItem(Item item) {
    if (!item.isDisposed()) { // defensive code
      ILabelProvider lprovider = (ILabelProvider) fContentViewer.getLabelProvider();

      Object data = item.getData();

      String oldText = item.getText();
      String text = lprovider.getText(data);
      if (text != null && !text.equals(oldText)) {
        item.setText(text);
      }

      Image oldImage = item.getImage();
      Image image = lprovider.getImage(data);
      if (image != null && !image.equals(oldImage)) {
        item.setImage(image);
      }
    }
  }
  @Override
  protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
    boolean oldBusy = isBusy();
    setBusy(true);
    try {
      if (widget instanceof Item) {
        final Item item = (Item) widget;

        // remember element we are showing
        if (fullMap) {
          associate(element, item);
        } else {
          Object data = item.getData();
          if (data != null) {
            unmapElement(data, item);
          }
          item.setData(element);
          mapElement(element, item);
        }

        int columnCount = doGetColumnCount();
        if (columnCount == 0) columnCount = 1; // If there are no columns do the first one

        ViewerRow viewerRowFromItem = getViewerRowFromItem(item);

        boolean isVirtual = (getControl().getStyle() & SWT.VIRTUAL) != 0;

        // If the control is virtual, we cannot use the cached viewer row object. See bug 188663.
        if (isVirtual) {
          viewerRowFromItem = (ViewerRow) viewerRowFromItem.clone();
        }

        // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT -
        // TableViewer with 0 columns does not work
        for (int column = 0; column < columnCount || column == 0; column++) {
          ViewerColumn columnViewer = getViewerColumn(column);
          ViewerCell cellToUpdate = updateCell(viewerRowFromItem, column, element);

          // If the control is virtual, we cannot use the cached cell object. See bug 188663.
          if (isVirtual) {
            cellToUpdate =
                new ViewerCell(cellToUpdate.getViewerRow(), cellToUpdate.getColumnIndex(), element);
          }

          columnViewer.refresh(cellToUpdate);

          // clear cell (see bug 201280)
          updateCell(null, 0, null);

          // As it is possible for user code to run the event
          // loop check here.
          if (item.isDisposed()) {
            unmapElement(element, item);
            return;
          }
        }
      }
    } finally {
      setBusy(oldBusy);
    }
  }