diff options
author | mmisingnamecde | 2015-11-24 19:21:24 +0000 |
---|---|---|
committer | mmisingnamecde | 2015-11-24 19:21:24 +0000 |
commit | 30a931061b7727107cf3f48f2feda9f802fa3256 (patch) | |
tree | cfb050cf46e51b8ac7564afb1aa13e6ca20db9d0 | |
parent | f9e9b78e17ea205bef954522029e5ccc5ead8d4e (diff) | |
download | org.eclipse.swtbot-30a931061b7727107cf3f48f2feda9f802fa3256.tar.gz org.eclipse.swtbot-30a931061b7727107cf3f48f2feda9f802fa3256.tar.xz org.eclipse.swtbot-30a931061b7727107cf3f48f2feda9f802fa3256.zip |
Bug 454114 - EclipseSpy Suggestion: add Widget ID to output
Change-Id: I9292e705d6a769a624f0c7aba167b9c2be1b2cab
Change-Id: I9292e705d6a769a624f0c7aba167b9c2be1b2cab
Signed-off-by: mmisingnamecde <m5schemel@gmail.com>
-rw-r--r-- | org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java index 7c112fed..343a5ac4 100644 --- a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java +++ b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java @@ -42,6 +42,7 @@ import org.eclipse.swtbot.swt.finder.finders.ControlFinder; import org.eclipse.swtbot.swt.finder.finders.PathGenerator; import org.eclipse.swtbot.swt.finder.resolvers.IChildrenResolver; import org.eclipse.swtbot.swt.finder.resolvers.IParentResolver; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.eclipse.swtbot.swt.finder.utils.SWTUtils; import org.eclipse.swtbot.swt.finder.utils.TreePath; @@ -95,12 +96,23 @@ class EclipseWidgetTracker implements Runnable { } public void getCompositeInformation(Control control, StringBuffer buf) { - List children = childrenResolver.getChildren(control); + List<Widget> children = childrenResolver.getChildren(control); buf.append("\nChildren: " + children.size() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - for (Iterator iterator = children.iterator(); iterator.hasNext();) + for (Iterator<Widget> iterator = children.iterator(); iterator.hasNext();) buf.append("\t" + iterator.next() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ buf.append("\n"); //$NON-NLS-1$ } + + public void getWidgetId(Control control, StringBuffer buf) { + buf.append("Widget's SWTBot ID: "); //$NON-NLS-1$ + Object widgetId = control.getData(SWTBotPreferences.DEFAULT_KEY); + if (widgetId != null) { + buf.append(widgetId.toString()); + } else { + buf.append("<no SWTBot ID set>"); //$NON-NLS-1$ + } + buf.append("\n"); //$NON-NLS-1$ + } public void getLayoutInformation(Control control, StringBuffer buf) { buf.append("Layout Information: \n"); //$NON-NLS-1$ @@ -194,6 +206,8 @@ class EclipseWidgetTracker implements Runnable { getLocationInformation(control, buf); + getWidgetId(control, buf); + getLayoutInformation(control, buf); getCompositeInformation(control, buf); |