Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335856 - PaletteToolbar has incorrect layout when opening from Palette
Summary: PaletteToolbar has incorrect layout when opening from Palette
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7.1 (Indigo) M6   Edit
Assignee: Alexander Nyßen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 10:25 EST by CLA
Modified: 2011-02-23 07:46 EST (History)
1 user (show)

See Also:


Attachments
Screenshot of palette (14.00 KB, image/png)
2011-01-31 10:26 EST, CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description CLA 2011-01-31 10:25:15 EST
Build Identifier: Eclipse 3.7 I20110127-2034 and GEF 3.7 I201101272050

Open a GEF Editor based on GraphicalEditorWithFlyoutPalette with the Palette closed. Open the Palette, the PaletteToolBar space is too large for its child tools. 

Reproducible: Always

Steps to Reproduce:
1. Open the Shapes example.
2. Create a new Shapes file.
3. Open the file so that the GEF Editor opens. By default the palette is closed.
4. Open the palette.

The top palette toolbar has extra space. Resizing the palette corrects the problem.
Comment 1 CLA 2011-01-31 10:26:07 EST
Created attachment 187967 [details]
Screenshot of palette

Screenshot of the palette area.
Comment 2 CLA 2011-02-17 08:23:11 EST
Can I ping this one?
Comment 3 Alexander Nyßen CLA 2011-02-17 08:25:27 EST
(In reply to comment #2)
> Can I ping this one?

Well, you may try... 

Where could you reproduce it? Is it reproducable on both, Cocoa and Carbon, or is it limited to one of the platforms?
Comment 4 CLA 2011-02-17 08:32:59 EST
Hi, it happens on all platforms. It's not a Mac thing.
Comment 5 CLA 2011-02-17 08:40:57 EST
(In reply to comment #0)
> Build Identifier: Eclipse 3.7 I20110127-2034 and GEF 3.7 I201101272050
> 
> Open a GEF Editor based on GraphicalEditorWithFlyoutPalette with the Palette
> closed. Open the Palette, the PaletteToolBar space is too large for its child
> tools. 
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Open the Shapes example.
> 2. Create a new Shapes file.
> 3. Open the file so that the GEF Editor opens. By default the palette is
> closed.
> 4. Open the palette.
> 
> The top palette toolbar has extra space. Resizing the palette corrects the
> problem.

If the palette is open, close it, close the Shapes editor and re-open the Shapes file.
Comment 6 Alexander Nyßen CLA 2011-02-18 03:14:52 EST
I investigated the problem and it seems to be caused by the combination of two things:

1) within FlyoutPalatteComposite#setState, a min size calculation with a width hint of 0 is performed (minWidth = Math.max(pViewer.getControl().computeSize(0, 0).x, MIN_PALETTE_SIZE);), which leads to a preferred size calculation within PaletteContainerFlowLayout (used in the ToolbarEditPart's figure) that yields a result of (23, 80), because it assumes not to be able to fill one the row with all provided figures.

2) the preferred size computed during this min width calculation does not seem to be updated when the palette becomes visible (no revalidation of the PaletteViewer's figures is performed). One can easily  reproduce this, by changing the min size calculation to use a width hint of SWT.DEFAULT or by adding a dummy calculation (pViewer.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);) before, so that the first preferred size calculation that is performed yields a result of (80, 23) and everything works fine.

 I will thus have to investigate, why revalidation does not take place, and - eventually - how and where to force it.
Comment 7 CLA 2011-02-18 04:17:39 EST
Thanks, Alexander.

Of course this is only happening in Eclipse 3.7 + GEF 3.7 (latest builds). It works fine in 3.6. Now whether the problem is in Eclipse or GEF I don't know.
Comment 8 Alexander Nyßen CLA 2011-02-18 07:12:01 EST
Good to know its a regression we are facing here. Maybe it has something to do with the changes related to OrderedLayout that I made. I will take a look.
Comment 9 Alexander Nyßen CLA 2011-02-21 14:09:53 EST
As I had already assumed, the regression was introduced by bug #88884. It was
introduced by pulling up differently implemented isSensitiveHorizontally and
isSensitiveVertically methods into OrderedLayout, whereby the implementation of
FlowLayout was lost (that of ToolbarLayout was taken). Fixed it by restoring
both methods in FlowLayout and ToolbarLayout and by removing them in the
OrderedLayout super class.

Verified that the palette can no longer be reproduced with the fix in place.
Committed all changes to cvs HEAD (3.7M6). Closing as fixed.
Comment 10 CLA 2011-02-23 07:46:30 EST
Confirmed working OK on Windows 7 in GEF I201102212050.

Thanks, Alexander.