package com.posture.example.navigator;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;
import com.posture.example.navigator.wizards.NewRobinProjectWizard;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
defineActions(layout);
defineLayout(layout);
}
// 定义透视图上的默认行为
private void defineActions(IPageLayout layout) {
layout.addNewWizardShortcut(NewRobinProjectWizard.NEW_ROBIN_PROJECT_ID);
// 添加 新建文件夹
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/show view 上的东西
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
}
private void defineLayout(IPageLayout layout) {
IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f, IPageLayout.ID_EDITOR_AREA);
topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
IFolderLayout bottomLeft = layout.createFolder(
"bottomLeft", IPageLayout.BOTTOM, (float) 0.50,//$NON-NLS-1$
"topLeft");//$NON-NLS-1$
bottomLeft.addView(IConsoleConstants.ID_CONSOLE_VIEW);
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.25f, IPageLayout.ID_EDITOR_AREA);
}
}