Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.TableTreeItem


            table.setSelection(new TableItem[] { item });
          }
                    selEvent.item = item;
                } else if (w instanceof TableTree) {
                    TableTree table = (TableTree) w;
                    TableTreeItem item = table.getItem(new Point(e.x, e.y));
                    if (item != null) {
            table.setSelection(new TableTreeItem[] { item });
          }
                    selEvent.item = item;
                } else {
View Full Code Here


    if (prov instanceof ITableLabelProvider) {
      tprov = (ITableLabelProvider) prov;
    }

    int columnCount = tableTree.getTable().getColumnCount();
    TableTreeItem ti = (TableTreeItem) item;
    // 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++) {
      String text = "";//$NON-NLS-1$
      Image image = null;
      if (tprov != null) {
        text = tprov.getColumnText(element, column);
        image = tprov.getColumnImage(element, column);
      } else {
        if (column == 0) {
          ViewerLabel updateLabel = new ViewerLabel(item.getText(),
              item.getImage());
          buildLabel(updateLabel, element);

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

          text = updateLabel.getText();
          image = updateLabel.getImage();
        }
      }

      // Avoid setting text to null
      if (text == null) {
        text = ""; //$NON-NLS-1$
      }

      ti.setText(column, text);
      // Apparently a problem to setImage to null if already null
      if (ti.getImage(column) != image) {
        ti.setImage(column, image);
      }

      getColorAndFontCollector().setFontsAndColors(element);
      getColorAndFontCollector().applyFontsAndColors(ti);
    }
View Full Code Here

   *         index is out of range
   */
  public Object getElementAt(int index) {
    // XXX: Workaround for 1GBCSB1: SWT:WIN2000 - TableTree should have
    // getItem(int index)
    TableTreeItem i = tableTree.getItems()[index];
    if (i != null) {
      return i.getData();
    }
    return null;
  }
View Full Code Here

  /*
   * (non-Javadoc) Method declared in AbstractTreeViewer.
   */
  protected Item newItem(Widget parent, int flags, int ix) {
    TableTreeItem item;
    if (ix >= 0) {
      if (parent instanceof TableTreeItem) {
        item = new TableTreeItem((TableTreeItem) parent, flags, ix);
      } else {
        item = new TableTreeItem((TableTree) parent, flags, ix);
      }
    } else {
      if (parent instanceof TableTreeItem) {
        item = new TableTreeItem((TableTreeItem) parent, flags);
      } else {
        item = new TableTreeItem((TableTree) parent, flags);
      }
    }
    return item;
  }
View Full Code Here

    }
    return (FeatureDescription[]) result.toArray(new FeatureDescription[result.size()]);
  }

  private void addTypeToGUI(TypeDescription td) {
    TableTreeItem item = new TableTreeItem(tt, SWT.NONE);
    item.setText(NAME_COL, formatName(td.getName()));
    item.setText(SUPER_COL, formatName(td.getSupertypeName()));
    item.setData(td);
    setItemColor(item, isLocalType(td));

    FeatureDescription[] features = td.getFeatures();
    addFeaturesToGui(td, item, features);

    TypeDescription builtInTd = getBuiltInTypeDescription(td);
    if (null != builtInTd) {
      FeatureDescription[] additionalBuiltInFeatures = setDifference(builtInTd.getFeatures(), td
              .getFeatures());
      addFeaturesToGui(td, item, additionalBuiltInFeatures);
    }

    AllowedValue[] avs = td.getAllowedValues();
    if (null != avs) {
      for (int i = 0; i < avs.length; i++) {
        TableTreeItem avItem = new TableTreeItem(item, SWT.NONE);
        avItem.setText(NAME_COL, HEADER_ALLOWED_VALUE);
        avItem.setText(AV_COL, convertNull(avs[i].getString()));
        avItem.setData(avs[i]);
        setItemColor(avItem, null != getLocalAllowedValue(td, avs[i]));
      }
    }
    // No built-ins have "allowed values" so we don't have to add any
    item.setExpanded(true);
View Full Code Here

  private void addFeaturesToGui(TypeDescription td, TableTreeItem item,
          FeatureDescription[] features) {
    if (null != features) {
      for (int i = 0; i < features.length; i++) {
        TableTreeItem fItem = new TableTreeItem(item, SWT.NONE);
        updateGuiFeature(fItem, features[i], td);
      }
    }
  }
View Full Code Here

   */
  public void handleEvent(Event event) {
    if (event.widget == addTypeButton) {
      handleAddType();
    } else if (event.widget == addButton) {
      TableTreeItem parent = tt.getSelection()[0];
      if (null != parent.getParentItem())
        parent = parent.getParentItem();

      if (isSubtypeOfString(parent))
        handleAddAllowedValue(parent);
      else
        handleAddFeature(parent);
View Full Code Here

    enable();
  }

  public void handleHover(Event event) {
    // next getItem call requires that table have SWT.FULL_SELECTION Style
    TableTreeItem item = tt.getItem(new Point(event.x, event.y));
    if (null != item) {
      Object o = item.getData();
      if (null == o)
        throw new InternalErrorCDE("invalid state");

      if (o instanceof TypeDescription) {
        setToolTipText(tt, ((TypeDescription) o).getDescription());
      } else if (o instanceof FeatureDescription) {
        FeatureDescription fd = (FeatureDescription) o;
        if (item.getBounds(MULTIPLE_REF_OK_COL).contains(event.x, event.y)
                && isArrayOrListType(fd.getRangeTypeName())) {
          Boolean mra = fd.getMultipleReferencesAllowed();
          setToolTipText(tt, (mra != null && mra.booleanValue()) ? "Multiple References Allowed"
                  : "Multiple References Not Allowed");
        } else
View Full Code Here

    // update the GUI
    if (refreshNeeded)
      refresh();
    else {
      TableTreeItem item = new TableTreeItem(parent, SWT.NONE);
      item.setText(NAME_COL, HEADER_ALLOWED_VALUE);
      item.setText(AV_COL, convertNull(av.getString()));
      item.setData(av);

      parent.setExpanded(true);
    }

    editor.addDirtyTypeName(td.getName());
View Full Code Here

      finishAction();
    } else {
      fd = td.addFeature(null, null, null);
      featureUpdate(fd, dialog);
      TableTreeItem item = new TableTreeItem(parent, SWT.NONE);
      updateGuiFeature(item, fd, td);
      parent.setExpanded(true);
      finishActionPack();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.TableTreeItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.