如何在Workbench透视图中将多个视图添加到一个选项卡组中?
作者:互联网
如何使两个视图占据整个空间并能够通过选项卡切换?
我的代码是这样的:
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());
}
}
我可以将区域分成几个部分,但不能将两个视图推到同一个地方.
解决方法:
使用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);
}
}
标签:java,eclipse,eclipse-rcp 来源: https://codeday.me/bug/20190831/1773965.html