Not directly, but you can do it in this way:
public getContainedText(Control c) {
return getContainedText(c, new ArrayList<String>());
}
private getContainedText(Control c, List<String> strings) {
if (c instanceof Label) {
strings.add(((Label) c).getText();
} else if (c instanceof Text) {
strings.add(((Text) c).getText();
}
// and so on for other control types you want to handle
// and for text you are interested in.
// Or as an approximation, use reflection to check if
// c has getText method and call it, but this will miss
// List, Combo, etc.
if (c instanceof Composite) {
for (Control child : ((Composite) c).getChildren()) {
getContainedText(child, strings);
}
}
}