Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Tree


      return null;
    }

    /* Item is Root-Leveld */
    Tree tree = fItem.getParent();
    int index = tree.indexOf(fItem);

    if (tree.getItemCount() > index + 1)
      return new WidgetTreeNode(tree.getItem(index + 1), fViewer);

    return null;
  }
View Full Code Here


      });
    }
  }

  private void updateSelectionAfterDelete(Runnable runnable) {
    Tree tree = (Tree) getControl();
    IStructuredSelection selection = (IStructuredSelection) getSelection();

    /* Nothing to do, since no selection */
    if (selection.isEmpty()) {
      runnable.run();
View Full Code Here

      return null;
    }

    /* Item is Root-Leveld */
    Tree tree = fItem.getParent();
    int index = tree.indexOf(fItem);

    if (index > 0)
      return new WidgetTreeNode(tree.getItem(index - 1), fViewer);

    return null;
  }
View Full Code Here

   * <code>FALSE</code>.
   * @return Returns <code>TRUE</code> in case navigation found a valid item, or
   * <code>FALSE</code> otherwise.
   */
  public boolean navigate(boolean newsScoped, boolean next, boolean unread) {
    Tree explorerTree = fViewer.getTree();

    /* Nothing to Navigate to */
    if (explorerTree.isDisposed())
      return false;

    ITreeNode targetNode = null;

    /* 1.) Navigate in opened Tree */
 
View Full Code Here

      else
        fCheckedElementsCache.remove(child);
    }

    private void cacheAll(boolean checked) {
      Tree tree = fViewer.getTree();
      cacheAll(tree.getItems(), checked);
    }
View Full Code Here

        });
      }

      /* Tree */
      else if (c instanceof Tree) {
        Tree tree = (Tree) c;
        tree.addSelectionListener(new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if ((e.detail & SWT.CHECK) != 0)
              run.run();
          }
        });

        tree.addDragDetectListener(new DragDetectListener() {
          public void dragDetected(DragDetectEvent e) {
            run.run();
          }
        });
      }
View Full Code Here

                  SashForm form = (SashForm) children[1];
                  form.setWeights(new int[] { 70, 30 });

                  Control[] formChilds = form.getChildren();
                  if (formChilds.length != 0 && formChilds[0] instanceof Tree) {
                    Tree tree = (Tree) formChilds[0];
                    if (tree.getItemCount() != 0) {
                      TreeItem root = tree.getItem(0);
                      root.setExpanded(true);
                    }
                  }
                }
              }
View Full Code Here

      }
    });
  }

  void updateSelectionAfterDelete(Runnable runnable) {
    Tree tree = getTree();
    TreeItem[] oldSelection = tree.getSelection();

    /* Nothing to do, since no selection */
    if (oldSelection.length == 0) {
      runnable.run();
      return;
    }

    /* Remember the actual selected Objects to determine if a selection needs to be restored */
    List<Object> oldSelectionObjects = new ArrayList<Object>(oldSelection.length);
    for (TreeItem item : oldSelection) {
      oldSelectionObjects.add(item.getData());
    }

    /* Check if Last Selected Item is an Entity Group */
    TreeItem lastSelectedItem = oldSelection[oldSelection.length - 1];
    if (lastSelectedItem.getData() instanceof EntityGroup) {

      /* Given this group gets deleted, use the next or previous entity group as input for the WidgetTreeNode below */
      int indexOfEntityGroup = tree.indexOf(lastSelectedItem);
      if (tree.getItemCount() > indexOfEntityGroup + 1) //Try Next
        lastSelectedItem = tree.getItem(indexOfEntityGroup + 1);
      else if (indexOfEntityGroup > 0) //Try Previous
        lastSelectedItem = tree.getItem(indexOfEntityGroup - 1);
    }

    /* Navigate to next News if possible */
    ITreeNode startingNode = new WidgetTreeNode(lastSelectedItem, this);
    ISelection newSelection = navigate(startingNode, true);
View Full Code Here

  /**
   * Adjusts the scroll position to reflect the sorting.
   */
  public void adjustScrollPosition() {
    Tree tree = fViewer.getTree();
    int itemCount = tree.getItemCount();
    if (itemCount > 0) {
      if ((fNewsSorter.getSortBy() == NewsColumn.DATE || fNewsSorter.getSortBy() == NewsColumn.PUBLISHED || fNewsSorter.getSortBy() == NewsColumn.MODIFIED || fNewsSorter.getSortBy() == NewsColumn.RECEIVED) && fNewsSorter.isAscending()) {
        TreeItem item = tree.getItem(itemCount - 1);
        int childCount = item.getItemCount();
        if (childCount != 0)
          item = item.getItem(childCount - 1);
        tree.showItem(item);
      } else
        tree.setTopItem(tree.getItem(0));
    }
  }
View Full Code Here

    else
      runnable.run();
  }

  private int indexOf(NewsColumn column) {
    Tree tree = fCustomTree.getControl();
    if (tree.isDisposed())
      return -1;

    TreeColumn[] columns = tree.getColumns();
    for (int i = 0; i < columns.length; i++) {
      if (column == columns[i].getData(NewsColumnViewModel.COL_ID))
        return i;
    }
View Full Code Here

TOP

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

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.