Skip to content

Commit 72a32a9

Browse files
committed
Add javadoc (including @SInCE tag) to new API methods
1 parent 98ff3d3 commit 72a32a9

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java

+9-11
Original file line numberDiff line numberDiff line change
@@ -881,31 +881,29 @@ void drawClose(GC gc, Rectangle closeRect, int closeImageState, boolean showDirt
881881
if (closeRect.width == 0 || closeRect.height == 0) return;
882882

883883
int originalLineWidth = gc.getLineWidth();
884-
Color originalForeground = gc.getForeground();
885884
int state = closeImageState & (SWT.HOT | SWT.SELECTED | SWT.BACKGROUND);
886885
if (state == SWT.NONE) {
887886
if (showDirtyIndicator)
888-
drawDirtyIndicator(gc, closeRect, originalForeground, false);
887+
drawDirtyIndicator(gc, closeRect, false);
889888
else
890889
drawCloseButton(gc, closeRect, false);
891890
} else if (state == SWT.HOT || state == SWT.SELECTED) {
892891
drawCloseButton(gc, closeRect, true);
893892
} else if (state == SWT.BACKGROUND) {
894893
if (showDirtyIndicator)
895-
drawDirtyIndicator(gc, closeRect, originalForeground, false);
894+
drawDirtyIndicator(gc, closeRect, false);
896895
else
897896
drawBackground(gc, closeRect, SWT.BACKGROUND);
898-
899897
}
900898
gc.setLineWidth(originalLineWidth);
901-
gc.setForeground(originalForeground);
902899
}
903900

904-
private void drawDirtyIndicator(GC gc, Rectangle closeRect, Color originalForeground, boolean hot) {
905-
Color originalBackground = gc.getBackground();
906-
gc.setBackground(originalForeground);
907-
gc.fillOval(closeRect.x + 3, closeRect.y + 4, closeRect.width - 6, closeRect.height - 6);
908-
gc.setBackground(originalBackground);
901+
private void drawDirtyIndicator(GC gc, Rectangle closeRect, boolean hot) {
902+
String DIRTY_INDICATOR = "●";
903+
Point stringExtent = gc.stringExtent(DIRTY_INDICATOR);
904+
int x = closeRect.x + (closeRect.width - stringExtent.x) / 2;
905+
int y = closeRect.y + (closeRect.height - stringExtent.y) / 2;
906+
gc.drawString(DIRTY_INDICATOR, x, y, true);
909907
}
910908

911909
private void drawCloseBackground(GC gc, Rectangle closeRect, Color backgroundColor) {
@@ -1477,7 +1475,7 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) {
14771475
gc.setBackground(orginalBackground);
14781476
}
14791477
}
1480-
if (shouldDrawCloseIcon(item)) drawClose(gc, item.closeRect, item.closeImageState, item.showDirty);
1478+
if (shouldDrawCloseIcon(item)) drawClose(gc, item.closeRect, item.closeImageState, item.showDirty);
14811479
}
14821480
}
14831481

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,10 @@ public boolean getShowClose() {
279279
}
280280

281281
/**
282-
* TODO
283-
284-
* @return
282+
* Returns <code>true</code> to indicate that the dirty indicator should be shown.
283+
* Otherwise return <code>false</code>.
284+
*
285+
* @return <code>true</code> if the dirty indicatorn should be shown
285286
*
286287
* @since 4.35
287288
*/
@@ -506,9 +507,9 @@ public void setShowClose(boolean close) {
506507
}
507508

508509
/**
509-
* TODO
510+
* Sets to <code>true</code> to indicate that the dirty indicator should be shown.
510511
*
511-
* @param dirty
512+
* @param dirty the new value whether the dirty indicator shall be shown
512513
*
513514
* @since 4.35
514515
*/

0 commit comments

Comments
 (0)