如何在自己的透视图(Perspective)里面加入eclipse自带视图,如ProjectExplorer视图呵呵不好意思,这里我先前理解错了,加入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-将添加至透视图的“导航”菜单的“显示在...”提示器的视图的唯一标识。packageorg.eclipse.ui.internal.ide.application;importorg.eclipse.ui.IFolderLayout;importorg.eclipse.ui.IPageLayout;importorg.eclipse.ui.IPerspectiveFactory;importorg.eclipse.ui.navigator.resources.ProjectExplorer;importorg.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;importorg.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;/***/publicclassResourcePerspectiveimplementsIPerspectiveFactory{/***ConstructsanewDefaultlayoutengine.*/publicResourcePerspective(){super();}/***Definestheinitiallayoutforaperspective.*/publicvoidcreateInitialLayout(IPageLayoutlayout){defineActions(layout);defineLayout(layout);}/***Definestheinitialactionsforapage.*@paramlayoutThelayoutwearefilling*/publicvoiddefineActions(IPageLayoutlayout){//Add"newwizards".layout.addNewWizardShortcut(BasicNewFolderResourceWizard.WIZARD_ID);layout.addNewWizardShortcut(BasicNewFileResourceWizard.WIZARD_ID);//Add"showviews".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);}/***Definestheinitiallayoutforapage.*@paramlayoutThelayoutwearefilling*/publicvoiddefineLayout(IPageLayoutlayout){//Editorsareplacedforfree.StringeditorArea=layout.getEditorArea();//Topleft.IFolderLayouttopLeft=layout.createFolder("topLeft",IPageLayout.LEFT,(float)0.26,editorArea);//$NON-NLS-1$topLeft.addView(ProjectExplorer.VIEW_ID);topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);//AddaplaceholderfortheoldnavigatortomaintaincompatibilitytopLeft.addPlaceholder("org.eclipse.ui.views.ResourceNavigator");//$NON-NLS-1$//Bottomleft.IFolderLayoutbottomLeft=layout.createFolder("bottomLeft",IPageLayout.BOTTOM,(float)0.50,//$NON-NLS-1$"topLeft");//$NON-NLS-1$bottomLeft.addView(IPageLayout.ID_OUTLINE);//Bottomright.IFolderLayoutbottomRight=layout.createFolder("bottomRight",IPageLayout...