Search code examples
eclipsercpperspective

Eclipse RCP - Perspective Layout


I'm currently developing an Eclipse RCP application. I want to create a perspective where I have 3 views (project explorer, editors area, and a custom view), each in a different column. Below them I want to have the console view.


Desired Layout

I don't know how to put the console view at the bottom. Also, the ratios I define for project explorer, custom view in relation to the editor area is not applied for some reason. The editors should take the 70% of the space, the rest equally between the custom view and the project explorer.

This is what I have right now:

     <view
           id="AvgPowerTool.SettingsView"
           minimized="false"
           ratio="0.15"
           relationship="right"
           relative="org.eclipse.ui.editorss"
           visible="true">
     </view>
     <view
           id="org.eclipse.ui.navigator.ProjectExplorer"
           minimized="false"
           ratio="0.15"
           relationship="left"
           relative="org.eclipse.ui.editorss"
           showTitle="true"
           standalone="false"
           visible="true">
     </view>
     <view
           id="org.eclipse.ui.console.ConsoleView"
           minimized="false"
           ratio="1"
           relationship="bottom"
           relative="org.eclipse.ui.editorss"
           visible="true">
     </view>

Solution

  • The order in which you declare the views is important in getting the view to stretch across the whole window. Declare the console view first:

     <view
           id="org.eclipse.ui.console.ConsoleView"
           minimized="false"
           ratio="0.75"
           relationship="bottom"
           relative="org.eclipse.ui.editorss"
           visible="true">
     </view>
     <view
           id="AvgPowerTool.SettingsView"
           minimized="false"
           ratio="0.85"
           relationship="right"
           relative="org.eclipse.ui.editorss"
           visible="true">
     </view>
     <view
           id="org.eclipse.ui.navigator.ProjectExplorer"
           minimized="false"
           ratio="0.15"
           relationship="left"
           relative="org.eclipse.ui.editorss"
           showTitle="true"
           standalone="false"
           visible="true">
     </view>
    

    The ratios for views at the bottom (and right) give the percentage occupied by the views above (or to the left) of the view so they are large numbers. In my example the console view occupies the bottom 25% of the window, the project explorer the left most 15% and the settings view the right most 15%.

    Note: You will need to do the 'Window > Reset Perspective' each time you change this values in the plugin.xml