如何使两个视图占据整个空间并能够通过标签切换?
我的代码是这样的:
package org.eclipsercp.hyperbola;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
layout.addView(ContactsView.ID, IPageLayout.TOP, 0.5f, layout.getEditorArea());
//layout.addStandaloneView(ContactsView.ID, false, IPageLayout.LEFT, 1.0f, layout.getEditorArea());
layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.TOP, 0.5f, layout.getEditorArea());
}
}
我可以将区域分成几个部分但不能将两个视图推到同一个地方。
答案 0 :(得分:5)
为此目的使用IFolderLayout
:
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
IFolderLayout folder = layout.createFolder("Folder", IPageLayout.LEFT, 0.5f, layout.getEditorArea());
folder.addView(ContactsView.ID);
folder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
}
}