Community
Participate
Working Groups
Fix for Bug 196692 introduce another bug. The description is below. I've been testing my plugin (WireframeSketcher) with RC version of Eclipse 4.7 and I've encountered a problem that I've tracked down to the change in this bug. I've been using a feature of Form that allows to ignore the body in layout calculation. This feature is enabled as follows: scrolledForm.getForm().setData(FormUtil.IGNORE_BODY, Boolean.TRUE); Unfortunately the changes in this bug break this feature and now the size of the body is always taken in account, regardless of the IGNORE_BODY flag. I've narrowed down this change to Form$FormLayout$computeMinimumWidth. This method now looks like this: public int computeMinimumWidth(Composite composite, boolean flushCache) { initCaches(flushCache); return Math.max(headCache.computeMinimumWidth(), bodyCache.computeMinimumWidth()); } This has changed from before: public int computeMinimumWidth(Composite composite, boolean flushCache) { return computeSize(composite, 5, SWT.DEFAULT, flushCache).x; } Note that the minimum width calculation now always takes the body into account. The fix is as simple as the following: public int computeMinimumWidth(Composite composite, boolean flushCache) { initCaches(flushCache); boolean ignoreBody = form.getData(FormUtil.IGNORE_BODY) != null; return Math.max(headCache.computeMinimumWidth(), ignoreBody ? 0 : bodyCache.computeMinimumWidth()); }
Peter, can you please provide a patch & a test for it? https://wiki.eclipse.org/Platform_UI/How_to_Contribute
Created attachment 270313 [details] Take in account IGNORE_BODY flag in form layout Andrey, I apologize for the delayed reply. I couldn't way for this issue to be fixed and hacked around Eclipse code on my side to create a workaround for it. I've attached a patch that fixes this issue. I've tested if with WireframeSketcher where I've encountered this issue. As for the test, I am not sure how to isolate this functionality properly. I'm including the before and after screenshots of the results that I get in my plugin. There is a form with a header and a StyledText in the body. With a long text set on StyledText the layout takes in account StyledText's preferred size and then forces the entire form to be of that size. Setting the flag to ignore the body allows to ignore the size of the StyledText and just consider the size of the header for the layout. Let me know if this is enough to include the fix into the next version.
Created attachment 270314 [details] Before the fix
Created attachment 270315 [details] After the fix
Peter, can you please upload a Gerrit for the change?
New Gerrit change created: https://git.eclipse.org/r/105624
Lars, I've added a unit test and uploaded it to the initial Gerrit Change. However I'm not sure if I did it correctly. It's my first time using Gerrit. Can you take a look?
Gerrit change https://git.eclipse.org/r/105624 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=c7ba27cf32fab50198bec23539918740fd6e57b5
Thanks a lot Peter!
(In reply to Mickael Istria from comment #9) > Thanks a lot Peter! Also thanks from me Peter, sorry that I was not able to timely review your patch, I'm currently very busy with customer work. Thanks to Mickael for stepping up!
Thanks you, guys! It was a nice introduction into the Eclipse committer's workflow :)