-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer simplified version to create LocalResourceManager #1213
Conversation
Frequently LocalResourceManager(JFaceResources.getResources(), parent) is used in client code. This add a helper method on JFaceResource to simplify such call. Fixed #1208
c349df5
to
1539272
Compare
Random failing test already known, see #926 Planning to merge soon cc @laeubi @HannesWell |
* registry. | ||
*/ | ||
static LocalResourceManager managerFor(Control owner) { | ||
return new LocalResourceManager(getResources(), owner); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use control.getData/setData to cache the instance created so multiple calls could be performed without creating multiple managers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you estimate how often that will hit the cache?
Since the local-manager is a child from the global one caching would not save SWT-resources but mainly only another map.
I think caching can be applied in a different commit if desired. This one had the intention to provide a simpler way to create a new LocalResourceManager which I think it does. |
* @param owner control whose disposal will trigger cleanup of everything in the | ||
* registry. | ||
*/ | ||
static LocalResourceManager managerFor(Control owner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this package private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this package private?
Thanks for the catch. Will be fixed with
#1218
Frequently LocalResourceManager(JFaceResources.getResources(), parent) is used in client code. This add a helper method on JFaceResource to simplify such call.