I m working on a Eclipse RCP Application. In a class which extends MultiPageEditorPart, I m trying to set the focus to a text field. But the setFocus Method always returns false.
What am I doing wrong?
The MultiPageEditor has various pages and inside these pages, there are Composite - classes. These classes contain the text field.
Here is the snippet: (errorPage is an int, the Pagenumber on which my validation found the error)
if(!dataValid) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Fehler bei der Dateneingabe", stringBuilder.toString());
this.setActivePage(errorPage);
Composite errorComposite = (Composite) this.getControl(errorPage);
Control[] children = errorComposite.getChildren();
for (Control child : children) {
if(child instanceof Form) {
Form form = (Form) child;
Composite body = form.getBody();
Control[] formChildren = body.getChildren();
for (Control formChild : formChildren) {
if(formChild.equals(errorControl))
formChild.setFocus();
return dataValid;
}
}
}
}