|Closing a view that is not in active Perspective [message #700003]
||Fri, 22 July 2011 13:32
| Rashmy A
Registered: July 2009
There is a need for me to close a View that might be open in a perspective that is no currently active. How can I achieve this?
I tried to implement IPerspectiveListener in which I check if the perspective being activated is the open I'm interested in and try to close it.
It works as long as my view is also active. If I want to close views that are not hidden or deactivated then I cannot do it.
Any suggestions on how I can achieve this?
This is the code that used:
if( perspective.getId().equals( MyPerspective.ID ) )
IViewReference viewRefs = page.getViewReferences( MyrView.VIEW_ID );
if( viewRefs != null )
for( IViewReference vr : viewRefs )
IViewPart vp = vr.getView( false ); -> vp is null if the view is not active
if( vp instanceof MyrView )
if( ( (MyView) vp ).getToBeClosed() )
page.hideView( vp );
[Updated on: Fri, 22 July 2011 13:32]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01608 seconds