Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Item


                    } else {
                        int start = getMenuItemCount();
                        doItemFill(src, destIx);
                        int newItems = getMenuItemCount() - start;
                        for (int i = 0; i < newItems; i++) {
                            Item item = getMenuItem(destIx++);
                            item.setData(src);
                        }
                    }

                    // May be we can optimize this call. If the menu has just
                    // been created via the call src.fill(fMenuBar, destIx) then
View Full Code Here


      /* Foreground */
      Color foreground = getForeground(scoredNews.getNews(), cell.getColumnIndex());

      /* This is required to invalidate + redraw the entire TableItem! */
      if (!OwlUI.isHighContrast()) {
        Item item = (Item) cell.getItem();
        if (item instanceof TableItem)
          ((TableItem) cell.getItem()).setForeground(foreground);
      }

      /* Background */
 
View Full Code Here

    /* Foreground */
    Color foreground = getForeground(cell.getElement(), cell.getColumnIndex());

    /* This is required to invalidate + redraw the entire TableItem! */
    if (!OwlUI.isHighContrast()) {
      Item item = (Item) cell.getItem();
      if (item instanceof TreeItem)
        ((TreeItem) cell.getItem()).setForeground(foreground);
      else if (item instanceof TableItem)
        ((TableItem) cell.getItem()).setForeground(foreground);
    }
View Full Code Here

        }
      }

      this.cellEditor = null;
      this.activationEvent = null;
      Item t = (Item) this.cell.getItem();

      // don't null out table item -- same item is still selected
      if (t != null && !t.isDisposed()) {
        saveEditorValue(c);
      }

      setEditor(null, null, 0);
      c.removeListener(cellEditorListener);
View Full Code Here

     */
    protected int determineLocation(DropTargetEvent event) {
        if (!(event.item instanceof Item)) {
            return LOCATION_NONE;
        }
        Item item = (Item) event.item;
        Point coordinates = new Point(event.x, event.y);
        coordinates = viewer.getControl().toControl(coordinates);
        if (item != null) {
            Rectangle bounds = getBounds(item);
            if (bounds == null) {
View Full Code Here

        int index = virtualManager.find(elements[i]);
        if (index != -1) {
          indices[count++] = index;
        }
      } else if (w instanceof Item) {
        Item item = (Item) w;
        disassociate(item);
        indices[count++] = doIndexOf(item);
      }
    }
    if (count < indices.length) {
View Full Code Here

      int count = 0;
      for (int i = 0; i < size; ++i) {
        Object o = list.get(i);
        Widget w = findItem(o);
        if (w instanceof Item) {
          Item item = (Item) w;
          items[count++] = item;
        }
      }
      if (count < size) {
        System.arraycopy(items, 0, items = new Item[count], 0, count);
View Full Code Here

   */
  private void virtualSetSelectionToWidget(List list, boolean reveal) {
    int size = list.size();
    int[] indices = new int[list.size()];

    Item firstItem = null;
    int count = 0;
    HashSet virtualElements = new HashSet();
    for (int i = 0; i < size; ++i) {
      Object o = list.get(i);
      Widget w = findItem(o);
      if (w instanceof Item) {
        Item item = (Item) w;
        indices[count++] = doIndexOf(item);
        if (firstItem == null) {
          firstItem = item;
        }
      } else {
        virtualElements.add(o);
      }
    }

    if (getContentProvider() instanceof ILazyContentProvider) {
      ILazyContentProvider provider = (ILazyContentProvider) getContentProvider();

      // Now go through it again until all is done or we are no longer
      // virtual
      // This may create all items so it is not a good
      // idea in general.
      // Use #setSelection (int [] indices,boolean reveal) instead
      for (int i = 0; virtualElements.size() > 0 && i < doGetItemCount(); i++) {
        provider.updateElement(i);
        Item item = doGetItem(i);
        if (virtualElements.contains(item.getData())) {
          indices[count++] = i;
          virtualElements.remove(item.getData());
          if (firstItem == null) {
            firstItem = item;
          }
        }
      }
    } else {

      if (count != list.size()) {// As this is expensive skip it if all
        // have been found
        // If it is not lazy we can use the cache
        for (int i = 0; i < virtualManager.cachedElements.length; i++) {
          Object element = virtualManager.cachedElements[i];
          if (virtualElements.contains(element)) {
            Item item = doGetItem(i);
            item.getText();// Be sure to fire the update
            indices[count++] = i;
            virtualElements.remove(element);
            if (firstItem == null) {
              firstItem = item;
            }
View Full Code Here

      return;
    int oldCount = doGetItemCount();
    if (count < oldCount) {
      // need to disassociate elements that are being disposed
      for (int i = count; i < oldCount; i++) {
        Item item = doGetItem(i);
        if (item.getData() != null) {
          disassociate(item);
        }
      }
    }
    doSetItemCount(count);
View Full Code Here

   * @since 3.1
   */
  public void replace(Object element, int index) {
    if (isBusy())
      return;
    Item item = doGetItem(index);
    refreshItem(item, element);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Item

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.