Bug 27084 - [View Mgmt] Add notification of view becoming hidden / visible
Summary: [View Mgmt] Add notification of view becoming hidden / visible
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P2 major (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Eduardo Pereira CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate, performance
Depends on:
Blocks: 27092
  Show dependency tree
 
Reported: 2002-11-25 09:40 EST by Nick Edgar CLA
Modified: 2002-11-29 15:17 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2002-11-25 09:40:37 EST
build I20021119

Several people have requested the ability to avoid updating a view when it is 
hidden, then bringing it up to date when made visible.

At the SWT level, there is no callback to notify when a control has become 
hidden or visible (other than the paint callback).  Control.isVisible() only 
tells you whether the control and all its parents have been set to be visible, 
not whether it is obscured.

However, at the Workbench level, we know when a view is visible.  We know:
- whether it is a regular view, not in a tab folder,
- whether it is frontmost in a tab folder
- whether it is the active fast view
- whether it is obscured by a zoomed view or editor

We should investigate adding an IPartListener2 interface with partHidden and 
partVisible methods.


Below is a representatitve request for this feature, from boxall@ca.ibm.com:

I would like to raise this topic again because we still need to have a
solution for debug engines that have many local variables, (in the
thousands)

Since making the last append I added code that watches for the closing of
the variables view.   This allows me to tell the connected debug engine to
stop monitoring locals when the user closes the variable view.

This doesn't really solve the problem.

What I really want is notification when the variables view is hidden so
that I have the opportunity to disable/suppress local variable monitoring
until the variables view becomes visiable again.

I can't use the "IPartListener.partDeactivated()" message because just the
act of giving another view focus (not hiding the variables view) will
create this event.    The user still expects the variables view to update
as long as it is visible.
Comment 1 Nick Edgar CLA 2002-11-25 09:41:19 EST
This should be considered as part of the performance improvement work for 2.1 
M4.
Comment 2 Nick Edgar CLA 2002-11-25 09:57:26 EST
Note that you can currently track part visibility using the following hack.
If you hook a resize listener on the view's control, its size will go to 0@0 
when hidden.  This relies on internal implementation details which may change 
in the future, but it may let those interested do some prototyping.

If you do this, not that the resize callback is currently being sent multiple 
times when the part is made visible.  Filed bug 27086 for this.
This means that you'll need to be careful to only update on the first resize 
when going from hidden to visible (you would need to do this anyway to properly 
handle arbitrary resizes).

Comment 3 Alan Boxall CLA 2002-11-26 14:28:42 EST
I just want to make sure that this change actually notifies listeners when the 
view goes hidden (user can't see it) and not just stops asking for content.

The view hidden notification will allow me to tell a debug engine to stop 
monitoring.

The way I interact with engines requires that I tell the engine to stop or 
start monitoring locals.   Getting a hidden notification would allow me to 
tell the engine to stop monitoring.    The next time the view requests content 
I would tell the engine to start monitoring and return the results to the view.
Comment 4 Nick Edgar CLA 2002-11-26 16:14:55 EST
Yes, that is how it should work.  It sounds like you're referring to 
getContents method that content providers implement when using JFace Viewers.
Note that the proposal here is independent of whether you use JFace Viewers or 
not.  We'll simply notify your View (not the same thing as a Viewer) when it is 
hidden and or made visible.  If you're using JFace Viewers, then you would stop 
updating the viewer when the view is hidden, and would probably issue a full 
refresh to the viewer when the view is made visible.

Comment 5 Alan Boxall CLA 2002-11-26 16:48:36 EST
Sounds like what I want.  Thx
Comment 6 Eduardo Pereira CLA 2002-11-29 15:17:40 EST
Added IPartListener2 and released to the HEAD.

We are using setVisible instead of setBounds(0,0,0,0) so the workaround 
proposed in the Comment #2 will not work anymore.