How to close a ViewPart in Eclipse?

前端 未结 6 1374
时光取名叫无心
时光取名叫无心 2020-12-10 05:52

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 wa

6条回答
  •  天涯浪人
    2020-12-10 05:59

    I think the IWorkbenchPage.hideView() method you mentioned is the only one available to programmaticaly close a view. I also think this method name should be closeView() beacause it really close the view.

    I have been using this method for a while (with allowMultiple=true views) and after debugging it seems my view.dispose() method is invoked each time I invoke hideView().

    Next time I open this view again (I mean from my code and not from user interface), a new one is created by Eclipse and the createPartControl() method is invoked again.

    Moreover, the call hierarchy view told me than the hideView() should call the dispose method() ....

    hideView() >> releaseView() >> partRemoved() >> disposePart() >> dispose() >> doDisposePart() >> doDisposePart() >> dispose()
    

    Hope this can help ....

    One last question, how did you checked that your view was not correctly disposed ??

提交回复
热议问题