eclipse - eclipse rcp 应用程序中的快速 View

标签 eclipse eclipse-rcp

如何向我的 eclipse rcp 应用程序添加快速 View ?

最佳答案

可以添加右键,如this thread :

that can be done by adding a button to fast view bar and by opening a standard view in button event

按钮按钮 = new Button ((Composite)((WorkbenchWindow) window).getFastViewBar ().getControl (), SWT.PUSH);

to avoid overlapping in button event first create folder layout for this view with reference to initial view and then call the action to add view.

IFolderLayout ViewLayout1 = layout.createFolder ( "ViewLayout1",
                                                  IPageLayout.BOTTOM,
                                                  0.50f, initalView.ID);
OpenViewAction ov = new OpenViewAction (window, "label", secondview.ID);
ov.run ();

以编程方式显示和最小化快速 View 应该通过带有参数“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 provides the standard command org.eclipse.ui.views.showView to open an arbitrary view.
The default handler is org.eclipse.ui.handlers.ShowViewHandler. This handler is a nice example how you could add your own command with arguments. It takes two parameters:

  • The first has the ID org.eclipse.ui.views.showView.viewId and identifies the view ID which should be opened,
  • the next one has the ID org.eclipse.ui.views.showView.makeFast and determines if the view should be open as a fast view.

Without parameters the command will let the user choose which view to open.

参见 Parameter for commands 一些例子

Lets see the real world example: "Show View" command. The command is generic and can show any view. The view id is given to the command as a parameter:

<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>

The list of all possible values of the parameter is given by the class ViewParameterValues. The class would iterate through the view registry and return it.


注意:理论上只是为了完整(this thread)

RCP apps can disable fast views by calling WorkbenchWindowConfigurer.setShowFastViewBar(false) from their WorkbenchAdvisor's preWindowOpen() method.
This not only hides the fast view bar, but also hides the Fast View menu item on views.

关于eclipse - eclipse rcp 应用程序中的快速 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2743256/

相关文章:

android - 如何插入 .gif 格式的图像?

php - Eclipse 和 Xdebug 不解析/etc/php5/conf.d 中的附加 ini 文件

java - 将 eclipse 的 java 编译器更改为 jdk7

java - 如何从 Eclipse 中的注释处理器加载类?

java - 当在 GEF 上打开同一文件的不同视角时,如何打开不同的插件

java - 使用tomcat的Eclipse中的WebSocket错误

Eclipse Luna 4.4 : application product with GMF, e4、BIRT、batik 插件未验证

java - 在窗口最大化的情况下启动 Eclipse 3.x RCP 应用程序?

java - 如何删除 eclipse rcp 应用程序中不需要的菜单贡献?

build - 有人有使用 Gradle 构建 Eclipse RCP 应用程序的经验吗?