Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ITreeContentProvider


        BookMarkSorter sorter = new BookMarkSorter();
        sorter.setType(BookMarkSorter.Type.SORT_BY_NAME);
        fViewer.setComparator(sorter);
      }

      fViewer.setContentProvider(new ITreeContentProvider() {
        public Object[] getElements(Object inputElement) {
          Set<IFolder> rootFolders = Controller.getDefault().getCacheService().getRootFolders();
          return rootFolders.toArray();
        }
View Full Code Here


   * @param element the tree element to check
   * @return true if the given element has children that matches the filter text
   */
  private boolean isParentMatch(Viewer viewer, Object element) {
    if (viewer instanceof AbstractTreeViewer) {
      ITreeContentProvider provider = (ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider();
      Object[] children = provider.getChildren(element);

      if ((children != null) && (children.length > 0))
        return filter(viewer, element, children).length > 0;
    }

View Full Code Here

        return !fExcludes.contains(element) && !fExcludes.contains(parentElement);
      }
    });

    fFolderViewer.setContentProvider(new ITreeContentProvider() {
      public Object[] getElements(Object inputElement) {
        Collection<IFolder> rootFolders = CoreUtils.loadRootFolders();
        return rootFolders.toArray();
      }
View Full Code Here

      sorter.setType(BookMarkSorter.Type.SORT_BY_NAME);
      fViewer.setComparator(sorter);
    }

    /* ContentProvider */
    fViewer.setContentProvider(new ITreeContentProvider() {
      public Object[] getElements(Object inputElement) {
        Collection<IFolder> rootFolders = CoreUtils.loadRootFolders();
        return rootFolders.toArray();
      }

View Full Code Here

                    IRegisterGroup  registerGroup = (IRegisterGroup) data;
                    name = registerGroup.getName();
                }
               
                if (name != null && pathSegment.equals(name)) {
                    ITreeContentProvider provider = (ITreeContentProvider) getContentProvider();
                    provider.getChildren(child.getData());
                    setExpanded(child, true);
                    index++;
                    if (index < segments.length) {
                        Item[] newChildren = getChildren(child);
                        return internalExpandPath(segments, index, newChildren);
View Full Code Here

        Object input = unresolvedViewer.getInput();
        if (input == null)
            return;

        ITreeContentProvider contentProvider = (ITreeContentProvider) unresolvedViewer.getContentProvider();
        Object[] roots = contentProvider.getElements(input);

        ViewerSorter sorter = unresolvedViewer.getSorter();
        if (sorter != null)
            Arrays.sort(roots, new SorterComparatorAdapter(unresolvedViewer, sorter));
        for (Object root : roots) {
View Full Code Here

        checkboxTreeViewer.addCheckStateListener(new ICheckStateListener() {

            public void checkStateChanged(CheckStateChangedEvent event) {
                Object element = event.getElement();
                ITreeContentProvider contentProvider = (ITreeContentProvider) checkboxTreeViewer.getContentProvider();

                alterChildren(element, contentProvider, event.getChecked());

                alterParents(element, contentProvider);
            }

            private void alterChildren(Object element, ITreeContentProvider contentProvider, boolean checked) {
                Queue<Object> toRecurse = new LinkedList<Object>();
                toRecurse.offer(element);
                while (!toRecurse.isEmpty()) {
                    Object o = toRecurse.poll();
                    for (Object child : contentProvider.getChildren(o)) {
                        if (contentProvider.hasChildren(child))
                            toRecurse.offer(child);
                        checkboxTreeViewer.setChecked(child, checked);
                        checkboxTreeViewer.setGrayed(child, false);
                    }
                }
            }

            private void alterParents(Object element, ITreeContentProvider contentProvider) {
                Object parent = contentProvider.getParent(element);
                while (parent != null) {
                    boolean allChecked = true;
                    boolean noneChecked = true;
                    for (Object child : contentProvider.getChildren(parent)) {
                        boolean checked = checkboxTreeViewer.getChecked(child);
                        boolean grayed = checkboxTreeViewer.getGrayed(child);
                        allChecked &= checked & !grayed;
                        noneChecked &= !checked;
                    }

                    if (allChecked) {
                        checkboxTreeViewer.setChecked(parent, true);
                        checkboxTreeViewer.setGrayed(parent, false);
                    } else if (noneChecked) {
                        checkboxTreeViewer.setGrayChecked(parent, false);
                    } else {
                        checkboxTreeViewer.setGrayChecked(parent, true);
                    }
                    parent = contentProvider.getParent(parent);
                }
            }
        });

        setControl(checkboxTreeViewer.getControl());
View Full Code Here

        Object input = unresolvedViewer.getInput();
        if (input == null)
            return;

        ITreeContentProvider contentProvider = (ITreeContentProvider) unresolvedViewer.getContentProvider();
        Object[] roots = contentProvider.getElements(input);

        ViewerSorter sorter = unresolvedViewer.getSorter();
        if (sorter != null)
            Arrays.sort(roots, new SorterComparatorAdapter(unresolvedViewer, sorter));
        for (Object root : roots) {
View Full Code Here

        getWizard().getContainer().updateButtons();
      }
    });
   
    LabelProvider labelProvider = new LabelProvider();
    ITreeContentProvider contentProvider = new ITreeContentProvider() {
     
      public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        // ignore
      }
     
View Full Code Here

   
    treeViewer = new TreeViewer(panel);
    gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL) ;
    treeViewer.getTree().setLayoutData(gridData);
   
    treeViewer.setContentProvider(new ITreeContentProvider() {
     
      public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
      }
     
      public void dispose() { }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ITreeContentProvider

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.