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:
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.