Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 102885

Summary: [RCP] [PerspectiveBar] A large empty area on the top with a perspectivebar on the left
Product: [Eclipse Project] Platform Reporter: Alessandro Mottadelli <amottadelli>
Component: UIAssignee: Boris Bokowski <bokowski>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P4 CC: adubrovsky, bokowski, eclipse, emoffatt, gilardig, n.a.edgar, pwebster
Version: 3.1Keywords: helpwanted
Target Milestone: 3.5 RC1Flags: emoffatt: review+
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 104545    
Bug Blocks:    
Attachments:
Description Flags
patch none

Description Alessandro Mottadelli CLA 2005-07-06 12:33:56 EDT
We define a new RCP Application using the hello RCP wizard.
We define the method 
ApplicationWorkbenchWindowAdvisor>>preWindowOpen as follows:

configurer.setShowCoolBar(false);
configurer.setShowMenuBar(false);
configurer.setShowPerspectiveBar(true);

PlatformUI.getPreferenceStore().putValue(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,IWorkbenchPreferenceConstants.LEFT);

As result we have a large empty area on the top.
Comment 1 Nick Edgar CLA 2005-07-06 13:54:15 EDT
Rather than setting the current value of the pref, if you override the default
value using the mechanism describe here:
http://eclipse.org/rcp/faq.html#customPrefs
does it work any better?
Comment 2 Gilardi Guido CLA 2005-07-07 04:19:59 EDT
The problem persists also with the the mechanism described in the FAQ
(http://eclipse.org/rcp/faq.html#customPrefs).

The problem seems due to the method 'updateLayoutDataForContents()' of 
class 'WorbenchWindow':

  if ((getCoolBarVisible() && getWindowConfigurer().getShowCoolBar())
                || (getPerspectiveBarVisible() && getWindowConfigurer()
                        .getShowPerspectiveBar())) {
            defaultLayout.addTrim(topBar, SWT.TOP, null);
            topBar.setVisible(true);
        } else {
            defaultLayout.removeTrim(topBar);
            topBar.setVisible(false);
        }


The problem dissapears changing these code lines as follows:

  String perspectiveBarOnTheLeftString=PlatformUI.getPreferenceStore().getString
(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR);
        boolean perspectiveBarOnTheLeft=perspectiveBarOnTheLeftString!=null && 
perspectiveBarOnTheLeftString.equalsIgnoreCase
(IWorkbenchPreferenceConstants.LEFT);
        if ((getCoolBarVisible() && getWindowConfigurer().getShowCoolBar())
                || (getPerspectiveBarVisible() && getWindowConfigurer()
                        .getShowPerspectiveBar() && !perspectiveBarOnTheLeft)) {
            defaultLayout.addTrim(topBar, SWT.TOP, null);
            topBar.setVisible(true);
        } else {
            defaultLayout.removeTrim(topBar);
            topBar.setVisible(false);
        }
Comment 3 Kim Horne CLA 2005-07-07 08:22:23 EDT
*** Bug 102982 has been marked as a duplicate of this bug. ***
Comment 4 Nick Edgar CLA 2005-07-07 10:49:40 EDT
Thanks for investigating further.  Also need to handle the top left case in the
same way.  The topBar should only be shown if the coolbar is visible or if the
perspective bar is visible and is at top right.
Comment 5 Michael Van Meekeren CLA 2005-07-14 16:56:31 EDT
see also bug 70049
Comment 6 Nick Edgar CLA 2005-07-19 10:42:00 EDT
Kim, since you're in this area, would you be able to look at this one, and
evaluate the risk/benefit for a 3.1.1 fix?
Comment 7 Boris Bokowski CLA 2005-07-20 14:34:52 EDT
This might be related to bug 104545.  SWT's default size for empty composites 
is 64x64 pixels. If I change the two constants as described in bug 104545, the 
large empty area goes away.

Not showing the topBar if it is empty might be safer though.
Comment 8 Karice McIntyre CLA 2005-08-29 17:22:46 EDT
Kim, will this be fixed for 3.1.1?  If not, then the Target field should be 
changed.
Comment 9 Kim Horne CLA 2005-09-13 15:32:49 EDT
We will revisit this when SWT addresses bug 104545.
Comment 10 Kevin McGuire CLA 2007-06-21 17:08:06 EDT
A bit old as bugs go but this presumably could now be addressed given that the
dependent SWT bug has been fixed.
Comment 11 Boris Bokowski CLA 2007-10-16 21:16:02 EDT
*** Bug 206015 has been marked as a duplicate of this bug. ***
Comment 12 Benjamin Wolff CLA 2009-02-07 12:07:07 EST
hi, since the bug has been fixed in SWT and the wrong coolbar height is still there (Eclipse 3.4.1 !!!!) are there any plans to fix this or is there a workaround?
Comment 13 Boris Bokowski CLA 2009-02-07 12:26:25 EST
We can try. Marking for M6 because there is no M7 in Bugzilla yet.
Comment 14 Boris Bokowski CLA 2009-03-06 22:59:19 EST
(In reply to comment #13)
> We can try. Marking for M6 because there is no M7 in Bugzilla yet.

Moving to M7 now that we have it :-)
Comment 15 Boris Bokowski CLA 2009-05-06 16:16:07 EDT
Created attachment 134691 [details]
patch

This solves the reported problem. We still have other layout problems though.
Comment 16 Boris Bokowski CLA 2009-05-06 16:23:37 EDT
Eric, can you please have a look at this? If there is any risk involved, then let's not do it at this late stage.

Note that the fix in SWT only changed the default size of CoolBar to (0,0) - an empty Composite still ends up with a (64,64) default size. If SWT had fixed bug 104545 for Composite as well, we would not have to do anything on our end.
Comment 17 Eric Moffatt CLA 2009-05-07 11:08:35 EDT
Boris, the last patch doesn't appear to have the 'computeSize' fix in it. Is it already in ? Do we need it?
Comment 18 Eric Moffatt CLA 2009-05-07 11:10:28 EDT
As far as the patch goes I don't see it as very risky. The logic change in 'updateLayoutDataForContents' makes sense and the extra code only gets invoked when the perspective switcher changes sides so it's not a general performance issue.
Comment 19 Eric Moffatt CLA 2009-05-07 11:23:34 EDT
Tested with a modified RCPMail app and it appears to work fine. The transient layout error when it's first docked on the Top/Right we should likely leave for 3.6.
Comment 20 Boris Bokowski CLA 2009-05-07 11:37:12 EDT
(In reply to comment #17)
> Boris, the last patch doesn't appear to have the 'computeSize' fix in it. Is it
> already in ? Do we need it?

It's not in and we don't need it.
Comment 21 Boris Bokowski CLA 2009-05-07 11:37:56 EDT
(Eric was referring to a "fix" attached as a patch to bug 70049).
Comment 22 Eric Moffatt CLA 2009-05-07 13:07:11 EDT
+1, looks good to me.
Comment 23 Boris Bokowski CLA 2009-05-08 13:05:35 EDT
Patch released to HEAD.
Comment 24 Eric Moffatt CLA 2009-05-08 14:24:06 EDT
Verified in I20090507-2000.