Package org.eclipse.swtbot.swt.finder.utils

Examples of org.eclipse.swtbot.swt.finder.utils.TreePath


          log.trace(MessageFormat.format("did not match {0} with text \"{1}\", using matcher: {2}", ClassUtils.simpleClassName(item), text, StringDescription.toString(this))); //$NON-NLS-1$
      }

      if (log.isTraceEnabled() && (item instanceof Widget)) {
        PathGenerator pathGenerator = new PathGenerator();
        TreePath path = pathGenerator.getPath((Widget) item);
        int segmentCount = path.getSegmentCount();

        String prefix = ""; //$NON-NLS-1$
        for (int i = 0; i < segmentCount - 1; i++)
          prefix += "    "; //$NON-NLS-1$
        prefix += "+---"; //$NON-NLS-1$
View Full Code Here


    this.matcher = matcher;
  }

  protected boolean doMatch(Object obj) {
    Widget previousWidget = SWTUtils.previousWidget((Widget) obj);
    TreePath path = new PathGenerator().getPath((Widget) obj);
    int segmentCount = path.getSegmentCount();
    for (int i = 1; i < segmentCount; i++) {
      previousWidget = (Widget) path.getSegment(segmentCount - i - 1);
      if ((previousWidget instanceof Group) && matcher.matches(previousWidget))
        return true;
    }
    return false;
  }
View Full Code Here

   *
   * @param w the widget.
   * @return the path to the widget w.
   */
  public TreePath getPath(Widget w) {
    return new TreePath(getParents(w).toArray());
  }
View Full Code Here

    this.matcher = matcher;
  }

  protected boolean doMatch(Object obj) {
    Widget previousWidget = SWTUtils.previousWidget((Widget) obj);
    TreePath path = new PathGenerator().getPath((Widget) obj);
    int segmentCount = path.getSegmentCount();
    for (int i = 1; i < segmentCount; i++) {
      previousWidget = (Widget) path.getSegment(segmentCount - i - 1);
      if ((previousWidget instanceof Group) && matcher.matches(previousWidget))
        return true;
    }
    return false;
  }
View Full Code Here

   *
   * @param w the widget.
   * @return the path to the widget w.
   */
  public TreePath getPath(Widget w) {
    return new TreePath(getParents(w).toArray());
  }
View Full Code Here

   *
   * @param w the widget.
   * @return the path to the widget w.
   */
  public TreePath getPath(Widget w) {
    return new TreePath(getParents(w).toArray());
  }
View Full Code Here

      String token = elements[i];
      String[] pathElements = token.split("/"); //$NON-NLS-1$

      parent = getParent(treePath, parent, i, pathElements);
    }
    return new TreePath(treePath);
  }
View Full Code Here

    return parent;
  }

  private void _getPathAsString(TreePath path, StringBuffer result) {
    Widget lastWidget = (Widget) path.getLastSegment();
    TreePath parentPath = path.getParentPath();
    if (parentPath != null)
      _getPathAsString(parentPath, result);
    if (lastWidget != null)
      pathAsString(lastWidget, result);
  }
View Full Code Here

  @Test
  public void getsControlPath() throws Exception {
    Matcher<Button> withText = withText("One");
    List<Button> labels = controlFinder.findControls(allOf(widgetOfType(Button.class), withText));
    Widget w = labels.get(0);
    TreePath path = controlFinder.getPath(w);
    assertEquals(7, path.getSegmentCount());
  }
View Full Code Here

  // varargs and generics doesn't mix well!
  @Test
  public void getsControlPathToTabItem() throws Exception {
    Matcher<TabItem> withText = withText("Dialog");
    List<TabItem> tabItems = controlFinder.findControls(allOf(widgetOfType(TabItem.class), withText));
    TreePath path = controlFinder.getPath(tabItems.get(0));
    assertEquals(3, path.getSegmentCount());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swtbot.swt.finder.utils.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.