RCP如何添加透视图
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、效果如图:


浙公网安备 33010602011771号