Skip to content

Add bullet-style dirty indicator for CTabFolder tabs#3141

Draft
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:feature/dirty-indicator-bullet
Draft

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

Conversation

@vogella
Copy link
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 from 511a1a2 to 72bae05 Compare March 19, 2026 15:35
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>
@vogella vogella force-pushed the feature/dirty-indicator-bullet branch from 72bae05 to 418ac9a Compare March 19, 2026 15:42
@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Test Results

  170 files  ± 0    170 suites  ±0   27m 22s ⏱️ -28s
4 678 tests + 2  4 657 ✅ + 2   21 💤 ±0  0 ❌ ±0 
6 586 runs  +12  6 431 ✅ +12  155 💤 ±0  0 ❌ ±0 

Results for commit 418ac9a. ± Comparison against base commit 12b37f8.

♻️ This comment has been updated with latest results.

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.

1 participant