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

下载本文档

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

文档简介

如何在自己的透视图(Perspective)里面加入eclipse自带视图,如Project Explorer视图呵呵不好意思, 这里我先前理解错了,加入eclipse自带视图直接addView(org.eclipse.ui.views.ResourceNavigator);就可以了下面我先前理解错了,不过有些代码对我还有点价值,这里也不删除了大家见谅!由于这个是用于自己记忆的文章,这里写的可能粗略了点,大家见谅,如果看起来不太理解大家可以直接查看jdk 源码中org.eclipse.ui.ide.application的源码,里面代码很少,不难理 解,point=org.eclipse.ui.perspectives这个扩展点便是了。 %Perspective.resourceDescription /这里可以查看扩展点API,org.eclipse.ui.perspectiveExtensions扩展点,id 将添加至透视图的“导航”菜单的“显示在.”提示器的视图的唯一标识。 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.newresource.BasicNewFileResourceWizard;import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;/*/public class ResourcePerspective implements IPerspectiveFactory /* * Constructs a new Default 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 */ public 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(IPageLayout.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); 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 = 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.ResourceNavigator); /$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.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.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.createFold

温馨提示

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

评论

0/150

提交评论