From 6d80fa458ec324491663d7640e8d079aa0e44953 Mon Sep 17 00:00:00 2001 From: Fabian Stemmler Date: Mon, 30 Sep 2019 15:42:05 +0200 Subject: [PATCH] Instruction Table Editing Support now uses the correct font --- .../mi/{ColorProvider.java => FontAndColorHelper.java} | 5 +++-- .../src/net/mograsim/plugin/tables/mi/InstructionTable.java | 4 ++-- .../plugin/tables/mi/IntegerColumnLabelProvider.java | 4 ++-- .../mograsim/plugin/tables/mi/ParameterLabelProvider.java | 4 ++-- .../src/net/mograsim/plugin/tables/mi/RowHighlighter.java | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) rename plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/{ColorProvider.java => FontAndColorHelper.java} (95%) diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ColorProvider.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/FontAndColorHelper.java similarity index 95% rename from plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ColorProvider.java rename to plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/FontAndColorHelper.java index 0a1dc0c2..90d53dcf 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ColorProvider.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/FontAndColorHelper.java @@ -13,7 +13,7 @@ import org.eclipse.ui.themes.IThemeManager; import net.mograsim.machine.mi.MicroInstructionMemory; -public class ColorProvider +public class FontAndColorHelper { private final TableViewer viewer; private final IThemeManager themeManager; @@ -29,7 +29,7 @@ public class ColorProvider colorHighlightedBackground = "net.mograsim.plugin.highlighted_cell_bg_color"; private final IPropertyChangeListener updateListener; - public ColorProvider(TableViewer viewer, IThemeManager themeManager) + public FontAndColorHelper(TableViewer viewer, IThemeManager themeManager) { this.viewer = viewer; this.themeManager = themeManager; @@ -58,6 +58,7 @@ public class ColorProvider cRegistry = theme.getColorRegistry(); fRegistry = theme.getFontRegistry(); boldItalic = fRegistry.getDescriptor(font).setStyle(SWT.BOLD | SWT.ITALIC).createFont(Display.getDefault()); + viewer.getTable().setFont(fRegistry.get(font)); } public Color getBackground(Object element, int column) diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/InstructionTable.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/InstructionTable.java index a806bd28..6ffc93e2 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/InstructionTable.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/InstructionTable.java @@ -38,13 +38,13 @@ public class InstructionTable private MicroInstructionMemory memory; private InstructionTableContentProvider provider; private final RowHighlighter highlighter; - private final ColorProvider cProv; + private final FontAndColorHelper cProv; public InstructionTable(Composite parent, DisplaySettings displaySettings, IThemeManager themeManager) { viewer = new LazyTableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL); this.displaySettings = displaySettings; - this.cProv = new ColorProvider(viewer, themeManager); + this.cProv = new FontAndColorHelper(viewer, themeManager); this.highlighter = new RowHighlighter(viewer, cProv); Table table = viewer.getTable(); diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/IntegerColumnLabelProvider.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/IntegerColumnLabelProvider.java index 648eb85d..699f0226 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/IntegerColumnLabelProvider.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/IntegerColumnLabelProvider.java @@ -12,9 +12,9 @@ import net.mograsim.plugin.tables.NumberColumnLabelProvider; public class IntegerColumnLabelProvider extends NumberColumnLabelProvider { private final int index; - private final ColorProvider cProv; + private final FontAndColorHelper cProv; - public IntegerColumnLabelProvider(DisplaySettings displaySettings, ColorProvider cProv, int index) + public IntegerColumnLabelProvider(DisplaySettings displaySettings, FontAndColorHelper cProv, int index) { super(displaySettings); this.cProv = cProv; diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ParameterLabelProvider.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ParameterLabelProvider.java index 07ae3aeb..310e47da 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ParameterLabelProvider.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/ParameterLabelProvider.java @@ -7,9 +7,9 @@ import org.eclipse.swt.graphics.Font; public class ParameterLabelProvider extends ColumnLabelProvider { private final int index; - private final ColorProvider cProv; + private final FontAndColorHelper cProv; - public ParameterLabelProvider(ColorProvider cProv, int index) + public ParameterLabelProvider(FontAndColorHelper cProv, int index) { super(); this.index = index; diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/RowHighlighter.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/RowHighlighter.java index 03cb37cc..e7435a20 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/RowHighlighter.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/tables/mi/RowHighlighter.java @@ -11,10 +11,10 @@ public class RowHighlighter { private int highlighted = -1; private LazyTableViewer viewer; - private ColorProvider cProv; + private FontAndColorHelper cProv; private SingleSWTRequest requester = new SingleSWTRequest(); - public RowHighlighter(LazyTableViewer viewer, ColorProvider cProv) + public RowHighlighter(LazyTableViewer viewer, FontAndColorHelper cProv) { this.viewer = viewer; this.cProv = cProv; -- 2.17.1