Skip to content

Commit 7720790

Browse files
committed
Use dialog font in editor drop-down and drop bold-when-hidden marker
The editor chevron drop-down inherited the SWT system font, which on many platforms looks out of place compared to the rest of the IDE chrome. Switch the filter text and the table to JFaceResources getDialogFont() so the list matches the Quick Switch Editor (Ctrl+E) dialog and other workbench dialogs. Also remove the rule in BasicStackListLabelProvider that rendered an entry in bold when its CTabItem was not currently visible in the tab bar. That marker is not useful to users: - It is undiscoverable. There is no legend or tooltip explaining that bold means "tab scrolled off the visible tab bar". Bold conventionally signals importance, unread, or modified, none of which apply here. - It is redundant with why the drop-down is opened. Users open the chevron precisely because some tabs do not fit. Encoding which rows overflowed burns the strongest typographic emphasis on information the user did not ask for. - It crowds out more meaningful styling. PR #3938 introduces bold for matched filter substrings, which is a far more useful signal and conflicted visually with the previous all-bold rows.
1 parent 22d9cd1 commit 7720790

2 files changed

Lines changed: 3 additions & 31 deletions

File tree

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/AbstractTableInformationControl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public AbstractTableInformationControl(Shell parent, int shellStyle,
134134
fTableViewer = createTableViewer(fComposite, controlStyle);
135135

136136
final Table table = fTableViewer.getTable();
137+
table.setFont(JFaceResources.getDialogFont());
137138
table.addKeyListener(KeyListener.keyPressedAdapter(e -> {
138139
switch (e.keyCode) {
139140
case SWT.ESC:
@@ -314,10 +315,11 @@ public TableViewer getTableViewer() {
314315

315316
protected Text createFilterText(Composite parent) {
316317
fFilterText = new Text(parent, SWT.NONE);
318+
fFilterText.setFont(JFaceResources.getDialogFont());
317319

318320
GridData data = new GridData();
319321
GC gc = new GC(parent);
320-
gc.setFont(parent.getFont());
322+
gc.setFont(fFilterText.getFont());
321323
FontMetrics fontMetrics = gc.getFontMetrics();
322324
gc.dispose();
323325

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,41 +35,16 @@
3535
import org.eclipse.jface.viewers.ViewerComparator;
3636
import org.eclipse.swt.SWT;
3737
import org.eclipse.swt.custom.CTabItem;
38-
import org.eclipse.swt.graphics.Font;
39-
import org.eclipse.swt.graphics.FontData;
4038
import org.eclipse.swt.graphics.Image;
4139
import org.eclipse.swt.layout.GridData;
4240
import org.eclipse.swt.widgets.Composite;
43-
import org.eclipse.swt.widgets.Display;
4441
import org.eclipse.swt.widgets.Shell;
4542
import org.eclipse.swt.widgets.Table;
4643

4744
public class BasicPartList extends AbstractTableInformationControl {
4845

4946
private class BasicStackListLabelProvider extends ColumnLabelProvider {
5047

51-
private final Font boldFont;
52-
53-
public BasicStackListLabelProvider() {
54-
Font font = Display.getDefault().getSystemFont();
55-
FontData[] fontDatas = font.getFontData();
56-
for (FontData fontData : fontDatas) {
57-
fontData.setStyle(fontData.getStyle() | SWT.BOLD);
58-
}
59-
boldFont = new Font(Display.getDefault(), fontDatas);
60-
}
61-
62-
@Override
63-
public Font getFont(Object element) {
64-
if (element instanceof MPart part) {
65-
CTabItem item = renderer.findItemForPart(part);
66-
if (item != null && !item.isShowing()) {
67-
return boldFont;
68-
}
69-
}
70-
return super.getFont(element);
71-
}
72-
7348
@Override
7449
public String getText(Object element) {
7550
if (element instanceof MDirtyable
@@ -97,11 +72,6 @@ public String getToolTipText(Object element) {
9772
public boolean useNativeToolTip(Object object) {
9873
return true;
9974
}
100-
101-
@Override
102-
public void dispose() {
103-
boldFont.dispose();
104-
}
10575
}
10676

10777
private MElementContainer<?> input;

0 commit comments

Comments
 (0)