blob: 5c0c52ff5a7c234741ba0fc57a1603406099b4a6 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="copyright" content="Copyright (c) Eclipse contributors and others 2018, 2019. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page."/>
<meta http-equiv="Content-Language" content="en-us"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="STYLESHEET" href="news.css" type="text/css"/>
<style type="text/css">
body {max-width: 900px;}
table.news col.title {width: 30%;}
/*img {max-width: 520px;}*/
table.news {table-layout: fixed; border-collapse: collapse; width: 100%;}
table.news td {border-top: solid thin black; padding: 10px; overflow: visible;}
table.news tr {vertical-align: top;}
table.news tr td.section {font-size: 20px; font-weight: bold;}
table.news tr td.title {vertical-align: top; font-weight: bold;}
table.news tr td.content {vertical-align: top;}
ul {padding-left: 13px;}
</style>
<title>Eclipse Project 4.27 - New and Noteworthy</title>
</head>
<body>
<h2>Platform and Equinox API</h2>
<ul>
<li><a href="#Platform">Platform Changes</a></li>
<!--li><a href="#SWT">SWT Changes</a></li-->
</ul>
<!-- ****************** START OF N&N TABLE****************** -->
<table class="news">
<colgroup>
<col class="title" />
<col />
</colgroup>
<tbody>
<!-- ******************** Platform ********************** -->
<tr>
<td id="Platform" class="section" colspan="2"><h2>Platform Changes</h2></td>
</tr>
<tr id="Migrate_Perspectives">
<!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=570471 -->
<!-- https://github.com/eclipse-platform/eclipse.platform.ui.tools/commit/fb53ad7d761f82c0488624792f98a61d1a26a60a -->
<td class="title">Persistence and migration of perspectives</td>
<td class="content">
<h2 id="migration">Migrate and apply existing 3.x perspectives on e4 applications</h2>
<p>To support migrating existing user-specific perspectives from the 3.x applications a
new API was added to the platform.ui.tools:
<code>org.eclipse.e4.tools.compatibiliy.migration.PerspectiveMigrator</code>.
</p>
<p>To directly apply an existing perspective to the running e4 application:</p>
<pre><code> /* 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);
</code></pre>
<p>Alternatively you can convert the stored perspective to an <code>MApplication</code>:</p>
<pre><code> /* 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);
</code></pre>
<h2 id="persistence">Store and load perspectives of e4 applications</h2>
<p>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:
<code>org.eclipse.e4.tools.persistence.PerspectivePersister</code>.
</p>
<p>To store a perspective of the running e4 application using its id:</p>
<pre><code> String serializedPerspective = PerspectivePersister.serializePerspectiveAndPartStates("myPerspectiveId");
// store the way you like
storePerspective(serializedPerspective);
</code></pre>
<p>To load a stored perspective:</p>
<pre><code> // load corresponding to the way you store
String serializedPerspective = loadStoredPerspective();
PerspectivePersister.restoreWorkbenchState(serializedPerspective);
</code></pre>
</td>
</tr>
<!-- ******************** End of Platform ********************** -->
<tr><td colspan="2"/></tr>
</tbody>
</table>
<!-- ****************** END OF N&N TABLE ****************** -->
<script type="text/javascript" src="scripts.js"></script>
<p style="text-align:center">
<a href="jdt.php">Previous</a> <a style="margin:1em" href=".">Up</a> <a href="pde.php">Next</a>
</p>
</body>
</html>