【发布时间】:2015-10-27 16:24:19
【问题描述】:
当我的 Eclipse RCP 应用程序中的左侧部件被激活时,我正在打开一个对话框。 在 Part 的 @PostConstruct 方法中,我将 IPartListner 注册到 EPartService。 以下代码显示:
partService.addPartListener(new IPartListener() {
@Override
public void partActivated(MPart part) {
if(part.getElementId().equals("left_part_id")) {
SignInDialog dialog = new SignInDialog(shell, display, eventBroker);
dialog.open();
}
}
});
在扩展 JFace 对话框的 SignInDialog 中,我正在这样做:
@Override
protected void configureShell(Shell newShell) {
Monitor monitor = display.getPrimaryMonitor();
Rectangle monitorRect = monitor.getBounds();
int x = monitorRect.x + (monitorRect.width - 600) / 2;
int y = monitorRect.y + (monitorRect.height - 360) / 2;
newShell.setLocation(x, y);
newShell.setText("Sign In");
super.configureShell(newShell);
}
@Override
protected Point getInitialSize() {
return new Point(600, 360);
}
请注意,左侧部分始终可见并通过 Application.e4xmi 捆绑。我的问题是,一旦部件被激活,对话框就会显示在显示器的右下角。如果通过单击按钮打开相同的对话框,它会在中心正确显示。任何帮助将不胜感激,在此先感谢!
【问题讨论】:
标签: eclipse-rcp jface e4