What's New in Eclipse 4.27

Here are descriptions of some of the changes of interest to plug-in developers made to the Eclipse Platform and SWT for the 4.27 release of Eclipse.

New features oriented towards end-users of the platform can be viewed in the What's New section of the Eclipse Platform User Guide.

Platform Changes

Persistence and migration of perspectives

Migrate and apply existing 3.x perspectives on e4 applications

To support migrating existing user-specific perspectives from the 3.x applications a new API was added to the platform.ui.tools: org.eclipse.e4.tools.compatibiliy.migration.PerspectiveMigrator.

To directly apply an existing perspective to the running e4 application:

 /* loadMemento is something that you have to implement yourself.
 You can find examples on how to do so online or 
 in the org.eclipse.e4.tools.compatibility.migration.tests.E4MigrationToolTest . */
 IMemento storedPerspective = loadMemento();
 PerspectiveMigration.apply3xWorkbenchState(storedPerspective);
          

Alternatively you can convert the stored perspective to an MApplication:

 /* loadMemento is something that you have to implement yourself.
 You can find examples on how to do so online or 
 in the org.eclipse.e4.tools.compatibility.migration.tests.E4MigrationToolTest . */
 IMemento storedPerspective = loadMemento();
 MApplication mApplication = PerspectiveMigration.convertToMApplication(storedPerspective);
          

Store and load perspectives of e4 applications

e4 does not allow to load and store perspectives in the same way it was possible in 3.x . In order to do so a new API was added to the platform.ui.tools: org.eclipse.e4.tools.persistence.PerspectivePersister.

To store a perspective of the running e4 application using its id:

 String serializedPerspective = PerspectivePersister.serializePerspectiveAndPartStates("myPerspectiveId"); 
 // store the way you like
 storePerspective(serializedPerspective);
          

To load a stored perspective:

 // load corresponding to the way you store
 String serializedPerspective = loadStoredPerspective();
 PerspectivePersister.restoreWorkbenchState(serializedPerspective);