Bug 81460 - [Workbench] (regression) Close all perspectives, open Java perspective, layout wrong
Summary: [Workbench] (regression) Close all perspectives, open Java perspective, layou...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-16 15:25 EST by Douglas Pollock CLA
Modified: 2005-05-10 17:03 EDT (History)
3 users (show)

See Also:


Attachments
Patch to WorkbenchWindow (2.59 KB, patch)
2005-04-25 12:13 EDT, Nick Edgar CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Pollock CLA 2004-12-16 15:25:54 EST
I20041216-1200, Solaris, Motif, CDE 
 
If you close all perspectives and then open the Java perspective, the layout 
of the Java perspective is wrong.  The editor area is given almost all of the 
space, and the outline/explorer/problems views are all squished.
Comment 1 Kim Horne CLA 2004-12-16 15:32:08 EST
And when you then Reset, the window adjusts itself.  Odd.
Comment 2 Nick Edgar CLA 2004-12-16 15:56:37 EST
Stefan, would you be able to look into this?
Comment 3 Stefan Xenos CLA 2004-12-16 17:01:51 EST
I believe the cause is the same as bug 69615: ever since views stopped resizing
proportionally window, the initial ratios in a perspective are no longer
deterministic.
Comment 4 Nick Edgar CLA 2004-12-17 09:31:35 EST
The problem is in the initial layout of the perspective, which is specified as
ratios, not in resizing.  No resize is necessary to show the problem.  I don't
see why this can't be deterministic based on the current size of the window.
Comment 5 Nick Edgar CLA 2004-12-17 09:51:48 EST
Does not occur in 3.0.1, so it's not directly caused by the resize change.
Comment 6 Nick Edgar CLA 2005-03-30 12:41:02 EST
Occurs on Windows too.

This looks really goofy.  Please consider for M7.
Comment 7 Stefan Xenos CLA 2005-03-30 16:07:26 EST
Re: comment 5

You're right, this is different. I should have read the steps to reproduce more
carefully.
Comment 8 Stefan Xenos CLA 2005-04-22 00:44:40 EDT
The bug is in WorkbenchWindow. It creates the WorkbenchPage control and the
"getWindowAdvisor().createEmptyWindowContents" control in the same composite,
which has a FillLayout(SWT.HORIZONTAL) for its layout.

This means that when the workbench page composite gets its initial size, it's
sharing half the window with the "no perspectives" composite and the initial
layout is computed for a thin, tall composite. 

This is the size used to compute the initial view sizes, which don't change when
the page gets its final (correct) size. This could be fixed by using a
WorkbenchWindow layout that makes all the children overlap and fill the window,
or by disposing the "no perspectives" composite before creating the workbench
page controls.

If I recall correctly, Eclipse 3.0 didn't make use of createEmptyWindowContents,
so the workbench page ended up alone in the window and was computed with the
correct width.
Comment 9 Nick Edgar CLA 2005-04-25 11:55:36 EDT
I'll fix it up, as this was due to the createEmptyWindowContents change.
Comment 10 Nick Edgar CLA 2005-04-25 12:13:54 EDT
Created attachment 20310 [details]
Patch to WorkbenchWindow

I've changed the layout to be a StackLayout, since the empty window contents
was not been created/disposed in the same place as the workbench page's
controls.
This may lead to extra layouts though.

Stefan, could you please review this patch?
Comment 11 Stefan Xenos CLA 2005-04-25 14:02:05 EDT
Nick: the patch looks okay to me. I verified that there are no extra layouts
being triggered on perspective switches, and that it fixes this PR.

There does seem to be 3 redundant layouts of a PartSashContainer when opening
the first perspective, but I don't think that's due to your patch.

Looking through the code, I think we may be able to squeeze out a small amount
of extra performance like this:

- Get rid of the pageComposite and the StackLayout
- Create the page controls directly under the shell, and use the center control
of the TrimLayout like a StackLayout. That is, rather than this:
  layout.topControl = newPage.getClientComposite()
  use this:
  defaultLayout.setCenterControl(newPage.getClientComposite());

This will eliminate one SWT Composite and one layer of layouts. This is a very
minor optimization, so just take it as a suggestion.
Comment 12 Nick Edgar CLA 2005-04-25 14:54:44 EDT
Unfortunately I don't think we can get away with that optimization since the app
has control over where the page composite is placed, if it has a custom layout.
See IWorkbenchWindowConfigurer.createPageComposite.

In the case of the default layout, we could do this, but then we'd have
different code for the two cases.  I suggest leaving as-is for 3.1.
Comment 13 Nick Edgar CLA 2005-04-25 15:00:14 EDT
I've released the patch.
Comment 14 Nick Edgar CLA 2005-05-10 17:03:53 EDT
Verified in I20050509-2010.