Is there any event to know if a view is moved below some other view?

25 views Asked by At

I have a stack of views shown on top of each other. So at a time only 1 view is shown and others are below the active view. I want to know whether a particular view is active or moved below some other view inside the ViewPart code. Is there any listener which can tell me that the composites of any view are now moved below some other composites of another view?

Also it would be great if can I know through listeners that a particular view is now made invisible. I have only access to my view code and that is why I have to implement it in that view only. Stack of views is shown under one Window so the parent shell is same of all the views.

1

There are 1 answers

2
greg-449 On BEST ANSWER

You can use an org.eclipse.ui.IPartListener to listen for events about parts.

In a ViewPart you can use:

getSite().getPage().addPartListener(partListener);

to add a listener. The listener has method for parts being opened, closed, activated and deactivated and brought to the top of stack.

You can also use IPartListener2 which has some additional methods.