如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图

上传人:博****1 文档编号:496288435 上传时间:2022-08-14 格式:DOC 页数:5 大小:37KB
返回 下载 相关 举报
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图_第1页
第1页 / 共5页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图_第2页
第2页 / 共5页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图_第3页
第3页 / 共5页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图_第4页
第4页 / 共5页
如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图》由会员分享,可在线阅读,更多相关《如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图(5页珍藏版)》请在金锄头文库上搜索。

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

2、.perspectives这个扩展点便是了。 %Perspective.resourceDescription /这里可以查看扩展点API,org.eclipse.ui.perspectiveExtensions扩展点,id 将添加至透视图的“导航”菜单的“显示在.”提示器的视图的唯一标识。 package org.eclipse.ui.internal.ide.application;import org.eclipse.ui.IFolderLayout;import org.eclipse.ui.IPageLayout;import org.eclipse.ui.IPerspectiveF

3、actory;import org.eclipse.ui.navigator.resources.ProjectExplorer;import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;/*/public class ResourcePerspective implements IPerspectiveFactory /* * Constructs a new Defaul

4、t layout engine. */ public ResourcePerspective() super(); /* * Defines the initial layout for a perspective. */ public void createInitialLayout(IPageLayout layout) defineActions(layout); defineLayout(layout); /* * Defines the initial actions for a page. * param layout The layout we are filling */ pu

5、blic void defineActions(IPageLayout layout) / Add new wizards. layout.addNewWizardShortcut(BasicNewFolderResourceWizard.WIZARD_ID); layout.addNewWizardShortcut(BasicNewFileResourceWizard.WIZARD_ID); / Add show views. layout.addShowViewShortcut(ProjectExplorer.VIEW_ID); layout.addShowViewShortcut(IPa

6、geLayout.ID_BOOKMARKS); layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET); layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW); layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);

7、layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); /* * Defines the initial layout for a page. * param layout The layout we are filling */ public void defineLayout(IPageLayout layout) / Editors are placed for free. String editorArea = layout.getEditorArea(); / Top left. IFolderLayout topLeft =

8、 layout.createFolder( topLeft, IPageLayout.LEFT, (float) 0.26, editorArea);/$NON-NLS-1$ topLeft.addView(ProjectExplorer.VIEW_ID); topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS); / Add a placeholder for the old navigator to maintain compatibility topLeft.addPlaceholder(org.eclipse.ui.views.Resource

9、Navigator); /$NON-NLS-1$ / Bottom left. IFolderLayout bottomLeft = layout.createFolder( bottomLeft, IPageLayout.BOTTOM, (float) 0.50,/$NON-NLS-1$ topLeft);/$NON-NLS-1$ bottomLeft.addView(IPageLayout.ID_OUTLINE); / Bottom right.IFolderLayout bottomRight = layout.createFolder( bottomRight, IPageLayout

10、.BOTTOM, (float) 0.66,/$NON-NLS-1$ editorArea);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.IPageLayout;import org.eclip

11、se.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-N

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号