如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视_第1页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视_第2页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视_第3页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视_第4页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、.如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图呵呵 不好意思, 这里我先前理解错了,加入eclipse自带视图直接addView("org.eclipse.ui.views.ResourceNavigator");就可以了下面我先前理解错了,不过有些代码对我还有点价值,这里也不删除了大家见谅!由于这个是用于自己记忆的文章,这里写的可能粗略了点,大家见谅,如果看起来不太理解大家可以直接查看jdk 源码中org.eclipse.ui.ide.application的源码,里面代码很少,不难理 解,p

2、oint="org.eclipse.ui.perspectives"这个扩展点便是了。      <extension         point="org.eclipse.ui.perspectives">      <perspective          

3、;  name="%Perspective.resourcePerspective"            icon="$nl$/icons/full/eview16/resource_persp.gif"            class="ernal.ide.applicatio

4、n.ResourcePerspective"            id="org.eclipse.ui.resourcePerspective">         <description>            %Perspective.resou

5、rceDescription         </description>      </perspective>   </extension> <extension         point="org.eclipse.ui.perspectiveExtensions"> 

6、60;    <perspectiveExtension            targetID="org.eclipse.ui.resourcePerspective"> /这里可以查看扩展点API,org.eclipse.ui.perspectiveExtensions扩展点,id 将添加至透视图的“导航”菜单的“显示在.”提示器的视图的唯一标识。     &#

7、160;    <showInPart               id="org.eclipse.ui.navigator.ProjectExplorer">         </showInPart>      </perspectiveExte

8、nsion>   </extension> package ernal.ide.application;import org.eclipse.ui.IFolderLayout;import org.eclipse.ui.IPageLayout;import org.eclipse.ui.IPerspectiveFactory;import org.eclipse.ui.navigator.resources.ProjectExplorer;import org.eclipse.ui.wizards.newres

9、ource.BasicNewFileResourceWizard;import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;/* */public class ResourcePerspective implements IPerspectiveFactory      /*     * Constructs a new Default layout engine.     */&#

10、160;   public ResourcePerspective()         super();        /*     * Defines the initial layout for a perspective.       */    public void createInitialLayout(I

11、PageLayout layout)         defineActions(layout);        defineLayout(layout);        /*     * Defines the initial actions for a page.       * param layout

12、 The layout we are filling     */    public void defineActions(IPageLayout layout)         / Add "new wizards".        layout.addNewWizardShortcut(BasicNewFolderResourceWizard.WIZARD_ID

13、);        layout.addNewWizardShortcut(BasicNewFileResourceWizard.WIZARD_ID);        / Add "show views".        layout.addShowViewShortcut(ProjectExplorer.VIEW_ID);   

14、0;    layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);        layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);        layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);      

15、;  layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);        layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW);        layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);      

16、0; layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);        /*     * Defines the initial layout for a page.       * param layout The layout we are filling     */    public void define

17、Layout(IPageLayout layout)         / Editors are placed for free.        String editorArea = layout.getEditorArea();        / Top left.        IFolderLayout top

18、Left = layout.createFolder(                "topLeft", IPageLayout.LEFT, (float) 0.26, editorArea);/$NON-NLS-1$        topLeft.addView(ProjectExplorer.VIEW_ID);   

19、60;    topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);        / Add a placeholder for the old navigator to maintain compatibility        topLeft.addPlaceholder("org.eclipse.ui.views.ResourceNavigator");

20、/$NON-NLS-1$        / Bottom left.        IFolderLayout bottomLeft = layout.createFolder(                "bottomLeft", IPageLayout.BOTTOM, (float

21、) 0.50,/$NON-NLS-1$                "topLeft");/$NON-NLS-1$        bottomLeft.addView(IPageLayout.ID_OUTLINE);        / Bottom right.  I

22、FolderLayout bottomRight = layout.createFolder(                "bottomRight", IPageLayout.BOTTOM, (float) 0.66,/$NON-NLS-1$                e

23、ditorArea);    bottomRight.addView(IPageLayout.ID_TASK_LIST);      自用代码(透视图配置) 博客分类: · eclipse插件EclipseUIpackage com.posture.example.navigator;import org.eclipse.debug.ui.IDebugUIConstants;import org.eclipse.ui.IFolderLayout;import org.eclipse.ui.IPa

24、geLayout;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)    &#

25、160;defineActions(layout);  defineLayout(layout);   / 定义透视图上的默认行为  private void defineActions(IPageLayout layout)   layout.addNewWizardShortcut(NewRobinProjectWizard.NEW_ROBIN_PROJECT_ID);  / 添加 新建文件夹  layout.addNewWizardShortcut("

26、;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.UntitledTe

27、xtFileWizard");/$NON-NLS-1$                / 在当前视图上 window/show view 上的东西        layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);        layo

28、ut.addShowViewShortcut(IPageLayout.ID_OUTLINE);        layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);        layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);        layout.addShowViewShortcut(IPageLayout.ID_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论