Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If your application is encapsulated as an eclipse product, you may tweak the <a href="http://dev.eclipse.org/newslists/news.eclipse.platform/msg71104.html" rel="nofollow noreferrer"><code>plugin.properties/plugin_customization.ini</code></a> file.<br> (file referenced by the '<code>preferenceCustomization</code>' property in your <a href="http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/product_def_extpt.htm" rel="nofollow noreferrer"><em>product</em> extension point</a>.)<br> This file is a java.io.Properties format file. Typically this file is used to set the values for preferences that are published as part of a plug-in's public API.<br> (Example of <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.platform/plugin_customization.ini?revision=1.8&amp;view=markup" rel="nofollow noreferrer">such a file for <code>org.eclipse.platform</code></a>)</p> <p>So if the string representing the order of perspective can be referenced as a property, you can define the default order in there.<br> Since the source code of <a href="http://kickjava.com/src/org/eclipse/ui/IWorkbenchPreferenceConstants.java.htm" rel="nofollow noreferrer"><code>IWorkbenchPreferenceConstants</code></a> mentions:</p> <pre><code> /** * Lists the extra perspectives to show in the perspective bar. * The value is a comma-separated list of perspective ids. * The default is the empty string. * * @since 3.2 */ public static final String JavaDoc PERSPECTIVE_BAR_EXTRAS = "PERSPECTIVE_BAR_EXTRAS"; //$NON-NLS-1$ </code></pre> <p>Maybe a line in the <code>plugin_customization.ini</code> file:</p> <pre><code>org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=perspectiveId1,perspectiveId2,perspectiveId3 </code></pre> <p>would allow you to specify that order without having to hard-code it.</p> <h2>Additional notes:</h2> <p><a href="http://kickjava.com/src/org/eclipse/ui/IPerspectiveRegistry.java.htm" rel="nofollow noreferrer">IPerspectiveRegistry</a> (or <a href="http://kickjava.com/src/org/eclipse/ui/internal/registry/PerspectiveRegistry.java.htm" rel="nofollow noreferrer">PerspectiveRegistry</a>) is not made to write anything (especially for perspective defined in an extension)</p> <p>Ordering may be found in the state of the workbench (stored in the workspace and then restored when its launched again, <code>.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml</code>)</p> <p>Do you confirm that:</p> <pre><code>IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor[] perspectives = registry.getPerspectives(); </code></pre> <p>is not in the right order when the <code>plugin_customization.ini</code> does define that order correctly ?</p> <p><a href="https://stackoverflow.com/users/65412/liverpool-5-0-aston-villa">Liverpool 5 - 0 Aston Villa</a> does confirm that (in the comments), but also indicates the <strong>(ordered) ini file entries internally get recorded into preference store</strong>, which means they can be retrieved through the <strong>preference store API</strong>:</p> <pre><code>PatformUI.getPreferenceStore().getDefault( IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS) </code></pre> <p>Liverpool 5 - 0 Aston Villa then add: </p> <blockquote> <p>perspective registry (the initial "<code>PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();</code>" bit) remains unaltered (and unordered).<br> But, you still can "<strong>readily access to ordered list of perspectives</strong>" through <strong>preference store</strong>.<br> So, for other tasks, instead of iterating though perspective registry (which is still unordered), we can use the ordered variable that stores list of ordered perpective ids. </p> </blockquote> <p>.<br> .<br> .<br> . </p> <hr> <p>Note: another possibility is to <a href="http://eclipsesource.com/blogs/2009/03/31/replacing-the-perspective-switcher-in-rcp-apps/" rel="nofollow noreferrer"><strong>Replace the Perspective-Switcher in RCP apps</strong></a></p> <p><img src="https://i.stack.imgur.com/7LACm.png" alt="alt text"> => to: <img src="https://i.stack.imgur.com/o77CJ.png" alt="alt text"></p> <p>You can more easily define the order in a menu or in buttons there.</p> <hr> <p>Extreme solution: <a href="http://www.richclient2.eu/2006_08_29/creating-your-own-perspective-switcher-a-first-try/" rel="nofollow noreferrer">re-implement a perspective switcher</a>. </p> <p><img src="https://i.stack.imgur.com/tCZVe.png" alt="http://www.richclient2.de/wp-content/uploads/2006/08/persp_header.png"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload