私はEclipse RCPアプリケーションに取り組んでいます。MultiPageEditorPart を拡張するクラスで、フォーカスをテキスト フィールドに設定しようとしています。しかし、setFocus メソッドは常に false を返します。
私は何を間違っていますか?
MultiPageEditor にはさまざまなページがあり、これらのページ内には Composite クラスがあります。これらのクラスには、テキスト フィールドが含まれています。
スニペットは次のとおりです: (errorPage は int であり、検証でエラーが見つかったページ番号です)
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;
}
}
}
}