Community
Participate
Working Groups
Look into using a minimum size of preferred size for the cool items, which will make cool items remain their maximum size. Other applications do this and only use chevrons when the coolbar width changes (e.g., resizing window smaller). Would need to hook resize callback and reset minimum size for cool items during resize to get this behavior.
Experimented with resetting minimumSize during resize callback for coolbar and the approach is problematic. In some instances, the platform wraps before the resize callback. Also, ran into some cheese problems. What I did was hook the resize callback and calculated the preferred width for each row (i.e., such that all coolitems would be fully displayed). Compared this width to client are width - if items do not fit on the row set minimum size for each item on the row to the size of its first item; if items do fit on the row, set minimum size for each item on the row to its maximum size. Would need to have SWT intervene to get Word/VisualBasic like behavior. Or we could just allow the platform to wrap. If we did this, chevrons will never appear and cool items would be clipped when resizing to a size that is smaller than the minimum width (i.e., this would happen after autowrapping by platform). Note that when you resize back to a larger size, the original layout will be preserved.
Using the maximumSize as the minimumSize would also decrease the complexity of the CoolBarManager code. Currently, the CoolBarManager does auto wrapping of items. Since the platform automatically wraps when the minimumSize of the item can no longer be displayed, CoolBarManager wrap code would no longer be necessary. Should also retry the resize approach by hooking the callback on the Composite vs. the CoolBar - according to NE this approach may solve some of the problems I was seeing.
Created attachment 1732 [details] code
Attached code for later reference. Code based on the following versions: CoolBarManager 1.32 CoolItemToolBarManager 1.4 ContributionManager 1.7
Attaching updated jar.
Created attachment 1785 [details] jar file
This bug depends on [Bug 21870] Coolbar - platform wrapping should not change item sizes.
Also depends on the fix for [Bug 19664].
Created attachment 1795 [details] java file based on 1.33
The above referenced bug should be [Bug 19964] Coolbar - can "lose" items when platform widget wraps.
To see the affects of 21870, run with the new code and do the following: 1. Open a Java Perspective. Resize the window smaller so that the Launch and External Tools cool items go to the next row. Notice that the size of the Java Elements cool item is increased for "free". 2. Switch perspectives. 3. Switch back to the Java perspective and resize the window larger. Notice that the extra space remains for the Jave Element cool item. This is because the layout was remembered and restored when switching to the new perspective. If the extra space was not added, this saving/restoring the layout would not cause a problem.
Released into 2.1 and 2.0.1 stream.