简体   繁体   English

选择侦听器何时在视图中注册?

[英]When are selection listeners register in a view?

I have a View in my RCP application that draws some things and it's created when the user clicks a certain Toolbar action. 我的RCP应用程序中有一个View ,该View会绘制一些东西,它是在用户单击某个Toolbar操作时创建的。 The View implments the ISelectionProvider and when some objects in the view are clicked their properties are shown in the property view. View将实现ISelectionProvider并且单击视图中的某些对象时,其属性将显示在属性视图中。

The problem is when I programmatically show the view through getActivePage.showView("viewid") in the run() method of the action it seems that no listeners are registered so nothing is shown in the properties view. 问题是,当我在动作的run()方法中通过getActivePage.showView("viewid")以编程方式显示view时,似乎没有注册任何listeners器,因此在属性视图中未显示任何内容。

As soons as a hide the view by pressing some other view to appear and then I open it again the listeners are registered and the properties are shown. 通过按其他某个view将其隐藏起来,然后再次打开它,就可以注册侦听器并显示属性。

So in what method are these listeners registered that is not called with the showView command? 那么这些listeners是用什么方法注册的,而showView命令没有调用这些listeners

我认为如果视图具有焦点,则宣布选择,在显示之前,请尝试以编程方式设置焦点。

It's triggered when the part is activated. 激活零件时触发。 Try 尝试

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("myViewId", null, IWorkbenchPage.VIEW_ACTIVATE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM