Skip to content

Add bullet-style dirty indicator for CTabFolder tabs#3141

Open
vogella wants to merge 3 commits intoeclipse-platform:masterfrom
vogella:feature/dirty-indicator-bullet
Open

Add bullet-style dirty indicator for CTabFolder tabs#3141
vogella wants to merge 3 commits intoeclipse-platform:masterfrom
vogella:feature/dirty-indicator-bullet

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Mar 19, 2026

Summary

  • Adds opt-in dirty indicator that shows a filled bullet dot (●) at the close button location for tabs with unsaved changes, replacing the traditional * prefix approach
  • The bullet transforms into the close button on hover, matching VS Code behavior
  • Disabled by default — consumers opt in via CTabFolder.setDirtyIndicatorCloseStyle(true) and mark items dirty via CTabItem.setShowDirty(true)

New API

CTabFolder:

  • setDirtyIndicatorCloseStyle(boolean) — enables/disables the bullet-on-close-button style
  • getDirtyIndicatorCloseStyle() — returns current setting

CTabItem:

  • setShowDirty(boolean) — marks an item as having unsaved changes
  • getShowDirty() — returns the dirty state

Design Decisions

  • Opt-in at folder level (false by default) to preserve backward compatibility, per PMC feedback from the Dec 2024 dev call
  • fillOval rendering instead of drawString("●") for pixel-perfect cross-platform consistency
  • Close rect reuse — the dirty bullet occupies the same closeRect as the close button, keeping space allocation consistent and naturally enabling hover-to-reveal-close interaction
  • Per-item dirty state — set by the consumer (e.g. Eclipse platform UI), separate from the folder-level style toggle

Context

This continues the work started in #1632 by @schneidermic0 (who is unable to continue). Key improvements over that draft:

  • Adds the preference toggle requested by the PMC
  • Fixes the copy-paste bug (return showClosereturn showDirty)
  • Uses fillOval instead of drawString for rendering
  • Includes tests and a demo snippet (Snippet391)

A companion change in eclipse.platform.ui is needed to wire this up to the workbench editor tabs (the UI side would call setDirtyIndicatorCloseStyle(true) on the CTabFolder and setShowDirty(true/false) on items, and stop prepending * when the new style is active).

Test plan

  • mvn compile passes for bundles/org.eclipse.swt
  • Unit tests in Test_org_eclipse_swt_custom_CTabItem for setShowDirty/getShowDirty and setDirtyIndicatorCloseStyle/getDirtyIndicatorCloseStyle
  • Manual verification with Snippet391 showing bullet indicator, hover-to-close transition
  • Verify backward compatibility: default behavior unchanged when dirtyIndicatorCloseStyle is false
  • Cross-platform testing (Linux/Windows/macOS)

🤖 Generated with Claude Code

@vogella vogella marked this pull request as draft March 19, 2026 15:33
@vogella vogella force-pushed the feature/dirty-indicator-bullet branch 2 times, most recently from 72bae05 to 418ac9a Compare March 19, 2026 15:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

Test Results

  170 files  ± 0    170 suites  ±0   25m 38s ⏱️ - 1m 24s
4 681 tests + 2  4 660 ✅ + 2   21 💤 ±0  0 ❌ ±0 
6 604 runs  +12  6 449 ✅ +12  155 💤 ±0  0 ❌ ±0 

Results for commit c2ddea0. ± Comparison against base commit e476728.

♻️ This comment has been updated with latest results.

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 24, 2026

@schneidermic0 is this fine for you?

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 24, 2026

image

@vogella vogella marked this pull request as ready for review March 24, 2026 18:06
@vogella vogella force-pushed the feature/dirty-indicator-bullet branch 2 times, most recently from 060d5cc to 171dceb Compare March 26, 2026 10:29
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 26, 2026

Dark look:
image

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 26, 2026

folder.setDirtyIndicatorCloseStyle feels a little bit to long, will update PR with a shorter API name

@schneidermic0
Copy link
Copy Markdown

@schneidermic0 is this fine for you?

I am happy you took over the changes and continue to work on this. Thank you.

I saw it some days back and gave a thumbs up on your initial comment of this PR. :)

@vogella vogella force-pushed the feature/dirty-indicator-bullet branch 2 times, most recently from f4443e8 to fd0d529 Compare April 1, 2026 07:09
vogella and others added 3 commits April 1, 2026 12:09
When enabled via CTabFolder.setDirtyIndicatorCloseStyle(true), dirty
tabs show a filled circle at the close button location instead of the
traditional '*' prefix. The bullet transforms into the close button on
hover, matching the behavior of VS Code and similar editors.

This is opt-in (disabled by default) to preserve backward compatibility.
The feature adds:
- CTabFolder.setDirtyIndicatorCloseStyle(boolean) / getDirtyIndicatorCloseStyle()
- CTabItem.setShowDirty(boolean) / getShowDirty()
- Rendering via fillOval for cross-platform consistency
- Snippet391 demonstrating the feature

Based on the approach from PR eclipse-platform#1632 by schneidermic0, with fixes for
the copy-paste bug, preference toggle support per PMC request, and
fillOval rendering instead of drawString for pixel-perfect results.

See: eclipse-platform#1632

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…st EOF

- Remove spurious y+1/-1 offset in drawDirtyIndicator; the oval is
  already centered from closeRect bounds, unlike the X drawing which
  needs the nudge due to its Math.max(1,...) coordinate logic
- Extend Snippet393 with a dark/light theme toggle button to demonstrate
  that the dirty bullet color adapts to the tab foreground color
- Add missing newline at end of Test_org_eclipse_swt_custom_CTabItem.java

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"CloseStyle" leaks the implementation detail that the bullet occupies
the close button area. The shorter name describes the feature, not
the mechanism.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@akurtakov akurtakov force-pushed the feature/dirty-indicator-bullet branch from fd0d529 to c2ddea0 Compare April 1, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants