Perspective 自定义设置扩展点
程序员文章站
2022-05-10 14:22:44
...
在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>