如何將快速視圖添加到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應用程序中禁用快速訪問TextField
- 3. 如何在eclipse RCP應用程序中集成XML Schema視圖
- 4. 如何在Eclipse RCP應用程序中使視圖可滾動?
- 5. 如何重置Eclipse e4 RCP應用程序的透視圖?
- 6. Eclipse RCP中的應用程序設計
- 7. Eclipse RCP應用程序中的NoClassDefFoundError
- 8. jruby中的Eclipse RCP應用程序
- 9. 向Eclipse RCP應用程序添加「創建Jira票據」視圖
- 10. 如何將Project Explorer視圖添加到Eclipse RCP應用程序
- 11. Eclipse RCP快速查看水平方向
- 12. rcp eclipse應用程序的位置
- 13. MVC的Eclipse RCP應用程序
- 14. Spring Rans的Eclipse RCP應用程序
- 15. 使用OSGi Eclipse RCP應用程序
- 16. e4 Rcp應用程序中的樹視圖
- 17. 如何從Eclipse RCP應用程序中的代碼更新視圖
- 18. 在Eclipse RCP應用程序中查找當前所選視圖的ID
- 19. Eclipse RCP圖像應用程序:如何佈置我的圖像?
- 20. 如何在RCP應用程序中重用Eclipse 4 IDE透視圖功能
- 21. Eclipse RCP應用程序調試
- 22. 獲取在Eclipse RCP應用程序
- 23. Eclipse RCP應用程序無法啓動
- 24. Eclipse RCP應用程序無法啓動
- 25. 從Eclipse RCP應用程序製作jar
- 26. 如何更新Eclipse RCP應用程序?
- 27. Eclipse 4中的常見Eclipse 4插件RCP應用程序
- 28. 從另一個rcp應用程序啓動rcp應用程序
- 29. 如何獲得eclipse在RCP應用程序中共享圖像?
- 30. 如何在eclipse rcp應用程序中獲取圖像路徑