The prospect of switching in an RCP application with Eclipse Juno?

In my RCP application, I use this code to switch perspectives:

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

I did not change my code, but I changed the development environment with

 java 6 64bits + windows + Eclipse Indigo 

to

 java 7 32bits + windows + Eclipse Juno 

And now the perspective does not switch anymore, without any exceptions, and is not suspected of debugging anything.

I did not find an error report.

Is there any explanation? Workaround

+6
java eclipse eclipse-juno eclipse-rcp eclipse-indigo
Jul 17 '12 at 13:08
source share
3 answers

I ran into this problem. As far as I can tell, this is regression in Juno (4.2.0). I used a debugger to make a showPerspective () call. In no case was there any explicit attempt to actually change the perspective. There may be an internal event listener missing, or the showPerspective () port to the new infrastructure may not be complete.

As a job, 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 on the context in which these calls are made, you may need to exclude some of these calls from being blocked or check Workbench.isClosing() for security.

+6
Aug 07 '12 at 15:00
source share

This is a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=395084 and has been fixed for Eclipse Luna, due to be released in June.

+2
Feb 06 '14 at 13:34
source share

Here is an answer that aims to clarify and solve my problem:

Using the Eclipse 4 IDE, create an RCP application developed before Eclipse 4 by integrating Java 7 features and 32-bit Windows compatibility. And, of course, you can switch perspectives.

This answer does not solve the problem of those who want to switch perspective in an RCP application and use the features or appearance of the new Eclipse 4 platform (not to be confused with the Eclipse 4 IDE). But I would not recommend it, at least for the old application (which was developed on Eclipse 3), given that:

  • which is so slow that the application is almost never used
  • there are many graphical crashes
  • there are errors, including those related to the prospect of switching

At these three points, I can’t say whether this is due to the Eclipse 4 platform or to the compatibility level of Eclipse 3. I hope that new applications developed specifically for the new Eclipse 4 platform will work correctly.

So my solution was to determine the purpose of Eclipse 3 and use it for assembly.

Here's the full procedure:

  • Is JDK 7 installed (32bits version)
  • Install Eclipse 3.7 (version 32bits)
  • Install Eclipse 4 (version 32bits)
  • Launch Eclipse 4 and import the necessary projects.
  • Go to the window / Preferences / Development Plugin / Target Platform
  • Click Add, then Nothing.
  • Click Add, then Install, and select the Eclipse 3.7 directory.
  • Once your goal is created, select it (still in the window / Preferences / Plugin Development / Target Platform).

Now, in your .product , the Eclipse Product Export Wizard will create the Eclipse 3 executable.

Practical notes:

  • "Clear all" was not enough, and I had to stop / restart Eclipse to get it to work after selecting a target
  • the installation process deleted some of my .product fields. I had to reset the identifier and check "The product includes original laucher artifacts."
+1
Jul 18 '12 at 10:23
source share



All Articles