从Eclipse Juno开始RCP应用程序的透视? [英] Switch perspective in a RCP application since Eclipse Juno?

查看:123
本文介绍了从Eclipse Juno开始RCP应用程序的透视?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的RCP应用程序中,我使用这个代码来切换透视图:

  IWorkbenchWindow window = getViewSite()getWorkbenchWindow() 
window.getWorkbench()。showPerspective(PRODUCT_PERSPECTIVE_ID,window);

我没有更改我的代码,但是我将开发环境从

  java 6 64bits + windows + Eclipse靛蓝

to

  java 7 32bits + windows + Eclipse Juno 
pre>

现在,透视图不再有任何异常,没有任何疑问在调试中可见。



我没有发现任何错误报告。



有解释吗?一个解决方法?

解决方案

我也遇到这个问题。据我所知,这是Juno的一个回归(4.2.0)。我使用调试器来遍历对 showPerspective()的调用。没有任何明确的尝试实际改变观点。也许内部事件监听器丢失,或者可能是新框架的 showPerspective()端口不完整。



周围,​​以下代码成功地改变了我的观点:

  IWorkbenchWindow window = getViewSite()。getWorkbenchWindow(); 
IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
IWorkbenchPage page = window.getActivePage();
page.setPerspective(registry.findPerspectiveWithId(PRODUCT_PERSPECTIVE_ID));

根据这些调用的上下文,您可能需要对其中的一些进行无效电话,或检查 Workbench.isClosing()是安全的。


In my RCP application I use this code to switch perspective :

IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
window.getWorkbench().showPerspective(PRODUCT_PERSPECTIVE_ID, window);

I didn't change my code but I changed my developement environnement from

java 6 64bits + windows + Eclipse Indigo

to

java 7 32bits + windows + Eclipse Juno

And now the perspective doesn't switch any more, with no exception and nothing suspect visible in debug.

I didn't find any bug report.

Is there an explanation ? A workaround ?

解决方案

I have run into this problem as well. As far as I can tell, it is a regression in Juno (4.2.0). I used the debugger to step through the call to showPerspective(). At no point was any explicit attempt made to actually change the perspective. Perhaps there is an internal event listener missing, or perhaps the port of showPerspective() to the new framework is incomplete.

As a work-around, the following code successfully changed perspectives for me:

IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
IWorkbenchPage page = window.getActivePage();
page.setPerspective(registry.findPerspectiveWithId(PRODUCT_PERSPECTIVE_ID));

Depending upon the context in which these calls are made, you might want to null-guard some of these calls, or check Workbench.isClosing() to be safe.

这篇关于从Eclipse Juno开始RCP应用程序的透视?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆