在RCP开发中,会要求对特定的perspective 进行自定义设置,比如显示、隐藏某个菜单等,这些操作都可以通过在Window菜单下的Customize Perspective 菜单项实现。如果想设定默认的透视图的状态,可以使用org.eclipse.ui.perspectiveExtensions扩展点。
Eclipse Doc写道
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.
一个示例:
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.ui.resourcePerspective"> <!-- 目标透视图-->
<actionSet id="org.eclipse.jdt.ui.JavaActionSet"/> <!-- 显示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>
本文介绍如何在Eclipse中通过`org.eclipse.ui.perspectiveExtensions`扩展点来自定义透视图,包括显示、隐藏菜单及调整视图布局等。适用于希望个性化工作空间的开发者。
201

被折叠的 条评论
为什么被折叠?



