Set view position on perspective

1. Click Add button to add perspectiveExtensions extension(org.eclipse.ui.perspectiveExtensions)


2. Set the targetID to "CustomPlugin.perspective" which is created in previous chapter

perspective extension

3. Add a view to the perspectiveExtension. Here is org.eclipse.jdt.ui.PackageExplorer


4. Set the position of the Package Explorer on the perspective

set view position on perspective

    Here are explanations of id, relationship, relative, and radio.
  • id: The view id that you want to add on the perspective
  • relative: the id of reference view, Generally, the "org.eclipse.ui.editorss" is perspective
  • ratio: set the initial size of view
  • relationship: the position of the added view with the "relative"
    • stack: stack with the "relative" (e.g. Console stack with the Problems view)
    • stack position
    • left and right
    • left and right position
    • top and bottom
    • top and bottom position

5. Before running the application, please clear the run-time workspace data. You can set in the Run Configurations. In our example, we set the package explorer shown on the left of our perspective and the ratio is 0.25

clear workspace

6. Result

add project explorer to perspective

7. Add more views


8. Corresponding view extensions

view extensions

Tips: You can add your custom view on the perspective through setting the id of view in perspective extension. For details of creating custom views, please move to the View category.