如何只显示一个视图

时间:2012-04-19 11:19:55

标签: eclipse-rcp

我是RCP的新手,也许问题基本但是: 在两个视图的透视图中,如何在应用程序开头只显示其中一个?

1 个答案:

答案 0 :(得分:1)

试试这个

    public class Perspective implements IPerspectiveFactory {

        /** Top folder's id. */
        public static final String FI_TOP = Bootstrap.PLUGIN_ID + ".topFolder";
        /** Top folder's id. */
        public static final String FI_BOTTOM = Bootstrap.PLUGIN_ID+ ".bottomFolder";

        float ratioTop = 0.35f;
        float ratioBottom = 0.60f;

        private IPageLayout layout;

        public void createInitialLayout(IPageLayout layout) {
            this.layout = layout;

            String editorAreaId = layout.getEditorArea();
            layout.setEditorAreaVisible(false);

            layout.createPlaceholderFolder(FI_TOP, IPageLayout.TOP, ratioTop, editorAreaId);
            layout.createPlaceholderFolder(FI_BOTTOM, IPageLayout.BOTTOM, ratioBottom, editorAreaId);

            //Opnen a view
            layout.addView("MyViewId", IPageLayout.TOP, 0.9f, layout.getEditorArea());

        }

        public IPageLayout getLayout() {
            return layout;
        }