Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreeViewer


    create(null);
  }

  @Test
  public void getViewerShouldReturnTheSameViewer() throws Exception {
    TreeViewer viewer = new TreeViewer(shell);
    assertThat(create(viewer).getViewer(), sameInstance(viewer));
  }
View Full Code Here


    assertThat(create(viewer).getViewer(), sameInstance(viewer));
  }

  @Test
  public void getSelectedColumnShouldReturnTheRightColumn() {
    TreeViewerColumnSorter sorter = create(new TreeViewer(shell));
    assertThat(sorter.getSelectedColumn(), nullValue());

    TreeColumn column = new TreeColumn(sorter.getViewer().getTree(), SWT.NONE);
    Event event = new Event();
    event.widget = column;
View Full Code Here

   * Test that when a column is clicked, the sort indicator is updated on the
   * column.
   */
  @Test
  public void shouldUpdateTheSortIndicationOnTheColumnHeader() {
    TreeViewerColumnSorter sorter = create(new TreeViewer(shell));
    assertThat(sorter.getSelectedColumn(), nullValue());

    TreeColumn column = new TreeColumn(sorter.getViewer().getTree(), SWT.NONE);
    Event event = new Event();
    event.widget = column;
View Full Code Here

   */
  public void createControl(Composite parent) {

    super.createControl(parent);

    TreeViewer viewer= getTreeViewer();
    //viewer.setContentProvider(new ContentProvider());
    viewer.setContentProvider(new DjangoOutlineProvider(fDocumentProvider, fInput));
    viewer.setLabelProvider(new DjLabelProvider());
    viewer.addSelectionChangedListener(this);

    if (fInput != null) {
      viewer.setInput(fInput);
      viewer.expandAll();
    }
  }
View Full Code Here

 
  /**
   * Updates the outline page.
   */
  public void update() {
    TreeViewer viewer= getTreeViewer();

    if (viewer != null) {
      Control control= viewer.getControl();
      if (control != null && !control.isDisposed()) {
        control.setRedraw(false);
        viewer.setInput(fInput);
        viewer.expandAll();
        control.setRedraw(true);
      }
    }
  }
View Full Code Here

    given(valueProvider.getValue(new TreePath(new Object[]{bigger})))
        .willReturn(bigger);
    given(valueProvider.getValue(new TreePath(new Object[]{smaller})))
        .willReturn(smaller);

    TreeViewer viewer = new TreeViewer(shell);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(new LabelProvider());

    TreeViewerColumnValueSorter sorter = create(viewer, valueProvider);
    assertThat(sorter.getSelectedColumn(), nullValue());

    Tree tree = sorter.getViewer().getTree();
    TreeColumn column = new TreeColumn(tree, SWT.NONE);

    viewer.setInput("");

    Event event = new Event();
    event.widget = column;
    SelectionEvent selectionEvent = new SelectionEvent(event);
View Full Code Here

    ITreeContentProvider contentProvider = mock(ITreeContentProvider.class);
    given(contentProvider.getElements(any()))
        .willReturn(new Object[]{bigger, smaller});
    ILabelProvider labelProvider = new LabelProvider();

    TreeViewer viewer = new TreeViewer(shell);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(labelProvider);

    TreeViewerColumnLabelSorter sorter = create(viewer, labelProvider);
    assertThat(sorter.getSelectedColumn(), nullValue());

    Tree tree = sorter.getViewer().getTree();
    TreeColumn column = new TreeColumn(tree, SWT.NONE);

    viewer.setInput("");

    Event event = new Event();
    event.widget = column;
    SelectionEvent selectionEvent = new SelectionEvent(event);
View Full Code Here

    ITreeContentProvider contentProvider = mock(ITreeContentProvider.class);
    given(contentProvider.getElements(any()))
        .willReturn(new Object[]{bigger, smaller});
    ILabelProvider labelProvider = new LabelProvider();

    TreeViewer viewer = new TreeViewer(shell);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(labelProvider);

    TreeViewerColumnLabelSorter sorter = create(viewer, labelProvider);
    assertThat(sorter.getSelectedColumn(), nullValue());

    Tree tree = sorter.getViewer().getTree();
    TreeColumn column = new TreeColumn(tree, SWT.NONE);

    viewer.setInput("");

    Event event = new Event();
    event.widget = column;
    SelectionEvent selectionEvent = new SelectionEvent(event);
View Full Code Here

    CompositeCellLabelProvider mainLabels = new CompositeCellLabelProvider(
        new DateLabelProvider(), new WorkspaceStorageLabelProvider());
   
    // The viewer:
    filteredTree = Viewers.newFilteredTree(parent, new TreePathPatternFilter(mainLabels));
    TreeViewer viewer = filteredTree.getViewer();
    FilterableTreePathContentProvider filteredContentProvider =
        new FilterableTreePathContentProvider(contentProvider);
    filteredContentProvider.addFilter(instanceOf(Duration.class));
    viewer.setContentProvider(filteredContentProvider);

    // Column sorters:
    TreeViewerColumnSorter labelSorter = new InternalTreeViewerColumnLabelSorter(viewer, mainLabels);
    TreeViewerColumnSorter durationSorter = new TreeViewerColumnValueSorter(viewer, valueProvider);
View Full Code Here

    return items.toArray(new IContributionItem[items.size()]);
  }

  @Override
  public Job updateJob(Preference pref) {
    TreeViewer viewer = filteredTree.getViewer();
    return new UpdateJob<ISessionData>(viewer, pref, getAccessor()) {
      @Override
      protected Object getInput(final Collection<ISessionData> data) {
        return new ISessionDataProvider() {
          @Override
View Full Code Here

TOP

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

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.