Search code examples
eclipseeclipse-plugineclipse-rcpusability

Add Custom Perspective sub menu in Eclipse Open Perspective menu


One way to open a custom perspective in Eclipse is the following: [Menu] Window -> Perspective -> Open Perspective -> Others.

Then a dialog opens with a list of perspectives available, where the user can pick the required item.

Is there a way to make the custom perspective menu appear above the "Others" submenu. This can reduce a few clicks for the users and find the required perspective easily.


Solution

  • The perspectives listed above 'Other' are known as 'perspective shortcuts'.

    In the Eclipse UI you can add these using 'Window > Perspective > Customize Perspective'. Choose the 'Shortcuts' tab and select the 'Open Perspective' submenu. You can then select the items to show as 'shortcuts'.

    In an Eclipse plugin you can use the org.eclipse.ui.perspectiveExtensions extension point to specify an perspectiveShortcut.

    In an IPerspectiveFactory you can use the IPageLayout.addPerspectiveShortcut method to define a shortcut.