1、在plugin.xml添加透视图扩展点
<extension point="org.eclipse.ui.perspectives"> <perspective class="myviewrcp2.MyPerspective" icon="icons/samples.gif" id="myviewrcp2.MyPerspective" name="自定义透视图"/> </extension>
2、添加透视图类
package myviewrcp2; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveFactory; public class MyPerspective implements IPerspectiveFactory { @Override public void createInitialLayout(IPageLayout layout) { // TODO Auto-generated method stub String editorArea = layout.getEditorArea(); layout.addView(SampleView.ID, IPageLayout.LEFT, 0.45f, editorArea); layout.addView(AnotherView.ID, IPageLayout.BOTTOM, 0.45f, editorArea); } }
3、在ApplicationWorkbenchWindowAdvisor类中设置可选择透视图的按钮
4、效果如图:
标签:layout,editorArea,RCP,添加,IPageLayout,透视图 From: https://www.cnblogs.com/wwssgg/p/16879968.html