diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java index 9ddd2f1f5f..6a64c4c840 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java @@ -881,31 +881,29 @@ void drawClose(GC gc, Rectangle closeRect, int closeImageState, boolean showDirt if (closeRect.width == 0 || closeRect.height == 0) return; int originalLineWidth = gc.getLineWidth(); - Color originalForeground = gc.getForeground(); int state = closeImageState & (SWT.HOT | SWT.SELECTED | SWT.BACKGROUND); if (state == SWT.NONE) { if (showDirtyIndicator) - drawDirtyIndicator(gc, closeRect, originalForeground, false); + drawDirtyIndicator(gc, closeRect, false); else drawCloseButton(gc, closeRect, false); } else if (state == SWT.HOT || state == SWT.SELECTED) { drawCloseButton(gc, closeRect, true); } else if (state == SWT.BACKGROUND) { if (showDirtyIndicator) - drawDirtyIndicator(gc, closeRect, originalForeground, false); + drawDirtyIndicator(gc, closeRect, false); else drawBackground(gc, closeRect, SWT.BACKGROUND); - } gc.setLineWidth(originalLineWidth); - gc.setForeground(originalForeground); } - private void drawDirtyIndicator(GC gc, Rectangle closeRect, Color originalForeground, boolean hot) { - Color originalBackground = gc.getBackground(); - gc.setBackground(originalForeground); - gc.fillOval(closeRect.x + 3, closeRect.y + 4, closeRect.width - 6, closeRect.height - 6); - gc.setBackground(originalBackground); + private void drawDirtyIndicator(GC gc, Rectangle closeRect, boolean hot) { + String DIRTY_INDICATOR = "●"; + Point stringExtent = gc.stringExtent(DIRTY_INDICATOR); + int x = closeRect.x + (closeRect.width - stringExtent.x) / 2; + int y = closeRect.y + (closeRect.height - stringExtent.y) / 2; + gc.drawString(DIRTY_INDICATOR, x, y, true); } private void drawCloseBackground(GC gc, Rectangle closeRect, Color backgroundColor) { @@ -1477,7 +1475,7 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) { gc.setBackground(orginalBackground); } } - if (shouldDrawCloseIcon(item)) drawClose(gc, item.closeRect, item.closeImageState, item.showDirty); + if (shouldDrawCloseIcon(item)) drawClose(gc, item.closeRect, item.closeImageState, item.showDirty); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java index 7b71962cc4..6f9612fea3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java @@ -279,9 +279,10 @@ public boolean getShowClose() { } /** - * TODO - - * @return + * Returns true to indicate that the dirty indicator should be shown. + * Otherwise return false. + * + * @return true if the dirty indicatorn should be shown * * @since 4.35 */ @@ -506,9 +507,9 @@ public void setShowClose(boolean close) { } /** - * TODO + * Sets to true to indicate that the dirty indicator should be shown. * - * @param dirty + * @param dirty the new value whether the dirty indicator shall be shown * * @since 4.35 */