Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312391 - Add Support for ToolItems
Summary: Add Support for ToolItems
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 06:12 EDT by Thomas Schindl CLA
Modified: 2021-07-05 11:39 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2010-05-11 06:12:06 EDT
It would make sense to have toolitem support for PGroup similar to items that are embeded into the FormHeader.
Comment 1 Thomas Schindl CLA 2010-05-11 07:51:57 EDT
Chris, if you could spend a minute. I'd appreciate if you can take a look at my implementation which is found in toolitem-branch of PGroup.
Comment 2 Chris Gross CLA 2010-05-11 09:16:21 EDT
Hi Tom,

Here's some quick comments.  I'm not quite sure what some of the code is doing so I may be missing some things.

Comments:
-AbstractToolItemRenderer needs comments
-The method API for AbstractToolItemRenderer#paint seems strange.  I'd rather have a 'min' property on the renderer rather than pass in an array in the value argument and require an extra doPaint method.
-The method calculateSizes is confusing to me.  Generally doesn't feel right even though I'm not exactly sure what its returning.
-I'd rather see something where the group strategy wasn't responsible for drawing the toolitems.  Instead something where the group strategy simply marked off an area for the toolbar and PGroup would draw the items.  That would make it easy to create new group strategies.  This is a small point though.  It's not too important.
-PGroup#getToolItems returns a List (SWT generally sticks to arrays)
-I'd make getToolItems public.
-I'd make getToolItemRenderer public too.

regards,
-Chris
Comment 3 Thomas Schindl CLA 2010-05-11 09:51:46 EDT
(In reply to comment #2)
> Hi Tom,
> 
> Here's some quick comments.  I'm not quite sure what some of the code is doing
> so I may be missing some things.
> 
> Comments:
> -AbstractToolItemRenderer needs comments

ok.

> -The method API for AbstractToolItemRenderer#paint seems strange.  I'd rather
> have a 'min' property on the renderer rather than pass in an array in the value
> argument and require an extra doPaint method.

ok

> -The method calculateSizes is confusing to me.  Generally doesn't feel right
> even though I'm not exactly sure what its returning.

It calculates the 2 different sizes possible for a ToolItem (if not enough space is given items who hold text and image are hide the text)

> -I'd rather see something where the group strategy wasn't responsible for
> drawing the toolitems.  Instead something where the group strategy simply
> marked off an area for the toolbar and PGroup would draw the items.  That would
> make it easy to create new group strategies.  This is a small point though. 
> It's not too important.

Ok will try to implement it.

> -PGroup#getToolItems returns a List (SWT generally sticks to arrays)

ok

> -I'd make getToolItems public.

ok

> -I'd make getToolItemRenderer public too.

ok

> 
> regards,
> -Chris

Thanks for the fast response will implement those changes ASAP and ping on this bug.
Comment 4 Thomas Schindl CLA 2010-05-11 11:06:10 EDT
Ok. I implemented all your suggestions.
Comment 5 Chris Gross CLA 2010-05-11 11:22:36 EDT
(In reply to comment #4)
> Ok. I implemented all your suggestions.

Looks good.  More comments on methods of the AbstractToolItemRenderer would be nice.  An implementer is going to have a hard time knowing what to return from calculateSizes or what the min property is.
Comment 6 Thomas Schindl CLA 2010-05-11 11:27:02 EDT
ok docu is on my TODO list and then'll merge the stuff back to HEAD. Thanks for your help.
Comment 7 Thomas Schindl CLA 2010-05-12 05:14:55 EDT
added JavaDoc and released changes to HEAD