Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreePath


    assertThat(TreePaths.headPath(path, path.getSegmentCount()), equalTo(path));
  }

  @Test
  public void headPathShouldThrowAnExceptionIfIndexIsNegative() {
    TreePath path = newPath();
    thrown.expect(IllegalArgumentException.class);
    TreePaths.headPath(path, -1);
  }
View Full Code Here


    TreePaths.headPath(path, -1);
  }

  @Test
  public void indexOfShouldReturnNegative1IfNotFound() {
    TreePath path = new TreePath(new Object[]{"a", "b", "c"});
    assertThat(TreePaths.indexOf(path, "d"), is(-1));
  }
View Full Code Here

    assertThat(TreePaths.indexOf(path, "d"), is(-1));
  }

  @Test
  public void indexOfShouldReturnTheCorrectIndex() {
    TreePath path = new TreePath(new Object[]{"a", "b", "c"});
    int index = 1; // Index of "b"
    assertThat(TreePaths.indexOf(path, "b"), is(index));
  }
View Full Code Here

    assertThat(TreePaths.indexOf(path, "b"), is(index));
  }

  @Test
  public void indexOfShouldReturnTheFirstIndex() {
    TreePath path = new TreePath(new Object[]{"a", "a", "a"});
    assertThat(TreePaths.indexOf(path, "a"), is(0));
  }
View Full Code Here

    TreePaths.indexOf(null, "");
  }

  @Test
  public void indexOfShouldThrowAnExceptionIfSegmentIsNull() {
    TreePath path = newPath();
    thrown.expect(NullPointerException.class);
    TreePaths.indexOf(path, null);
  }
View Full Code Here

  @Test
  public void getChildrenShouldRetainDuplicateChildrenWhenFiltering() {
    Object[] originalChildren = {Integer.valueOf(0), Integer.valueOf(0), "a"};
    Object[] expectedChildren = {Integer.valueOf(0), Integer.valueOf(0)};

    TreePath parent = newPath();
    FilterableTreePathContentProvider p = create(parent, originalChildren);
    p.addFilter(Predicates.instanceOf(String.class));

    assertThat(p.getChildren(parent), equalTo(expectedChildren));
  }
View Full Code Here

  }

  @Test
  public void getChildrenShouldRetainDuplicateChildrenWhenNoFiltering() {
    Object[] children = {0, 0, 0};
    TreePath parent = newPath();
    assertThat(create(parent, children).getChildren(parent), equalTo(children));
  }
View Full Code Here

  @Test
  public void getChildrenShouldRetainTheOrderOfTheChildrenWhenFiltering() {
    Object[] original = {"3", Integer.valueOf(2), "1"};
    Object[] expected = {"3", "1"};

    TreePath parent = newPath();
    FilterableTreePathContentProvider provider = create(parent, original);
    provider.addFilter(Predicates.instanceOf(Integer.class));

    assertThat(provider.getChildren(parent), equalTo(expected));
  }
View Full Code Here

  }

  @Test
  public void getChildrenShouldRetainTheOrderOfTheChildrenWhenNoFiltering() {
    Object[] children = {9, 29, "adf", 0};
    TreePath parent = newPath();
    ITreePathContentProvider p = create(parent, children);
    assertThat(p.getChildren(parent), equalTo(children));
  }
View Full Code Here

  @Test
  public void getChildrenShouldReturnAllChildrenIfNoFiltering() {
    Object[] expectedChildren1 = {Integer.valueOf(0), "100"};
    Object[] expectedChildren2 = {"1", "2"};

    TreePath parent1 = newPath("1");
    TreePath parent2 = newPath("2");
    ITreePathContentProvider mock = mock(ITreePathContentProvider.class);
    given(mock.getChildren(parent1)).willReturn(expectedChildren1);
    given(mock.getChildren(parent2)).willReturn(expectedChildren2);
    FilterableTreePathContentProvider provider = create(mock);
View Full Code Here

TOP

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

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.