下面列出了怎么用org.eclipse.ui.IPlaceholderFolderLayout的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void createInitialLayout(final IPageLayout lay) {
lay.setFixed(false);
lay.setEditorAreaVisible(false);
final String editor = lay.getEditorArea();
final IFolderLayout navigAndParam = lay.createFolder("navigAndParam", IPageLayout.LEFT, 0.3f, editor);
navigAndParam.addView(IGui.PARAMETER_VIEW_ID);
navigAndParam.addView(IGui.NAVIGATOR_VIEW_ID);
navigAndParam.addPlaceholder(IGui.ERROR_VIEW_ID);
navigAndParam.addPlaceholder(IGui.TEST_VIEW_ID);
final IFolderLayout consoleFolder = lay.createFolder("consoles", IPageLayout.BOTTOM, 0.70f, "navigAndParam");
consoleFolder.addView(IGui.INTERACTIVE_CONSOLE_VIEW_ID);
consoleFolder.addView(IGui.CONSOLE_VIEW_ID);
final IPlaceholderFolderLayout displays =
lay.createPlaceholderFolder("displays", IPageLayout.TOP, 0.7f, editor);
displays.addPlaceholder(IGui.LAYER_VIEW_ID + ":*");
displays.addPlaceholder(IGui.GL_LAYER_VIEW_ID + ":*");
displays.addPlaceholder(IGui.GL_LAYER_VIEW_ID2 + ":*");
final IPlaceholderFolderLayout inspect =
lay.createPlaceholderFolder("inspect", IPageLayout.RIGHT, 0.6f, "displays");
inspect.addPlaceholder(IGui.AGENT_VIEW_ID);
inspect.addPlaceholder(IGui.TABLE_VIEW_ID + ":*");
final IPlaceholderFolderLayout monitor =
lay.createPlaceholderFolder("monitor", IPageLayout.BOTTOM, 0.50f, "inspect");
monitor.addPlaceholder(IGui.MONITOR_VIEW_ID);
}
private void createVerticalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.LEFT;
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.BOTTOM;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.BOTTOM;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.BOTTOM, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
private void createHorizontalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.TOP;
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.TOP, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.RIGHT;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.RIGHT;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.RIGHT, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
folder.addView(JavaUI.ID_TYPE_HIERARCHY);
folder.addPlaceholder(IPageLayout.ID_OUTLINE);
folder.addPlaceholder(JavaUI.ID_PACKAGES);
folder.addPlaceholder(JavaPlugin.ID_RES_NAV);
folder.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IPlaceholderFolderLayout outputfolder= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
outputfolder.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(JavaUI.ID_ACTION_SET);
layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
// views - java
layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
// views - debugging
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
// views - standard workbench
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(JavaPlugin.ID_RES_NAV);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut(TemplatesView.ID);
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
// 'Window' > 'Open Perspective' contributions
layout.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE);
layout.addPerspectiveShortcut(JavaUI.ID_BROWSING_PERSPECTIVE);
layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
}