[Win32] Encapsulate ToolItem's access to tool bar image lists - #3504
Open
HeikoKlare wants to merge 1 commit into
Open
[Win32] Encapsulate ToolItem's access to tool bar image lists#3504HeikoKlare wants to merge 1 commit into
HeikoKlare wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Encapsulates Win32 ToolBar image-list bookkeeping within ToolBar.
Changes:
- Adds centralized add, update, and clear operations.
- Makes image-list fields private.
- Routes
ToolItemimage handling throughToolBar.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
ToolItem.java |
Delegates image-list operations to its parent toolbar. |
ToolBar.java |
Owns image-list mutation and lazy initialization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
HeikoKlare
force-pushed
the
toolbar-imagelists-cleanup-step1
branch
from
August 13, 2026 18:06
5a96740 to
c5e5bec
Compare
HeikoKlare
marked this pull request as ready for review
August 13, 2026 18:14
This was referenced Aug 13, 2026
ToolItem manipulated ToolBar's three normal/hot/disabled ImageLists directly: reading them via ToolBar's getters, creating them inline when absent, and calling add()/put() on each of them itself. This spread the bookkeeping for a single item's images across both classes and made ToolItem responsible for details that are really ToolBar's to own, such as lazily creating the image lists sized to the first image added. With this change, ToolBar exposes addImage/putImage/clearImage instead, and ToolItem goes through these instead of touching ImageList directly. ToolBar's internal representation (three separate ImageList fields, and their existing setImageList/setHotImageList/setDisabledImageList synchronization methods) is otherwise unchanged. This is a behavior-preserving refactoring: the image lists are still created, filled and synchronized with the same values as before. The disabledImageList != null guard in ToolItem.updateImages is dropped rather than moved: in that branch the item already has an image index, so all three image lists necessarily exist, as they are only ever created together in addImage and cleared together in destroyItem and releaseWidget. Related to eclipse-platform#3466
HeikoKlare
force-pushed
the
toolbar-imagelists-cleanup-step1
branch
from
August 14, 2026 13:04
c5e5bec to
be9c38f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ToolItemmanipulatedToolBar's three normal/hot/disabledImageListsdirectly: reading them viaToolBar's getters, creating them inline when absent, and callingadd()/put()on each of them itself. This spread the bookkeeping for a single item's images across both classes and made ToolItem responsible for details that are really ToolBar's to own, such as lazily creating the image lists sized to the first image added.With this change,
ToolBarexposesaddImage/putImage/clearImageinstead, andToolItemgoes through these instead of touchingImageListdirectly.ToolBar's internal representation (three separateImageListfields, and their existingsetImageList/setHotImageList/setDisabledImageListsynchronization methods) is otherwise unchanged.This is a behavior-preserving refactoring: the image lists are still created, filled and synchronized with the same values as before.
The
disabledImageList != nullguard inToolItem.updateImagesis dropped rather than moved: in that branch the item already has an image index, so all three image lists necessarily exist, as they are only ever created together inaddImageand cleared together indestroyItemandreleaseWidget.Related to #3466
Note: This change is human-crafted and was only slightly revised and documented with the help of AI
This is the first of multiple incremental steps to enhance ImageList handling and consistency inside ToolBar. This is supposed to be merged for 2026-12 M1.