org.eclipse.swtbot.swt.finder.finders
Class PathGenerator

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.finders.PathGenerator

public class PathGenerator
extends Object

This is a path generate used to resolve paths to a component. This is intended for use only internally by the debugging and logging framework.

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Field Summary
protected  IChildrenResolver childrenResolver
          The childrenResolver
 
Constructor Summary
PathGenerator()
           
 
Method Summary
 IChildrenResolver getChildrenResolver()
          Gets the current registered child resolver.
 TreePath getPath(Widget widget)
           
 String getPathAsString(TreePath path)
          Converts the treePath to a string representation.
 String getPathAsString(Widget widget)
           
 TreePath getPathFromString(String stringPath, Display display)
          Converts the string to an object representation.
 Widget getWidget(Object parent, int index)
          Gets the widget contained within the parent at the given index.
protected  void pathAsString(Widget w, StringBuffer result)
          Converts the path to a widget into a String.
 void setChildrenResolver(IChildrenResolver childrenResolver)
          Sets the resolver to use for child resolution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childrenResolver

protected IChildrenResolver childrenResolver
The childrenResolver

Constructor Detail

PathGenerator

public PathGenerator()
Method Detail

getChildrenResolver

public IChildrenResolver getChildrenResolver()
Gets the current registered child resolver.

Returns:
the childrenResolver. If it has not been set a default will be used.

getPathFromString

public TreePath getPathFromString(String stringPath,
                                  Display display)
Converts the string to an object representation.

Parameters:
stringPath - The string path to find.
display - The display to use.
Returns:
the path to a component represented by stringPath

getPathAsString

public String getPathAsString(TreePath path)
Converts the treePath to a string representation.

Parameters:
path - The tree path to use.
Returns:
the path in a string format
See Also:
pathAsString(Widget, StringBuffer)

getWidget

public Widget getWidget(Object parent,
                        int index)
Gets the widget contained within the parent at the given index.

Parameters:
parent - The parent widget to use.
index - The index of the child widget to get from the parent.
Returns:
the index of the widget in the given parent.

setChildrenResolver

public void setChildrenResolver(IChildrenResolver childrenResolver)
Sets the resolver to use for child resolution.

Parameters:
childrenResolver - The child resolver to use.

pathAsString

protected void pathAsString(Widget w,
                            StringBuffer result)
Converts the path to a widget into a String.

Parameters:
w - the widget.
result - the buffer into which the result should be returned.

getPathAsString

public String getPathAsString(Widget widget)
Parameters:
widget -
Returns:
the path to the control, as a string

getPath

public TreePath getPath(Widget widget)
Parameters:
widget -
Returns:
the path to the widget from the shell that contains it