/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated NOT
   */
  @Override
  public String getDisplayText() {
    Object value = null;
    final IUIAttribute la = getLabelUIAttribute();
    if (la == null) return "";
    final IObservableValue displayValue = la.getCurrentValue();
    if (displayValue != null) {
      value = displayValue.getValue();
    }

    if (value == null) return "";
    return value.toString();
  }
  @Override
  public void build(IFormCreator form, ExecutionEvent event) {
    final IBinding b = (IBinding) form.getObject();
    if (!(b instanceof IValueBinding)) return;
    final IValueBinding vb = (IValueBinding) b;
    final IUIAttribute attribute = vb.getUIAttribute();
    if (attribute == null) return;

    final IFormCreator subform = form.addSection("UI Attribute Information", attribute);

    subform
        .addField(form.getObservableValue(), "uiAttribute(w=300, label='Attribute Class')")
        .type("className");
    subform.addField("attribute");
    subform.addField("changeable");
    subform.addField("widget(w=300)").type("className");

    final IObservableValue currentValue = attribute.getCurrentValue();
    if (currentValue instanceof TextObservableValue) {
      final TextObservableValue tov = (TextObservableValue) currentValue;
      subform.addConstantField("Current Commit Strategy:", tov.getStrategy(), SWT.NONE);
    }
  }
  @Test
  public void testUIAttribute() {
    final Label widget = createWidget(Label.class, SWT.NONE);

    assertNoLog(
        new Runnable() {
          @Override
          public void run() {
            attribute = IManager.Factory.getManager().createUIAttribute(widget, "");
          }
        });

    assertNotNull(attribute);

    assertEquals("", attribute.getAttribute());
    assertEquals(widget, attribute.getWidget());

    testObservableValue(widget, "", attribute.getBackgroundValue(), Color.class, "background");
    testObservableValue(widget, "", attribute.getForegroundValue(), Color.class, "foreground");
    testObservableValue(widget, "", attribute.getFontValue(), Font.class, "font");
    testObservableValue(widget, "", attribute.getCursorValue(), Cursor.class, "cursor");
    testObservableValue(widget, "", attribute.getCurrentValue(), String.class, "text");
    testObservableValue(widget, "", attribute.getEnabledValue(), Boolean.TYPE, "enabled");
    testObservableValue(widget, "", attribute.getTooltipValue(), String.class, "toolTipText");
    assertEquals(null, attribute.getMinValue());
    assertEquals(null, attribute.getMaxValue());
    assertEquals(null, attribute.getFieldAssistAdapter());
    assertEquals(null, attribute.getPossibleValuesList());
    assertEquals(null, attribute.getStyleRangeList());

    widget.dispose();
  }
  /** Updates this cell - delayed. */
  protected void updateCellValuesDelayed() {
    /*
     * Check if the cell has been disposed
     */
    if (getColumn() == null) return;
    // LogUtils.debug(GridBindingCellInformationImpl.this, "");
    final IGridBinding grid = getGrid();
    final GridColumn gridColumn = getColumn().getGridColumn();
    final GridItem gridItem = getRow().getGridItem();

    /*
     * Update the cell
     */
    final IUIAttribute attr = getLabelUIAttribute();
    final IObservableValue currentValue = attr.getCurrentValue();
    if (currentValue.isDisposed()) return;
    final IObservableValue v = getObjectValue();

    final String text = (String) currentValue.getValue();
    final Color foreground = attr.getForeground();
    final Color background = attr.getBackground();
    final Image image = attr.getImage();
    final Font font = attr.getFont();
    final String tooltip = attr.getTooltip();
    // TODO: the rest: cursor, enabled, style range
    if (gridItem == null) {
      /*
       * Column header:
       */
      gridColumn.setText(text == null ? "" : text);
      gridColumn.setImage(image);
      // TODO gridColumn.set
      /*
       * The changes in the column name and image only take effect when the table is redrawn
       */
      grid.getGrid().redraw();
    } else if (gridColumn == null) {
      /*
       * Row Header
       */
      gridItem.setHeaderText(text == null ? "" : text);
      gridItem.setHeaderImage(image);
      gridItem.setHeaderForeground(foreground);
      gridItem.setHeaderBackground(background);
    } else {
      /*
       * Normal cell
       */
      final int index = grid.getGrid().indexOf(gridColumn);
      Assert.isTrue(index != -1);

      // gridItem.setChecked(index, v.getValue() == Boolean.TRUE);
      // gridItem.setText(index, null);
      // gridItem.setImage(index, null);
      // gridItem.setFont(index, null);

      gridItem.setText(index, text == null ? "" : text);
      gridItem.setImage(index, image);
      gridItem.setFont(index, font);
      gridItem.setForeground(index, foreground);
      gridItem.setBackground(index, background);
      gridItem.setToolTipText(index, tooltip);
    }
  }