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
CTabFolder should allow to listen on tab count changes #621
Conversation
Test Results 299 files ±0 299 suites ±0 5m 48s ⏱️ -3s For more details on these failures, see this check. Results for commit 55803c2. ± Comparison against base commit 435158d. ♻️ This comment has been updated with latest results. |
@SyntevoAlex : any objections regarding the new API? I feel not OK to add API without anyone else looked at it. |
Sorry, I'm the wrong person to ask here. |
@SyntevoAlex : it is about SWT API review only. |
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.
My comments are mostly nitpicks, so feel free to ignore.
...wt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
Outdated
Show resolved
Hide resolved
...les/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
Show resolved
Hide resolved
...les/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
Outdated
Show resolved
Hide resolved
...clipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder2Listener.java
Show resolved
Hide resolved
- added CTabFolder2Listener.itemsCount(CTabFolderEvent) API - added CTabFolder2Listener.itemsCountAdapter(Consumer<CTabFolderEvent>) API - updated CTabFolder to notify CTabFolder2Listener on creating/removing items - added unit test - CTabFolderEvent should set "widget" field - bumped minor version segment for new API added Fixes eclipse-platform#620
Thanks Alex for review. |
@@ -744,6 +744,14 @@ Image createButtonImage(Display display, int button) { | |||
image = new Image(display, new AutoScaleImageDataProvider(display, imageData, DPIUtil.getDeviceZoom())); | |||
return image; | |||
} | |||
|
|||
private void notifyItemCountChange() { | |||
CTabFolderEvent e = new CTabFolderEvent(this); |
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.
You could init the event lazy in the loop, so if there are no listeners you don't create a uselsess object that is instantly garbage collected.
Alternatively, if folderListeners.isEmpty() one might early exit this method.
Fixes #620