mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-5468 - Updated the cell renderer setFont() warning to only show once
This commit is contained in:
parent
7b9183b2db
commit
88dc8a65bc
2 changed files with 16 additions and 2 deletions
|
@ -392,6 +392,10 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||||
// we need to do some custom rendering
|
// we need to do some custom rendering
|
||||||
contentList.setCellRenderer(new GListCellRenderer<DisassembledAddressInfo>() {
|
contentList.setCellRenderer(new GListCellRenderer<DisassembledAddressInfo>() {
|
||||||
|
|
||||||
|
{
|
||||||
|
setBaseFontId(FieldFactory.BASE_LISTING_FONT_ID);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getItemText(DisassembledAddressInfo value) {
|
protected String getItemText(DisassembledAddressInfo value) {
|
||||||
return value.getAddressPreview(addressPreviewFormat);
|
return value.getAddressPreview(addressPreviewFormat);
|
||||||
|
@ -406,8 +410,6 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||||
super.getListCellRendererComponent(list, value, index, isSelected,
|
super.getListCellRendererComponent(list, value, index, isSelected,
|
||||||
cellHasFocus);
|
cellHasFocus);
|
||||||
|
|
||||||
setFont(Gui.getFont(FieldFactory.BASE_LISTING_FONT_ID));
|
|
||||||
|
|
||||||
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
||||||
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||||
import generic.theme.laf.FontChangeListener;
|
import generic.theme.laf.FontChangeListener;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
import ghidra.util.SystemUtilities;
|
||||||
import util.CollectionUtils;
|
import util.CollectionUtils;
|
||||||
import utilities.util.reflection.ReflectionUtilities;
|
import utilities.util.reflection.ReflectionUtilities;
|
||||||
|
|
||||||
|
@ -76,6 +77,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel implements FontC
|
||||||
protected Font fixedWidthFont;
|
protected Font fixedWidthFont;
|
||||||
protected Font boldFont;
|
protected Font boldFont;
|
||||||
protected Font italicFont;
|
protected Font italicFont;
|
||||||
|
private boolean showedFontWarning;
|
||||||
protected int dropRow = -1;
|
protected int dropRow = -1;
|
||||||
|
|
||||||
private boolean instanceAlternateRowColors = true;
|
private boolean instanceAlternateRowColors = true;
|
||||||
|
@ -216,6 +218,15 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel implements FontC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkForInvalidSetFont(Font f) {
|
protected void checkForInvalidSetFont(Font f) {
|
||||||
|
|
||||||
|
if (!SystemUtilities.isInDevelopmentMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showedFontWarning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Due to the nature of how setFont() is typically used (external client setup vs internal
|
// Due to the nature of how setFont() is typically used (external client setup vs internal
|
||||||
// rendering), we created setBaseFontId() to allow external clients to set the base font in
|
// rendering), we created setBaseFontId() to allow external clients to set the base font in
|
||||||
|
@ -231,6 +242,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel implements FontC
|
||||||
return; // the UI will set fonts while the theme is updating
|
return; // the UI will set fonts while the theme is updating
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showedFontWarning = true;
|
||||||
String caller = ReflectionUtilities
|
String caller = ReflectionUtilities
|
||||||
.getClassNameOlderThan(AbstractGCellRenderer.class.getName(), "generic.theme");
|
.getClassNameOlderThan(AbstractGCellRenderer.class.getName(), "generic.theme");
|
||||||
Msg.debug(this, "Calling setFont() on the renderer is discouraged. " +
|
Msg.debug(this, "Calling setFont() on the renderer is discouraged. " +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue