Reputation: 75906
Is it possible to override the layout of a built-in perspective in my Eclipse-RCP product?
In particular, I wish to add a custom view and change the layout of the Debug perspective. I know how to do it with a custom perspective (IPerspectiveFactory.createInitialLayout()
). I'd want that my custom layout to be permanent -survive the "Reset perspective" command.
Upvotes: 2
Views: 1293
Reputation: 2274
Extending a perspective is possible by using the extension point org.eclipse.ui.perspectiveExtensions
.
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.
To extend the default debug perspective paste the following code in your plugin.xml
:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.debug.ui.DebugPerspective">
<view
ratio="0.5"
relative="org.eclipse.ui.views.TaskList"
relationship="right"
id="com.jens.customdebug.views.SampleView">
</view>
</perspectiveExtension>
</extension>
You have to define a relative view (in my case the task view named org.eclipse.ui.views.TaskList
) and the id of your own view (in my case com.jens.customdebug.views.SampleView
)
Source:
To get further information how to use this extension point, take a look here. For the configuration markup of this extension point you may also take a look at this page.
Upvotes: 1
Reputation: 51445
Create a class that implements IPerspectiveFactory
.
Add a perspectives extension to your plugin.xml
. Here's one of mine.
<extension point="org.eclipse.ui.perspectives">
<perspective
class="gov.bop.cobolsupport.perspectives.CobolPerspectiveFactory"
icon="icons/ispf_editor.gif"
id="gov.bop.cobolsupport.CobolPerspective"
name="Cobol"/>
</extension>
Your users can change your perspective, and save their changes if they wish. That's built into Eclipse.
However, when you extend your perspective, the Reset Perspective command resets the perspective to how you defined it in your Perspectivefactory
class.
Upvotes: 2