如何取消在Eclipse RCP e4中创建视图?
是否可以取消在@PostConstruct
阶段创建视图?我有:如何取消在Eclipse RCP e4中创建视图?
@PostConstruct public void createPartControl(Composite parent) {
try {
// do something where an exception is thrown
} catch (Exception e) {
// I want to cancel construction, close the view and show an error dialog
}
}
回答:
就关闭视图,E4风格
MPart part = partService.findPart(viewId); part.setVisible(true);
回答:
您可以立即运行部分业务隐藏的部分后的部分创作已经使用类似成品:
@PostConstruct public void postConstruct(Composite parent, UISynchronize uiSync,
EPartService partService, MPart part)
{
// Other code
// Run hidePart as soon as possible after part creation has finished
uiSync.asyncExec(() -> partService.hidePart(part));
}
(以上是使用Java 8 lambda)。
以上是 如何取消在Eclipse RCP e4中创建视图? 的全部内容, 来源链接: utcz.com/qa/259817.html