This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 434062 - [Perspectives] Console View "clipped" when switching Perspectives (eg, Debug -> Java)
Summary: [Perspectives] Console View "clipped" when switching Perspectives (eg, Debug ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 4.4 RC1   Edit
Assignee: Eric Moffatt CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-04 16:20 EDT by Scott Klein CLA
Modified: 2014-05-27 14:51 EDT (History)
1 user (show)

See Also:
pwebster: review+


Attachments
Perspective2 screenshot (71.65 KB, image/jpeg)
2014-05-04 16:20 EDT, Scott Klein CLA
no flags Details
Perspective1 screenshot (51.52 KB, image/jpeg)
2014-05-04 16:21 EDT, Scott Klein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Klein CLA 2014-05-04 16:20:53 EDT
Created attachment 242685 [details]
Perspective2 screenshot

Setup:
* Pick two perspectives (eg, Debug and Java) to use for testing. "Perspective1" and "Perspective2"
* Switch to "Perspective1"
** Ensure the Console view is visible inside the View Panel
* Switch to "Perspective2"
** Move the console view out of the View Panel (I have it on a second monitor, but just making it a separate window seems to suffice)

Steps to Reproduce
# Start in "Perspective1"
## Somehow make some console output - eg, run a simple app that outputs to the console
# Switch to "Perspective2"
## What I see when doing this is the external Console view is clipped at a height of about 50% of the actual Console view height.
# Resize the Console view
## Now the Console view is properly "expanded" inside the external view

This, to me, looks like a "refresh/revalidate" UI bug that is common in Java Swing where if you have to pack/refresh/revalidate/layout/whatever the UI component for it to resize properly

Screenshot attached
Comment 1 Scott Klein CLA 2014-05-04 16:21:29 EDT
Created attachment 242686 [details]
Perspective1 screenshot
Comment 2 Wojciech Sudol CLA 2014-05-05 06:54:08 EDT
Reproduced in I20140501-0200 on Windows 7 x64.
Comment 3 Eric Moffatt CLA 2014-05-05 15:40:52 EDT
I've been seeing this recently as well, likely due to some of our layout 'optimizations'. We should take a look into this one.

I see it mostly when I have the Console minimized in two different perspectives in 'fly outs' of different sizes. Starting a debug session always spews a lot of output for me because I have the test code in my WS. In my case the stack the console is in is minimized but opens quite wide in the Debug perspective but normal sized in my Java perspective. If I run my inner and from the Debug perspective, let the Console show up and quickly switch to the Java perspective I can get it into this state....
Comment 4 Eric Moffatt CLA 2014-05-05 15:41:35 EDT
BTW, I'm almost certain that this is a regression from Kepler...
Comment 5 Eric Moffatt CLA 2014-05-08 14:12:57 EDT
Here's the Gerrit:

  https://git.eclipse.org/r/26229

NOTE: this code will look odd because it arbitrarily resizes the CTF during the open. If we have two perspectives A & B both with the Console minimized and then when we open it in A we reparent the Console to A's CTF then show it. However since the CTF is the same size it was last time SWT treats this as a no-op; since the CTF didn't really change size it decides that it doesn't need to resize the selected tab's control (not realizing that the *same* control was just resized by showing the Console in B).

This is only an issue when the Console is currently the selected element in *both* CTF's; if not the the change in the selected tab forces the correct size for the newly showing tab.

BTW, for some unknown reason even trying to set the bounds of the tab item's Control to the CTF's client area didn't work (possibly because we're trapped in 'deferred layouts' at the time).

Note that resizing the CTF will layout *only* the currently selected tab's control.
Comment 7 Eric Moffatt CLA 2014-05-16 10:17:15 EDT
Verified in 4.4.0.I20140515-1230.

NOTE: I may have a better fix for this for 4.5. Rather than resizing the CTF (which should be considered the hack of last resort...;-) we should look at the ElementReferenceRenderer; it's responsible for the re-parenting so it's the right place to ensure that a control being re-parented into a CTF has the correct bounds...
Comment 8 Eric Moffatt CLA 2014-05-27 14:51:34 EDT
Note that we're currently considering using a pattern that rather than relying on the CTF's 'layout' when dealing with issues around the *item* control size it may be better to simply use the following pattern: 

cti.getControl().setBounds(ctf.getClientArea());

This will simply adjust the item's bounds and an internal layout will be automatically triggered if the bounds actually change (as they would not if you were just switching tabs).