IWorkbenchListener preShutdown优先级/顺序?

时间:2016-02-10 21:02:27

标签: java qt eclipse-plugin eclipse-rcp

所以,我有这个Eclipse RCP应用程序,它通过JNI管理幕后的一些Qt资源。 Qt vets将知道QApplication和Qt GUI对象不需要在主/ GUI线程之外构造和销毁。使用IStartup进行QApplication构建不是问题,但是关闭时QApplication销毁很难实现。我正在使用IWorkbenchListener来清理我的Qt资源,当按照Qt的要求在GUI线程上调用preShutdown 时。当其他IWorkbenchListeners在调用我的preShutdown之后否决关闭时出现问题。我需要防止这种情况。

有没有办法强制或确保我的preShutdown最后被调用?或者是否还有其他新方法可以在GUI线程停止之前在GUI线程上执行 last 的代码?

2 个答案:

答案 0 :(得分:0)

如果您的RCP实施func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { // the identifier of the segue is the same you set in the Attributes Inspector self.performSegueWithIdentifier("segueName", sender: self) } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if(segue.identifier == "segueName") { // this is the way of get the indexPath for the selected cell let indexPath = self.collectionView.indexPathForSelectedRow() let row = indexPath.row // get a reference to the next UIViewController let nextVC = segue.destinationViewController as! NameOfYourViewController } } ,您可以在IApplication退出后添加代码。

您还可以尝试PlatformUI.createAndRunWorkbench的{​​{1}}方法。您传递的disposeExec就是在显示处理之前调用此方法。

答案 1 :(得分:0)

IWorkbenchListener.postShutdown()根据需要工作。