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 16d50b624f3..3686d3be400 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 @@ -362,8 +362,7 @@ protected Point computeSize (int part, int state, GC gc, int wHint, int hHint) { if (parent.showClose || item.showClose) { if ((state & SWT.SELECTED) != 0 || parent.showUnselectedClose) { - if (((state & SWT.SELECTED) != 0 && parent.showSelectedImage) - || ((state & SWT.SELECTED) == 0 && parent.showUnselectedImage)) { + if (showLargeTextPadding(parent)) { if (width > 0) width += INTERNAL_SPACING; } else { if (width > 0) width -= INTERNAL_SPACING; @@ -389,18 +388,21 @@ protected Point computeSize (int part, int state, GC gc, int wHint, int hHint) { */ private int getTextPadding(CTabItem item, int state) { CTabFolder parent = item.getParent(); - Image image = item.getImage(); String text = item.getText(); if (text != null && parent.getMinimumCharacters() != 0) { - if (image == null || image.isDisposed() || ((state & SWT.SELECTED) != 0 && !parent.showSelectedImage) - || ((state & SWT.SELECTED) == 0 && !parent.showUnselectedImage)) + if (showLargeTextPadding(parent)) { return TABS_WITHOUT_ICONS_PADDING; + } } return 0; } + private boolean showLargeTextPadding(CTabFolder tabFolder) { + return !tabFolder.showSelectedImage && !tabFolder.showUnselectedImage; + } + /** * Given a desired client area for the part * (as described by the arguments), returns the bounding