如何在Eclipse中关闭ViewPart? [英] How to close a ViewPart in Eclipse?
问题描述
org.eclipse.ui.part.ViewPart
的类实现),我需要关闭它。我的意思是完全接近,不只是隐藏。我想要一个新的ViewPart实例创建时,用户(或我的代码)要求再次打开视图。 我找到的唯一方法是 IWorkbenchPage.hideView
隐藏视图,但不完全处理它。在视图中调用处理
也没有影响。
BTW,我的观点被定义为 allowMultiple =false
但是我尝试使用
任何帮助将不胜感激。
我最终发现问题。如果视图在多个角度打开,则将其隐藏在一个视角上将不会关闭。可以遍历所有打开的透视图并查找视图。隐藏它在所有的角度将关闭它。
I have a view in Eclipse (implemented by a class which extends org.eclipse.ui.part.ViewPart
) which I need to close. I mean completely close, not just hide. I want a new ViewPart instance to be created when the user (or my code) asks to open the view again.
The only method I found was IWorkbenchPage.hideView
which hides the view, but does not completely dispose of it. Invoking dispose
on the view has no affect, either.
BTW, my view is defined as allowMultiple="false"
but I tried with true
and that didn't make any difference.
Any help will be appreciated.
I found the problem eventually. If the view is open on more than one perspective, hiding it on one perspective will not close it. It is possible to iterate over all the open perspective and look for the view. Hiding it on all perspectives will close it.
这篇关于如何在Eclipse中关闭ViewPart?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!