Plug-ins can add their own action sets, views, and various shortcuts to existing perspectives by contributing to the org.eclipse.ui.perspectiveExtensions extension point.
The contributions that can be defined for new perspectives (action sets, wizard entries, view layout, view shortcuts, and perspective shortcuts) can also be supplied for an existing perspective. One important difference is that these contributions are specified in the plugin.xml markup instead of configuring them into an IPageLayout.
The following markup shows how the JDT extends the platform's debug perspective.
<extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective"> <actionSet id="org.eclipse.jdt.debug.ui.JDTDebugActionSet"/> <view id="org.eclipse.jdt.debug.ui.DisplayView" relative="org.eclipse.debug.ui.ExpressionView" relationship="stack"/> <view id="org.eclipse.jdt.ui.PackageExplorer" relative="org.eclipse.debug.ui.DebugView" relationship="stack" visible="false"/> <view id="org.eclipse.jdt.ui.TypeHierarchy" relative="org.eclipse.debug.ui.DebugView" relationship="stack" visible="false"/> <view id="org.eclipse.search.SearchResultView" relative="org.eclipse.debug.ui.ConsoleView" relationship="stack" visible="false"/> <viewShortcut id="org.eclipse.jdt.debug.ui.DisplayView"/> </perspectiveExtension> </extension>
The targetID is the id of the perspective to which the plug-in is contributing new behavior. The actionSet parameter identifies the id of a previously declared action set that should be added to the target perspective. This markup is analogous to using IPageLayout.addActionSet in the IPerspectiveFactory.
Contributing a view to a perspective is a little more involved, since the perspective page layout information must be declared. The visible attribute controls whether the contributed view is initially visible when the perspective is opened. In addition to supplying the id of the contributed view, the id of a view that already exists in the perspective ( a relative view) must be specified as a reference point for placing the new view. The relationship parameter specifies the layout relationship between the new view and the relative view.
Specifying a perspectiveShortcut indicates that another perspective (specified by id) should be added to the Window > Open Perspective... menu of the target perspective. This markup is analogous to calling IPageLayout.addPerspectiveShortcut in the original perspective definition in the IPerspectiveFactory. Plug-ins can also add view shortcuts and new wizard shortcuts in a similar manner.
You can also specify one or more views as a valid showInPart. The views should be specified by the id used in their org.eclipse.ui.views extension contribution. This controls which views are available as targets in the Navigate > Show In menu. The ability to specify a "show in" view in the extension markup allows you to add your newly contributed views as targets in another perspective's "show in" menus. See Linking views and editors for more information on "show in."
See org.eclipse.ui.perspectiveExtensions for a complete definition of the extension point.