Eclipse RCP 응용 프로그램에서 작업하고 있습니다. MultiPageEditorPart를 확장하는 클래스에서 텍스트 필드에 포커스를 설정하려고합니다. 그러나 setFocus 메서드는 항상 false를 반환합니다.setFocus() always false
내가 뭘 잘못하고 있니?
MultiPageEditor에는 다양한 페이지가 있으며이 페이지 안에는 복합 클래스가 있습니다. 이러한 클래스에는 텍스트 필드가 포함됩니다. 여기
이 코드 조각입니다 : (의 errorpage은 INT이며, 내 유효성 검사가 발견되는 PAGENUMBER 오류가)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;
}
}
}
}
아마도'Shell '이 보이기 전에'setFocus()'를 호출하고있을 것입니다. –