Perspective Extensions

org.eclipse.ui.perspectiveExtensions

This extension point is used to extend perspectives registered by other plug-ins. A perspective defines the initial contents of the window action bars (menu and toolbar) and the initial set of views and their layout within a workbench page. Other plug-ins may contribute actions or views to the perspective which appear when the perspective is selected. Optional additions by other plug-ins are appended to the initial definition.

<!ELEMENT extension (perspectiveExtension*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT perspectiveExtension (actionSet | viewShortcut | perspectiveShortcut | newWizardShortcut | view | showInPart)*>

<!ATTLIST perspectiveExtension

targetID CDATA #REQUIRED>


<!ELEMENT actionSet EMPTY>

<!ATTLIST actionSet

id CDATA #REQUIRED>


<!ELEMENT viewShortcut EMPTY>

<!ATTLIST viewShortcut

id CDATA #REQUIRED>


<!ELEMENT perspectiveShortcut EMPTY>

<!ATTLIST perspectiveShortcut

id CDATA #REQUIRED>


<!ELEMENT newWizardShortcut EMPTY>

<!ATTLIST newWizardShortcut

id CDATA #REQUIRED>


<!ELEMENT showInPart EMPTY>

<!ATTLIST showInPart

id CDATA #IMPLIED>


<!ELEMENT view EMPTY>

<!ATTLIST view

id           CDATA #REQUIRED

relative     CDATA #REQUIRED

relationship (stack|left|right|top|bottom|fast)

ratio        CDATA #IMPLIED

visible      (true | false)

closeable    (true | false)

moveable     (true | false)

standalone   (true | false)

showTitle    (true | false) >


The following is an example of a perspective extension (note the subelements and the way attributes are used):

    

<extension point=

"org.eclipse.ui.perspectiveExtensions"

>

<perspectiveExtension targetID=

"org.eclipse.ui.resourcePerspective"

>

<actionSet id=

"org.eclipse.jdt.ui.JavaActionSet"

/>

<viewShortcut id=

"org.eclipse.jdt.ui.PackageExplorer"

/>

<newWizardShortcut id=

"org.eclipse.jdt.ui.wizards.NewProjectCreationWizard"

/>

<perspectiveShortcut id=

"org.eclipse.jdt.ui.JavaPerspective"

/>

<view id=

"org.eclipse.jdt.ui.PackageExplorer"

relative=

"org.eclipse.ui.views.ResourceNavigator"

relationship=

"stack"

/>

<view id=

"org.eclipse.jdt.ui.TypeHierarchy"

relative=

"org.eclipse.ui.views.ResourceNavigator"

relationship=

"left"

ratio=

"0.50"

/>

</perspectiveExtension>

</extension>

In the example above, an action set, view shortcut, new wizard shortcut, and perspective shortcut are contributed to the initial contents of the Resource Perspective. In addition, the Package Explorer view is stacked on the Resource Navigator and the Type Hierarchy View is added beside the Resource Navigator.

The items defined within the perspective extension are contributed to the initial contents of the target perspective. Following this, the user may remove any contribution or add others to a perspective from within the workbench user interface.