`
dadi520
  • 浏览: 145696 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

自用代码(透视图配置)

阅读更多

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);

 }

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics