如何在自己的透視圖(Perspective)里面加入eclipse自帶視圖,如Project Explorer視圖.doc_第1頁
如何在自己的透視圖(Perspective)里面加入eclipse自帶視圖,如Project Explorer視圖.doc_第2頁
如何在自己的透視圖(Perspective)里面加入eclipse自帶視圖,如Project Explorer視圖.doc_第3頁
如何在自己的透視圖(Perspective)里面加入eclipse自帶視圖,如Project Explorer視圖.doc_第4頁
免費預覽已結(jié)束,剩余1頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

如何在自己的透視圖(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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論