如何將快速視圖添加到eclipse rcp應用程序中?eclipse rcp應用程序中的快速視圖
回答
您可以添加右鍵,在:
,可以通過添加一個按鈕來快速視圖欄和按鈕事件
Button按鈕打開一個標準視圖來完成((Composite))((WorkbenchWindow)window).getFastViewBar().getControl(),SWT.PUSH);
爲了避免按鈕事件重疊,首先參考初始視圖爲該視圖創建文件夾佈局,然後調用操作添加視圖。
IFolderLayout ViewLayout1 = layout.createFolder ("ViewLayout1",
IPageLayout.BOTTOM,
0.50f, initalView.ID);
OpenViewAction ov = new OpenViewAction (window, "label", secondview.ID);
ov.run();
顯示和最小化快速視圖編程應通過命令「org.eclipse.ui.views.showView
」來進行與參數「org.eclipse.ui.views.showView.makeFast
」。
Eclipse RCP: open a view via standard command org.eclipse.ui.handlers.ShowViewHandler
參見:
Eclipse提供的標準命令
org.eclipse.ui.views.showView
打開的任意視圖。
默認處理程序是org.eclipse.ui.handlers.ShowViewHandler
。這個處理程序是一個很好的例子,你可以如何使用參數添加自己的命令。它有兩個參數:
- 第一有
ID
org.eclipse.ui.views.showView.viewId
和識別哪個應當打開的視圖ID,- 下一個具有
ID
org.eclipse.ui.views.showView.makeFast
,並且確定如果視圖應該是作爲快速視圖中打開。沒有參數,該命令將讓用戶選擇打開哪個視圖。
的一些例子
讓我們看到現實世界的例子見Parameter for commands: 「顯示視圖」 命令。該命令是通用的,可以顯示任何視圖。視圖ID被提供給命令作爲參數:
<command
name="%command.showView.name"
description="%command.showView.description"
categoryId="org.eclipse.ui.category.views"
id="org.eclipse.ui.views.showView"
defaultHandler="org.eclipse.ui.handlers.ShowViewHandler">
<commandParameter
id="org.eclipse.ui.views.showView.viewId"
name="%command.showView.viewIdParameter"
values="org.eclipse.ui.internal.registry.ViewParameterValues" />
<commandParameter
id="org.eclipse.ui.views.showView.makeFast"
name="%command.showView.makeFastParameter"
optional="true"/>
</command>
參數的所有可能值的列表由類
ViewParameterValues
給出。該類將遍歷視圖註冊表並返回它。
注:只是要完成,理論上(this thread)
RCP應用程序可以從他們
WorkbenchAdvisor
的preWindowOpen()
方法調用WorkbenchWindowConfigurer.setShowFastViewBar(false)
禁用快速意見。
這不僅隱藏快速查看欄,而且隱藏視圖上的快速查看菜單項。
將快速視圖添加到Eclipse RCP或RAP應用程序的簡單方法是從創建普通視圖開始。在插件xml中,爲視圖添加一個新的擴展(我將其稱爲fast.view),並使用正確的屬性。
<view
closable="true"
id="fast.view"
minimized="true"
ratio=".30f"
relationship="fast" <--- This attribute tells the view to be a fast view.
relative="other.view"
</view>
添加此擴展後,我們還必須在工作區中顯示快速視圖欄。要做到這一點,編輯(即啓動您的工作臺窗口或其他顧問)的ApplicationWorkbenhWindowAdvisor,並添加以下行到preWindowOpen()方法:
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setShowFastViewBars(true);
如果你已經有一個IWorkbenchWindowsConfigurer,你不需要做一個新的。此方法告訴工作臺顯示快速欄,並且您的新快速視圖透視圖擴展應該在啓動時存在。
我從一篇由Lars Vogel編寫的Eclipse Papercuts文章中得到這個信息:http://www.vogella.de/blog/2009/09/15/fastview-eclipse-rcp/
- 1. RCP應用程序和進度視圖在Eclipse RCP
- 2. 如何在eclipse RCP應用程序中集成XML Schema視圖
- 3. Eclipse RCP應用程序中的NoClassDefFoundError
- 4. 如何將Project Explorer視圖添加到Eclipse RCP應用程序
- 5. Eclipse RCP快速查看水平方向
- 6. MVC的Eclipse RCP應用程序
- 7. rcp eclipse應用程序的位置
- 8. 使用OSGi Eclipse RCP應用程序
- 9. e4 Rcp應用程序中的樹視圖
- 10. 如何從Eclipse RCP應用程序中的代碼更新視圖
- 11. Eclipse RCP圖像應用程序:如何佈置我的圖像?
- 12. 如何在RCP應用程序中重用Eclipse 4 IDE透視圖功能
- 13. Eclipse RCP應用程序無法啓動
- 14. Eclipse RCP應用程序調試
- 15. 如何更新Eclipse RCP應用程序?
- 16. Eclipse 4中的常見Eclipse 4插件RCP應用程序
- 17. 從另一個rcp應用程序啓動rcp應用程序
- 18. Eclipse rcp在eclipse應用程序中禁用退出按鈕
- 19. 自Eclipse Juno以來在RCP應用程序中切換透視圖?
- 20. java快速應用程序
- 21. 在Eclipse中快速開發應用程序Alfresco(Hot Reloading)
- 22. 在RCP應用程序中切換控制檯的視圖
- 23. 如何關閉RCP應用程序中的視圖?
- 24. Eclipse RCP:視圖和編輯器的命令處理程序
- 25. 沒有Eclipse GUI的Eclipse RCP應用程序
- 26. ECLIPSE RCP應用程序:視圖在打開另一個窗口後消失
- 27. 如何刪除Eclipse RCP的「Hello RCP」模板中的空視圖
- 28. 在我的eclipse rcp應用程序中禁用「Reset Perspective ...」菜單
- 29. 使用Eclipse Classic開發Eclipse RCP應用程序
- 30. 在eclipse rcp中關閉視圖