GP-2846 - Theming Documentation

This commit is contained in:
dragonmacher 2023-05-02 13:33:19 -04:00
parent 07fc63f99f
commit d4eae5ff3c
74 changed files with 903 additions and 598 deletions

View file

@ -20,7 +20,7 @@ import java.awt.Graphics;
import java.util.HashMap;
import java.util.Map;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.Lifespan;
@ -137,7 +137,7 @@ public class MemoryBox {
int w = vertical ? getTimePixelWidth() : getAddressPixelWidth();
int y = vertical ? getAddressPixelStart() : getTimePixelStart();
int h = vertical ? getAddressPixelWidth() : getTimePixelWidth();
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);
@ -148,7 +148,7 @@ public class MemoryBox {
int w = vertical ? sz : getAddressPixelWidth();
int y = vertical ? getAddressPixelStart() : 0;
int h = vertical ? getAddressPixelWidth() : sz;
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);
@ -159,7 +159,7 @@ public class MemoryBox {
int w = vertical ? 1 : sz;
int y = vertical ? 0 : getTimePixelStart();
int h = vertical ? sz : 1;
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);

View file

@ -23,7 +23,7 @@ import java.util.List;
import javax.swing.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressRange;
@ -64,7 +64,7 @@ public class MemviewPanel extends JPanel implements MouseListener, MouseMotionLi
this.provider = provider;
setPreferredSize(new Dimension(barWidth, barHeight));
setSize(getPreferredSize());
setBorder(BorderFactory.createLineBorder(Java.BORDER, 1));
setBorder(BorderFactory.createLineBorder(Colors.BORDER, 1));
setFocusable(true);
addMouseListener(this);

View file

@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDHtmlLabel;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.merge.util.ConflictUtility;
import ghidra.util.HTMLUtilities;
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
@ -46,7 +46,7 @@ public class VariousChoicesPanel extends ConflictPanel {
private final static long serialVersionUID = 1;
private static final Border UNDERLINE_BORDER =
BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER);
BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.BORDER);
private JPanel rowPanel;
private GDHtmlLabel headerLabel;

View file

@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDHtmlLabel;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.merge.util.ConflictUtility;
import ghidra.util.HTMLUtilities;
import ghidra.util.datastruct.LongArrayList;
@ -190,7 +190,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
headerComps[i] = new MyLabel(items[i]);
headerComps[i].setName(getComponentName(0, i));
setRowComponent(headerComps[i], 0, i, defaultInsets);
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER));
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.BORDER));
}
}
rowPanel.validate();

View file

@ -21,7 +21,7 @@ import java.beans.PropertyEditorSupport;
import javax.swing.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.framework.options.CustomOptionsEditor;
import ghidra.util.layout.PairLayout;
@ -116,7 +116,7 @@ public class StoredAnalyzerTimesPropertyEditor extends PropertyEditorSupport
new JTextField(StoredAnalyzerTimes.formatTimeMS(times.getTotalTime()));
valueField.setEditable(false);
valueField.setHorizontalAlignment(SwingConstants.RIGHT);
valueField.setBorder(BorderFactory.createLineBorder(Java.BORDER, 2));
valueField.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 2));
panel.add(valueField);
return panel;

View file

@ -26,8 +26,6 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.TableModel;
import org.apache.commons.lang3.ObjectUtils;
import docking.*;
import docking.action.*;
import docking.widgets.OptionDialog;
@ -41,11 +39,8 @@ import docking.widgets.pathmanager.PathnameTablePanel;
import docking.widgets.table.GTableCellRenderer;
import docking.widgets.table.GTableCellRenderingData;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.plugin.core.processors.SetLanguageDialog;
import ghidra.app.util.Option;
import ghidra.app.util.cparser.C.CParserUtils;
import ghidra.app.util.exporter.Exporter;
import ghidra.framework.Application;
import ghidra.framework.options.SaveState;
import ghidra.framework.preferences.Preferences;
@ -139,13 +134,15 @@ class ParseDialog extends ReusableDialogComponentProvider {
if (currentProfileName != null) {
for (int i = 0; i < itemList.size(); i++) {
ComboBoxItem item = itemList.get(i);
if (userDefined == item.isUserDefined && currentProfileName.equals(item.file.getName())) {
if (userDefined == item.isUserDefined &&
currentProfileName.equals(item.file.getName())) {
comboBox.setSelectedIndex(i);
break;
}
}
}
} else {
}
else {
toFront();
}
}
@ -245,8 +242,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
label.setText(pathName.toString());
if (!fileExists) {
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
: Tables.FG_ERROR_UNSELECTED);
label.setForeground(getErrorForegroundColor(data.isSelected()));
}
return label;
@ -304,11 +300,11 @@ class ParseDialog extends ReusableDialogComponentProvider {
parseToFileButton.setToolTipText("Parse files and output to archive file");
addButton(parseToFileButton);
mainPanel.add(comboPanel, BorderLayout.NORTH);
includePathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
JSplitPane optionsPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, includePathPanel, optionsPanel);
JSplitPane optionsPane =
new JSplitPane(JSplitPane.VERTICAL_SPLIT, includePathPanel, optionsPanel);
optionsPane.setResizeWeight(0.50);
pathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
@ -349,31 +345,31 @@ class ParseDialog extends ReusableDialogComponentProvider {
languageButton = new BrowseButton();
languageButton.addActionListener(e -> {
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString, compilerIDString,
"Select Program Architecture for File DataType Archive");
LanguageID languageId = dialog.getLanguageDescriptionID();
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
if ((languageId == null) || (compilerSpecId == null)) {
return;
}
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString,
compilerIDString, "Select Program Architecture for File DataType Archive");
LanguageID languageId = dialog.getLanguageDescriptionID();
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
if ((languageId == null) || (compilerSpecId == null)) {
return;
}
String newLanguageIDString = languageId.getIdAsString();
String newCompilerIDString = compilerSpecId.getIdAsString();
String newLanguageIDString = languageId.getIdAsString();
String newCompilerIDString = compilerSpecId.getIdAsString();
if (!Objects.equals(newLanguageIDString, languageIDString) ||
!Objects.equals(newCompilerIDString, compilerIDString)) {
itemChanged();
}
if (!Objects.equals(newLanguageIDString, languageIDString) ||
!Objects.equals(newCompilerIDString, compilerIDString)) {
itemChanged();
}
languageIDString = newLanguageIDString;
languageIDString = newLanguageIDString;
compilerIDString = newCompilerIDString;
updateArchitectureDescription();
updateArchitectureDescription();
});
updateArchitectureDescription();
updateArchitectureDescription();
languageButton.setName("Set Processor Architecture");
languageButton.setName("Set Processor Architecture");
Font font = languageButton.getFont();
languageButton.setFont(font.deriveFont(Font.BOLD));
@ -387,11 +383,11 @@ class ParseDialog extends ReusableDialogComponentProvider {
String newProgramArchitectureSummary = "64/32 (primarily for backward compatibility)";
if (languageIDString != null) {
StringBuilder buf = new StringBuilder();
buf.append(languageIDString);
buf.append(" / ");
buf.append(compilerIDString != null ? compilerIDString : "none");
newProgramArchitectureSummary = buf.toString();
StringBuilder buf = new StringBuilder();
buf.append(languageIDString);
buf.append(" / ");
buf.append(compilerIDString != null ? compilerIDString : "none");
newProgramArchitectureSummary = buf.toString();
}
languageTextField.setText(newProgramArchitectureSummary);
@ -691,7 +687,6 @@ class ParseDialog extends ReusableDialogComponentProvider {
}
}
String[] paths = new String[pathList.size()];
paths = pathList.toArray(paths);
pathPanel.setPaths(paths);
@ -706,7 +701,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
compilerIDString = compileString;
updateArchitectureDescription();
updateArchitectureDescription();
br.close();
}
@ -749,7 +744,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
writer.newLine();
// Write paths
String [] includePaths = includePathPanel.getPaths();
String[] includePaths = includePathPanel.getPaths();
for (String path : includePaths) {
writer.write(path.trim());
writer.newLine();
@ -809,16 +804,17 @@ class ParseDialog extends ReusableDialogComponentProvider {
paths = expandPaths(paths);
pathPanel.setPaths(paths);
if (languageIDString == null || compilerIDString == null ) {
if (languageIDString == null || compilerIDString == null) {
Msg.showWarn(getClass(), rootPanel, "Program Architecture not Specified",
"A Program Architecture must be specified in order to parse to a file.");
return;
"A Program Architecture must be specified in order to parse to a file.");
return;
}
if (parseToFile) {
File file = getSaveFile();
if (file != null) {
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString, file.getAbsolutePath());
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString,
file.getAbsolutePath());
}
}
else {
@ -996,11 +992,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((file == null) ? 0 : file.hashCode());
result = prime * result + (isUserDefined ? 1231 : 1237);
return result;
return Objects.hash(file, isUserDefined);
}
}
@ -1022,50 +1014,49 @@ class ParseDialog extends ReusableDialogComponentProvider {
// Methods for Testing
//==================================================================================================
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
return comboBox;
}
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
return comboBox;
}
PathnameTablePanel getSourceFiles() {
return this.pathPanel;
}
PathnameTablePanel getSourceFiles() {
return this.pathPanel;
}
PathnameTablePanel getIncludePaths() {
return this.includePathPanel;
}
PathnameTablePanel getIncludePaths() {
return this.includePathPanel;
}
JTextArea getParseOptionsTextField() {
return this.parseOptionsField;
}
JTextArea getParseOptionsTextField() {
return this.parseOptionsField;
}
JButton getLanguageButton() {
return this.languageButton;
}
JButton getLanguageButton() {
return this.languageButton;
}
JTextField getLanguageText() {
return this.languageTextField;
}
JTextField getLanguageText() {
return this.languageTextField;
}
JButton getParseButton() {
return this.parseButton;
}
JButton getParseButton() {
return this.parseButton;
}
JButton getParseToFileButton() {
return this.parseToFileButton;
}
JButton getParseToFileButton() {
return this.parseToFileButton;
}
ArrayList<ComboBoxItem> getProfiles() {
return this.itemList;
}
ArrayList<ComboBoxItem> getProfiles() {
return this.itemList;
}
ComboBoxItem getCurrentItem() {
ComboBoxItem item = (ComboBoxItem) comboBox.getSelectedItem();
ComboBoxItem getCurrentItem() {
ComboBoxItem item = (ComboBoxItem) comboBox.getSelectedItem();
return item;
}
return item;
}
ResourceFile getUserProfileParent() {
return parentUserFile;
}
ResourceFile getUserProfileParent() {
return parentUserFile;
}
}

View file

@ -25,7 +25,6 @@ import javax.swing.JTable;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.util.ToolTipUtils;
import ghidra.docking.settings.FormatSettingsDefinition;
import ghidra.docking.settings.Settings;
@ -156,8 +155,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
JTable table = data.getTable();
if (!eq.isValidUUID()) { // Error equate
label.setForeground(
(isSelected) ? table.getSelectionForeground() : Tables.FG_ERROR_UNSELECTED);
label.setForeground(getErrorForegroundColor(isSelected));
}
else if (!eq.isEnumBased()) { // User label
label.setForeground(

View file

@ -39,7 +39,7 @@ import docking.widgets.label.GLabel;
import docking.widgets.table.*;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.*;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.WindowUtilities;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.ToolTipUtils;
@ -213,7 +213,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
thunkedText.setEditable(false);
DockingUtils.setTransparent(thunkedText);
CompoundBorder border =
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Colors.BORDER),
BorderFactory.createEmptyBorder(0, 5, 0, 5));
thunkedText.setBorder(border);
thunkedText.setForeground(FunctionColors.THUNK);
@ -652,13 +652,12 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
DataType dataType = (DataType) value;
Color color = isSelected ? table.getSelectionForeground() : table.getForeground();
if (!tableModel.isCellEditable(row, column)) {
color =
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED;
color = getUneditableForegroundColor(isSelected);
}
if (dataType != null) {
setText(dataType.getName());
if (dataType.isNotYetDefined()) {
color = isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED;
color = getErrorForegroundColor(isSelected);
}
String toolTipText = ToolTipUtils.getToolTipText(dataType);
String headerText = "<HTML><b>" +
@ -782,8 +781,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
boolean isInvalidStorage =
!storage.isValid() || rowData.getFormalDataType().getLength() != storage.size();
if (isInvalidStorage) {
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
setForeground(getErrorForegroundColor(isSelected));
setToolTipText("Invalid Parameter Storage");
}
else {
@ -818,8 +816,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
if (!tableModel.isCellEditable(row, column)) {
setForeground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
setForeground(getUneditableForegroundColor(isSelected));
}
else {
if (isSelected) {

View file

@ -15,6 +15,7 @@
*/
package ghidra.app.plugin.core.function.editor;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.util.EventObject;
@ -53,8 +54,7 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
boolean isSelected, int row, int column) {
String stringValue = value == null ? "" : value.toString();
JTextField field = new JTextField(stringValue);
field.setBackground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
field.setBackground(getUneditableForegroundColor(isSelected));
field.setEditable(false);
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
FunctionVariableData rowData = tableModel.getRowObject(row);
@ -78,4 +78,9 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
});
return field;
}
protected Color getUneditableForegroundColor(boolean isSelected) {
return isSelected ? Tables.UNEDITABLE_SELECTED : Tables.UNEDITABLE_UNSELECTED;
}
}

View file

@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.HintTextField;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.cmd.function.CreateFunctionTagCmd;
import ghidra.app.context.ProgramActionContext;
import ghidra.framework.cmd.Command;
@ -239,9 +239,9 @@ public class FunctionTagProvider extends ComponentProviderAdapter
targetPanel = new TargetTagsPanel(this, tool, "Assigned To Function");
allFunctionsPanel = new AllFunctionsPanel(program, this, "Functions with Selected Tag");
buttonPanel = new FunctionTagButtonPanel(sourcePanel, targetPanel);
sourcePanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
targetPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
sourcePanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
targetPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
// If we don't set this, then the splitter won't be able to shrink the
// target panels below the size required by its header, which can be large

View file

@ -24,8 +24,8 @@ import javax.swing.JToolTip;
import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Messages;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import ghidra.app.plugin.core.gotoquery.GoToHelper;
import ghidra.app.services.CodeFormatService;
import ghidra.app.util.*;
@ -46,7 +46,7 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
private static final int WINDOW_OFFSET = 50;
private static final Color BACKGROUND_COLOR = Colors.BG_TOOLTIP;
private static final Color BACKGROUND_COLOR = Tooltips.BACKGROUND;
private static final Color FG_COLOR_NOT_IN_MEMORY = Messages.HINT;
private CodeFormatService codeFormatService;

View file

@ -21,7 +21,7 @@ import java.awt.GridBagLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
/**
@ -57,7 +57,7 @@ public class ControlPanel extends JPanel {
gbc.weightx = 1.0;
this.add(directionWidget, gbc);
this.setBorder(BorderFactory.createLineBorder(Java.BORDER));
this.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
}
public SelectionScopeWidget getRangeWidget() {

View file

@ -25,20 +25,14 @@ import javax.swing.border.EmptyBorder;
import javax.swing.event.ListDataListener;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import generic.util.WindowUtilities;
import ghidra.app.plugin.core.console.CodeCompletion;
/**
* This class encapsulates a code completion popup Window for the ConsolePlugin.
*
*
*
*/
public class CodeCompletionWindow extends JDialog {
private static final long serialVersionUID = 1L;
/* from ReferenceHoverPlugin */
private static final Color BACKGROUND_COLOR = Colors.BG_TOOLTIP;
protected final InterpreterPanel console;
protected final JTextPane outputTextField;
@ -50,17 +44,6 @@ public class CodeCompletionWindow extends JDialog {
/* current list of completions */
protected JList jlist;
/**
* Constructs a new CodeCompletionWindow.
*
* We pass in the PluginTool so we can get a reference to the Frame we are
* popping up over, as well as the text field we are coming from (so we
* can fine-tune where we pop up).
*
* @param tool the PluginTool the has the Frame we are popping up over
* @param console the ConsolePlugin we are providing services for
* @param outputTextField the JTextField from whence we came
*/
public CodeCompletionWindow(Window parent, InterpreterPanel cp, JTextPane textField) {
super(parent);
@ -73,7 +56,7 @@ public class CodeCompletionWindow extends JDialog {
/* don't steal focus from text input! */
setFocusableWindowState(false);
jlist.setBackground(BACKGROUND_COLOR);
jlist.setBackground(Tooltips.BACKGROUND);
jlist.setCellRenderer(new CodeCompletionListCellRenderer());
/* add the ability to double-click a code completion */
MouseListener mouseListener = new MouseAdapter() {
@ -405,9 +388,6 @@ class CodeCompletionListSelectionModel extends DefaultListSelectionModel {
/**
* Renders CodeCompletions for the CodeCompletionWindow.
*
*
*
*/
class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
@ -425,14 +405,14 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
@Override
public Component getListCellRendererComponent(JList<? extends CodeCompletion> list,
CodeCompletion codeCompletion, int index, boolean isSelected, boolean cellHasFocus) {
if (null == codeCompletion.getComponent()) {
if (codeCompletion.getComponent() == null) {
return super.getListCellRendererComponent(list, codeCompletion, index, isSelected,
cellHasFocus);
}
/* ooh, we have a fancy component! */
JComponent component = codeCompletion.getComponent();
/* if it's selected, make sure it shows up that way */
// if it's selected, make sure it shows up that way
component.setOpaque(true);
if (isSelected) {
component.setBackground(list.getSelectionBackground());
@ -440,7 +420,7 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
else {
component.setBackground(list.getBackground());
}
/* other nice formatting stuff */
component.setEnabled(list.isEnabled());
component.setFont(list.getFont());
component.setComponentOrientation(list.getComponentOrientation());

View file

@ -21,7 +21,6 @@ import java.util.*;
import org.apache.commons.lang3.StringUtils;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.program.model.address.Address;
@ -127,8 +126,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
//==================================================================================================
private class ContextTableColumn
extends
AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
extends AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
private ContextCellRenderer renderer = new ContextCellRenderer();
@ -189,8 +187,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
if (!StringUtils.isBlank(refType)) {
String trailingText = "";
if (rowObject.isOffcutReference()) {
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
setForeground(getErrorForegroundColor(isSelected));
trailingText = OFFCUT_STRING;
}
return refType + trailingText;

View file

@ -20,7 +20,7 @@ import java.util.ArrayList;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.Gui;
public class KnotLabelPanel extends JPanel {
@ -55,7 +55,7 @@ public class KnotLabelPanel extends JPanel {
int fontOffset = ascent / 3; // this looks about right
ArrayList<KnotRecord> knots = palette.getKnots();
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(5, topBottomMargin - 6, 10, topBottomMargin - ascent + 2);
g.drawString("min entropy (0.0)", 20, topBottomMargin - ascent - descent);
@ -70,7 +70,7 @@ public class KnotLabelPanel extends JPanel {
g.drawLine(5, y, 10, y);
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(5, height + topBottomMargin + 4, 10, height + topBottomMargin + 8);
g.drawString("max entropy (8.0)", 20, topBottomMargin + height + ascent + descent);

View file

@ -19,7 +19,7 @@ import java.awt.*;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
public class PalettePanel extends JPanel {
@ -47,7 +47,7 @@ public class PalettePanel extends JPanel {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
if (palette == null) {
g.drawRect(0, 0, width - 1, height - 1);
return;
@ -64,7 +64,7 @@ public class PalettePanel extends JPanel {
g.setColor(c);
g.fillRect(0, topBottomMargin + i, width, 1);
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawRect(0, topBottomMargin, width - 1, height);
}

View file

@ -31,7 +31,7 @@ import javax.swing.text.Document;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.listing.Program;
/**
@ -154,7 +154,7 @@ class ProgramListPanel extends JPanel {
// add some padding around the panel
Border innerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
Border outerBorder = BorderFactory.createLineBorder(Java.BORDER);
Border outerBorder = BorderFactory.createLineBorder(Colors.BORDER);
Border compoundBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder);
setBorder(compoundBorder);

View file

@ -36,7 +36,6 @@ import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.app.util.AddressInput;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.*;
@ -534,7 +533,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
model = new HistoryTableModel(fromCodeUnit.getProgram());
displayTable = new JTable(model);
displayTable.setTableHeader(null);
displayTable.setBorder(new LineBorder(Java.BORDER));
displayTable.setBorder(new LineBorder(Colors.BORDER));
displayTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
displayTable.addMouseListener(new MouseAdapter() {

View file

@ -37,7 +37,6 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.util.SelectionTransferData;
import ghidra.app.util.SelectionTransferable;
@ -136,8 +135,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
Memory memory = currentCodeUnit.getProgram().getMemory();
try {
Object data = e.getTransferable()
.getTransferData(
SelectionTransferable.localProgramSelectionFlavor);
.getTransferData(SelectionTransferable.localProgramSelectionFlavor);
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
if (memory.contains(view)) {
return true;
@ -289,8 +287,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
enableGotoReferenceLocation(gotoReferenceLocationToggleAction.isSelected());
}
};
gotoReferenceLocationToggleAction.setToolBarData(
new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
gotoReferenceLocationToggleAction
.setToolBarData(new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
gotoReferenceLocationToggleAction.setEnabled(true);
tool.addLocalAction(this, gotoReferenceLocationToggleAction);
@ -890,8 +888,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
}
Reference ref = tableModel.getReference(row);
RefType[] refTypes = EditReferencesModel.getAllowedRefTypes(
EditReferencesProvider.this.currentProgram, ref);
RefType[] refTypes = EditReferencesModel
.getAllowedRefTypes(EditReferencesProvider.this.currentProgram, ref);
comboBox.removeAllItems();
int selectedIndex = -1;
@ -913,10 +911,6 @@ public class EditReferencesProvider extends ComponentProviderAdapter
private class CellEditComboBox extends JComboBox<RefType> {
public CellEditComboBox() {
super();
}
@Override
public void setSelectedIndex(int anIndex) {
if (refsTable.getRowCount() == 0) {
@ -1035,40 +1029,27 @@ public class EditReferencesProvider extends ComponentProviderAdapter
super.getTableCellRendererComponent(data);
JTable table = data.getTable();
int row = data.getRowViewIndex();
boolean isSelected = data.isSelected();
Reference ref = tableModel.getReference(row);
Address addr = ref.getToAddress();
Memory memory = tableModel.getProgram().getMemory();
boolean bad = addr.isMemoryAddress() ? !memory.contains(addr) : false;
setOpaque(false); // disable table striping
setFont(table.getFont());
// disable table striping when not selected to reduce clutter
setOpaque(isSelected);
if (isSelected) {
if (bad) {
setForeground(Tables.FG_ERROR_SELECTED);
setFont(boldFont);
}
else {
setFont(defaultFont);
}
setOpaque(true);
if (bad) {
setForeground(getErrorForegroundColor(isSelected));
setFont(boldFont);
}
else {
// set color to red if address does not exist in memory
setFont(defaultFont);
}
if (bad) {
setForeground(Tables.FG_ERROR_UNSELECTED);
setFont(boldFont);
}
else {
setFont(defaultFont);
}
// use a special color when not selected to show which row matches the operand
if (!isSelected) {
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
setBackground(BG_COLOR_ACTIVE_OPERAND);
setOpaque(true);

View file

@ -372,7 +372,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
KeyBindingsInfo info = (KeyBindingsInfo) value;
if (info.errorMessage != null) {
component.setForeground(Tables.FG_ERROR_UNSELECTED);
component.setForeground(Tables.ERROR_UNSELECTED);
component.setToolTipText(info.errorMessage);
}
else {
@ -394,7 +394,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
if (isSelected) {
JTable table = data.getTable();
Color selectedForegroundColor =
(info.errorMessage != null) ? Tables.FG_ERROR_SELECTED
(info.errorMessage != null) ? Tables.ERROR_SELECTED
: table.getSelectionForeground();
component.setForeground(selectedForegroundColor);
}

View file

@ -28,7 +28,6 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GLabel;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.Gui;
class TipOfTheDayDialog extends ReusableDialogComponentProvider {
@ -88,7 +87,7 @@ class TipOfTheDayDialog extends ReusableDialogComponentProvider {
JPanel panel = new JPanel(new BorderLayout());
Border panelBorder =
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10),
BorderFactory.createLineBorder(Java.BORDER));
BorderFactory.createLineBorder(Colors.BORDER));
panel.setBorder(panelBorder);
JLabel label = new GLabel("Did you know...", tipIcon, SwingConstants.LEFT);

View file

@ -48,7 +48,6 @@ import docking.widgets.table.threaded.ThreadedTableModel;
import docking.widgets.tree.GTree;
import generic.test.AbstractGenericTest;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.image.ImageUtils;
import ghidra.app.events.ProgramSelectionPluginEvent;
@ -423,7 +422,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
captureComponent(window);
}
}
drawBorder(Java.BORDER);
drawBorder(Colors.BORDER);
}
public JPopupMenu getPopupMenu() {
@ -1375,7 +1374,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
}
public void drawRectangleWithDropShadowAround(JComponent component, Color color, int padding) {
Rectangle r = drawRectangleAround(component, Java.BORDER, padding);
Rectangle r = drawRectangleAround(component, Colors.BORDER, padding);
// move it back a bit to create the drop-shadow effect
r.x -= padding;
@ -1628,7 +1627,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Java.BORDER);
g2.setColor(Colors.BORDER);
g2.setStroke(new BasicStroke(3f));
g2.draw(topPath);
g2.draw(bottomPath);

View file

@ -33,7 +33,7 @@ import docking.action.DockingAction;
import docking.action.ToolBarData;
import docking.widgets.combobox.GComboBox;
import docking.widgets.label.*;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.util.Msg;
import ghidra.util.bean.GGlassPane;
@ -179,12 +179,12 @@ public class ImageDialogProvider extends DialogComponentProvider {
}
newLabelPanel.add(createImageLabelComponent("New Image"), BorderLayout.NORTH);
newLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
newLabelPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 20));
newLabelPanel.add(newImageLabel, BorderLayout.CENTER);
JPanel oldLabelPanel = new JPanel(new BorderLayout());
oldLabelPanel.add(createImageLabelComponent("Old Image"), BorderLayout.NORTH);
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 20));
oldLabelPanel.add(oldImageLabel, BorderLayout.CENTER);
imagePanel.add(oldLabelPanel, BorderLayout.WEST);

View file

@ -20,7 +20,6 @@ import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
import ghidra.app.plugin.core.functiongraph.graph.FGVertexType;
import ghidra.app.plugin.core.functiongraph.mvc.FGController;
@ -40,14 +39,18 @@ import ghidra.program.util.ProgramSelection;
*/
public interface FGVertex extends VisualVertex {
static final Color TOOLTIP_BACKGROUND_COLOR = Colors.BG_TOOLTIP;
public FGVertex cloneVertex(FGController newController);
/** A chance for this vertex to save off changed settings */
/**
* A chance for this vertex to save off changed settings
* @param settings the settings
*/
public void writeSettings(FunctionGraphVertexAttributes settings);
/** A chance for this vertex to read in stored settings */
/**
* A chance for this vertex to read in stored settings
* @param settings the settings
*/
public void readSettings(FunctionGraphVertexAttributes settings);
public void restoreColor(Color color);

View file

@ -40,6 +40,7 @@ import docking.widgets.label.GDLabel;
import generic.theme.GColor;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import ghidra.app.plugin.core.codebrowser.hover.ListingHoverService;
import ghidra.app.plugin.core.functiongraph.FunctionGraphPlugin;
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
@ -203,7 +204,7 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
boolean useFullSizeTooltip = options.useFullSizeTooltip();
previewListingPanel = new FGVertexListingPanel(controller,
getFormatManager(useFullSizeTooltip), program, addressSet);
previewListingPanel.setTextBackgroundColor(FGVertex.TOOLTIP_BACKGROUND_COLOR);
previewListingPanel.setTextBackgroundColor(Tooltips.BACKGROUND);
previewListingPanel.getFieldPanel().setCursorOn(false);
// keep the tooltip window from getting too big; use an arbitrary, reasonable max
@ -216,14 +217,14 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
tooltipTitleLabel = new GDLabel();
tooltipTitleLabel.setHorizontalAlignment(SwingConstants.LEADING);
tooltipTitleLabel.setBackground(FGVertex.TOOLTIP_BACKGROUND_COLOR);
tooltipTitleLabel.setBackground(Tooltips.BACKGROUND);
tooltipTitleLabel.setOpaque(true);
Font labelFont = tooltipTitleLabel.getFont();
tooltipTitleLabel.setFont(labelFont.deriveFont(Font.BOLD));
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(tooltipTitleLabel);
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.Java.BORDER));
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
panel.add(headerPanel, BorderLayout.NORTH);
panel.add(previewListingPanel, BorderLayout.CENTER);

View file

@ -21,7 +21,7 @@ import java.awt.event.ActionListener;
import javax.swing.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.feature.fid.db.*;
import ghidra.feature.fid.service.FidService;
@ -38,6 +38,7 @@ public class FidFunctionDebugPanel extends JPanel {
/**
* Creates the panel.
* @param service the FID database service
* @param fidQueryService the query service
* @param functionRecord the function record to debug
*/
public FidFunctionDebugPanel(FidService service, FidQueryService fidQueryService,
@ -57,7 +58,7 @@ public class FidFunctionDebugPanel extends JPanel {
JButton button = new JButton(text);
button.addActionListener(listener);
button.setHorizontalAlignment(SwingConstants.LEFT);
Gui.registerFont(button, GThemeDefaults.Ids.Fonts.MONOSPACED);
Gui.registerFont(button, Fonts.MONOSPACED);
add(button);
}
@ -68,7 +69,7 @@ public class FidFunctionDebugPanel extends JPanel {
private void addLabel(String text) {
JLabel label = new GDLabel(text);
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setFont(Gui.getFont("font.monospaced"));
Gui.registerFont(label, Fonts.MONOSPACED);
add(label);
}
@ -85,16 +86,14 @@ public class FidFunctionDebugPanel extends JPanel {
libraryRecord.getLibraryVersion(), libraryRecord.getLibraryVariant(),
languageID.getIdAsString()));
addButton(String.format("0x%016x", functionRecord.getID()),
e -> FidDebugUtils.searchByFunctionID(functionRecord.getID(), service,
fidQueryService));
addButton(String.format("0x%016x", functionRecord.getID()), e -> FidDebugUtils
.searchByFunctionID(functionRecord.getID(), service, fidQueryService));
addButton(functionRecord.getName(),
e -> FidDebugUtils.searchByName(functionRecord.getName(), service, fidQueryService));
addButton(shorten(functionRecord.getDomainPath()),
e -> FidDebugUtils.searchByDomainPath(functionRecord.getDomainPath(), service,
fidQueryService));
addButton(shorten(functionRecord.getDomainPath()), e -> FidDebugUtils
.searchByDomainPath(functionRecord.getDomainPath(), service, fidQueryService));
addLabel(String.format("Entry Point: 0x%x", functionRecord.getEntryPoint()));

View file

@ -77,13 +77,13 @@ public class FidSearchDebugDialog extends DialogComponentProvider {
private JLabel getPreparedLabel(String text) {
JLabel label = new GDLabel(text, SwingConstants.RIGHT);
label.setFont(Gui.getFont(Fonts.MONOSPACED));
Gui.registerFont(label, Fonts.MONOSPACED);
return label;
}
private JTextField getPreparedTextField() {
JTextField textField = new JTextField(25);
textField.setFont(Gui.getFont(Fonts.MONOSPACED));
Gui.registerFont(textField, Fonts.MONOSPACED);
return textField;
}

View file

@ -26,8 +26,6 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import docking.widgets.table.*;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.feature.fid.db.*;
import ghidra.feature.fid.service.FidService;
import ghidra.util.Msg;
@ -66,7 +64,7 @@ public class FidSearchResultFrame extends JFrame implements FidQueryCloseListene
private void buildFrame() {
GTableCellRenderer renderer = new GTableCellRenderer();
renderer.setFont(Gui.getFont(Fonts.MONOSPACED));
renderer.setFont(renderer.getFixedWidthFont());
int columnCount = table.getColumnCount();
for (int ii = 0; ii < columnCount; ++ii) {
Class<?> columnClass = table.getColumnClass(ii);

View file

@ -22,7 +22,7 @@ import java.util.List;
import javax.swing.Icon;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.feature.vt.api.main.VTAssociationMarkupStatus;
public class VTMarkupStatusIcon implements Icon {
@ -74,7 +74,7 @@ public class VTMarkupStatusIcon implements Icon {
drawBar(g, x + startX + BORDER + 1, y + BORDER + 1, width, colors.get(i));
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawRect(x, y, WIDTH, HEIGHT);
// g.drawRect(x, y, WIDTH / 2, HEIGHT);
g.drawRect(x + WIDTH, y + HEIGHT / 2 - 3, KNOB_WIDTH, 6);

View file

@ -27,7 +27,9 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.button.BrowseButton;
import docking.widgets.label.GDLabel;
import docking.wizard.*;
import generic.theme.*;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.app.util.task.OpenProgramTask;
import ghidra.app.util.task.OpenProgramTask.OpenProgramRequest;
import ghidra.framework.main.DataTreeDialog;
@ -74,7 +76,7 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
folderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
folderLabel.setToolTipText("The folder to store the new Version Tracking Session");
folderNameField = new JTextField();
Gui.registerFont(folderNameField, GThemeDefaults.Ids.Fonts.MONOSPACED);
Gui.registerFont(folderNameField, Fonts.MONOSPACED);
folderNameField.setEditable(false); // force user to browse to choose
JButton browseFolderButton = new BrowseButton();

View file

@ -2,8 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
<TITLE>Developer's Guide</TITLE>
</HEAD>
@ -21,8 +19,8 @@
want to use colors, fonts, and icons. The key idea to support theming is to never
<B>directly</B>
reference those resources. Instead, the developer should create an ID string for the resource
and then in a <CODE><I>module</I>.theme.properties</CODE> file, provide a default value for that ID.
(Also, you may define an alternate "dark" default value that will be used if the
and then in a <CODE><I>module</I>.theme.properties</CODE> file, provide a default value for that
ID. (Also, you may define an alternate "dark" default value that will be used if the
current theme is considered a dark theme). The way you
define and use these IDs is a bit different depending on whether the resource is a color, font,
or icon. Colors and icons are similar in that developers use these types by creating either
@ -182,6 +180,42 @@
<LI>icon.plugin.byteviewer.provider</LI>
</UL>
</BLOCKQUOTE>
<UL>
<LI><A NAME="System_IDs"></A><B>System IDs:</B> The following resource IDs are created and
used by the system. For a description of how these IDs are used internally by the
application, see the <CODE>UiDefaultsMapper</CODE> class . The <CODE>system.*</CODE> keys
allow users to quickly change many Look and Feel values via these high-level concepts. The
<CODE>laf.*</CODE> properties are for internal use and do not need to be changed by the user.
A description of the system properties can be found in the <CODE>SystemThemeIds</CODE> class.
</LI>
</UL>
<BLOCKQUOTE>
<UL>
<LI>laf.color.*</LI>
<LI>laf.font.*</LI>
<LI>laf.icon.*</LI>
</UL>
<UL>
<LI>system.color.*</LI>
<LI>system.font.*</LI>
</UL>
<P>
The <CODE>system</CODE> property names use the standard property names, such as <CODE>
font, bg</CODE> and <CODE>fg</CODE>. These properties introduce these additional terms:
<CODE>control, view, menu and tooltip</CODE>. <CODE>control</CODE> refers to items that
generally control the state of the application, such as buttons and check boxes.
<CODE>view</CODE> refers to widgets that display data, such as trees, tables and text
fields. <CODE>menu</CODE> and <CODE>tooltip</CODE> work with the items after which they are
named.
</P>
</BLOCKQUOTE>
</BLOCKQUOTE>
<H2>Theme Property Files</H2>
@ -198,7 +232,7 @@
they exist in a module's data directory and are named with the
<CODE>.theme.properties</CODE> suffix.</P>
<H3>Theme Properties File Naming Convention</H3>
<H3><A NAME="Theme_Property_Names"></A>Theme Properties File Naming Convention</H3>
<P>To promote consistency, theme property files should use the following naming
convention:</P>
@ -260,7 +294,7 @@ color.bg.listing = color.bg
color.fg.listing.address = black
color.fg.listing.bytes = #00ff00
font.global = courirer-BOLD-12
font.global = courier-BOLD-12
font.global.listing = font.global
icon.error = defaultError.png
@ -295,11 +329,22 @@ color.fg.listing.bytes = orange
example, a reference color entry might be something like "color.bg.listing = color.bg". This
says that the listing's background color should be whatever "color.bg" is defined to be. Note
that all of the application's defined properties start with either "color.", "font.", or
"icon.". Properties defined by a Java Look and Feel don't follow this pattern. To reference a
property that does not have a standard prefix, an ID can be prefixed with "[color]",
"[font]", or "[icon] as appropriate to allow the theme property parser to recognize the
values as IDs to other properties. So to refer to a Java property named "table.background",
you would use the following definition: "color.bg.table = [color]table.background".</P>
"icon.".
<P>
Properties defined by the theming system do not follow this pattern. To reference a
property that does not have a standard prefix, an ID can be prefixed with <COD>[color]
</CODE>, <CODE>[font]</CODE>, or <CODE>[icon]</CODE> as appropriate to allow the theme
property parser to recognize the values as IDs to other properties. For example, to refer to a
system property named<CODE>system.color.bg.view</CODE>,
you would use the following definition:
<P>
<BLOCKUOTE>
<P>
<CODE>color.bg.tree = [color]system.color.bg.view</CODE>
</P>
</BLOCKQUOTE>
<H3>Color Values</H3>
@ -319,8 +364,8 @@ color.fg.listing.bytes = orange
<LI>rgba(red, green, blue, alpha)</LI>
<LI><I>web color name</I> // the case-insensitive name of a web color such as red, olive, or
purple</LI>
<LI><I>web color name</I> // the case-insensitive name of a web color such as red, olive,
or purple</LI>
</UL>
</BLOCKQUOTE>
@ -449,6 +494,126 @@ color.fg.listing.bytes = orange
</PRE>
<H2>Useful Concepts</H2>
<H3>GThemeDefaults</H3>
<BLOCKQUOTE>
<P>
This class contains many common application theme values for developers to use, such as
the default background color. These values can be used directly so developers do not have
to instantiate theme objects using theme IDs.
</P>
</BLOCKQUOTE>
<H3>Icons</H3>
<BLOCKQUOTE>
<p>
When adding icons to the application, consider using standard icons provided by the
<CODE>Icons</CODE> class. Many generic concepts that require icons are in this class.
</P>
</BLOCKQUOTE>
<H3>Palette Colors</H3>
<BLOCKQUOTE>
<P>
A list of palette colors has been defined in <CODE>gui.palette.theme.properties.</CODE>.
These palette colors values are meant to be used by developers to reduce the total number
of colors used in the application. These color ids and values are viewable in the
<A href="ThemingUserDocs.html#Edit_Theme">Theme Editor Dialog</A>.
</P>
<P>
One of the benefits of using the palette system is that it is easy for end-users to change
one palette color to update all widgets in the application.
</P>
<P>
We recommend you use the existing palette colors when picking colors for your widgets.
</P>
</BLOCKQUOTE>
<H3>HTML Foreground Colors in Messages</H3>
<BLOCKQUOTE>
<P>
Some developers use HTML messages in labels, tables, tooltips, and in calls to system APIs,
like <CODE>Msg</CODE>. Using HTML text allows clients to control the formatting of the
text, including the usage of color. If you use color in your HTML, then we suggest you do
so using GColors, like this:
<PRE>
String message = "Some text: &LT;FONT COLOR=\"" + Messages.ERROR + "\"&GT;" + errorText + "</FONT>";
</PRE>
<P>
In this example, an HTML message is created and part of that text is colored with the
standard error message color, which is red in a light mode theme. You can also use your
own <CODE>GColor</CODE> object in your HTML messages. Using standard system colors or
GColors allows these colors to be updated as the theme changes. We do not
recommend the use of hard-coded color values.
</P>
</BLOCKQUOTE>
<H3>Options Usage of Colors and Fonts</H3>
<BLOCKQUOTE>
<P>
The <CODE>Options</CODE> class in Ghidra facilitates user-configurable options in the
application. Previously, developers could use options to allow end-users to control color
values. In the new theme-based system, all colors are controlled via theming. However, to
make the transition to theming easier for developers, we added methods to the options class
that allow the developer to bind color editing via the options UI. These color options will
write any changes directly to the theme system.
</P>
<P> See: <CODE>Options.registerThemeColorBinding()</CODE> and
<CODE>Options.registerThemeFontBinding()</CODE>
</P>
</BLOCKQUOTE>
<H3>UiDefaultsMapper</H3>
<BLOCKQUOTE>
<P>This class discusses some of the plumbing the application uses to unify the various Look
and Feel concepts presented by the different LaFs.
</P>
</BLOCKQUOTE>
<H3>SystemThemeIds</H3>
<BLOCKQUOTE>
<P>This class is used by the <CODE>UiDefaultsMapper</CODE> class and presents a set of resource IDs common across all
LaFs. These values can be changed by the user. See also the description of
<A NAME="#System_IDs">System IDs in this document</A>.
</P>
</BLOCKQUOTE>
<H3>Known Issues</H3>
<BLOCKQUOTE>
<P>
Sometimes switching between themes does not reset all widgets. When
this happens, you may notice odd UI artifacts. These will go away when the application is
restarted and often when you again switch the theme.
</P>
</BLOCKQUOTE>
<P class="providedbyplugin">Provided by: <I>Theme Manager</I></P>
<P class="relatedtopic">Related Topics</P>

View file

@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>Theming Architecture</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

View file

@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>General Overivew</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

View file

@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>Theming User Documentation</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>
@ -67,11 +64,10 @@
called "Button.background", it would appear in Ghidra as "laf.color.Button.background".</LI>
<LI>Look and Feel Palette Properties - All the color and fonts used by the Look and Feel
properties are grouped into either system property values or auto-generated palette
properties, sso that groups of properties can be changed together.</LI>
properties, so that groups of properties can be changed together.</LI>
</UL>
<P>See the <A href="ThemingDeveloperDocs.html#Resource_Ids">Developer Documentation</A> for more
details on the property ID format and naming conventions.
</P>
@ -185,6 +181,14 @@
action, press the refresh button <IMG alt="" src="images/reload3.png" border="0"> in the top
right corner of the Theme Editor dialog.
<H3>Toggle Showing System Values<A NAME="Toggle_Show_System_Values"></A></H3>
<P>
Toggles whether the given table shows system ID values (e.g, those starting with <CODE>
laf.</CODE> or <CODE>system.</CODE>. By default these values are hidden.
</P>
<H3>Saving Themes</H3>
<P>After making changes to one or more theme values, the <A href="#Edit_Theme">Theme

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Before After
Before After

View file

@ -38,10 +38,6 @@ public class EditWindow extends JWindow {
private AssociatedComponentListener compListener = new AssociatedComponentListener();
/**
* Constructor for RenameViewWindow.
* @param owner
*/
EditWindow(DockingWindowManager mgr) {
super(mgr.getRootFrame());
this.mgr = mgr;
@ -52,17 +48,11 @@ public class EditWindow extends JWindow {
return comp;
}
/**
* @see java.awt.Window#isActive()
*/
@Override
public boolean isActive() {
return active;
}
/**
* @see java.awt.Component#setVisible(boolean)
*/
@Override
public void setVisible(boolean state) {
@ -133,8 +123,7 @@ public class EditWindow extends JWindow {
private void create() {
textField = new JTextField(" ");
JPanel panel = new JPanel(new BorderLayout());
Color bgColor = Colors.BG_TOOLTIP;
panel.setBackground(bgColor);
panel.setBackground(Colors.BACKGROUND);
panel.add(textField, BorderLayout.CENTER);
textField.addKeyListener(new KeyAdapter() {
@ -167,32 +156,21 @@ public class EditWindow extends JWindow {
private class AssociatedComponentListener implements ComponentListener, ChangeListener {
/*
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
*/
@Override
public void componentHidden(ComponentEvent e) {
close();
}
/*
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
*/
@Override
public void componentResized(ComponentEvent e) {
close();
}
/*
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
*/
@Override
public void componentShown(ComponentEvent e) {
// stub
}
/*
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
*/
@Override
public void componentMoved(ComponentEvent e) {
if (comp != null && comp.isVisible()) {
@ -200,9 +178,6 @@ public class EditWindow extends JWindow {
}
}
/*
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
*/
@Override
public void stateChanged(ChangeEvent e) {
close();

View file

@ -30,7 +30,7 @@ import docking.util.AnimationUtils;
import docking.widgets.VariableHeightPanel;
import docking.widgets.label.GDLabel;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
// TODO: should this be put into generic?
@ -211,7 +211,7 @@ public class GenericHeader extends JPanel {
private void constructMultiLinePanel() {
removeAll();
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Java.BORDER));
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Colors.BORDER));
add(toolbar, BorderLayout.SOUTH);
add(titlePanel, BorderLayout.CENTER);
add(menuCloseToolbar, BorderLayout.EAST);

View file

@ -35,7 +35,6 @@ import docking.dnd.StringTransferable;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Messages;
import ghidra.util.ColorUtils;
import ghidra.util.WebColors;
@ -151,7 +150,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
recentSwatchListener = new RecentSwatchListener();
recentSwatchPanel.addMouseListener(recentSwatchListener);
LineBorder border = new LineBorder(Java.BORDER);
LineBorder border = new LineBorder(Colors.BORDER);
swatchPanel.setBorder(border);
gbc.gridx = 0;
gbc.gridy = 0;
@ -424,7 +423,7 @@ class SwatchPanel extends JPanel {
}
int y = row * (swatchSize.height + gap.height);
g.fillRect(x, y, swatchSize.width, swatchSize.height);
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1,
y + swatchSize.height - 1);
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1,

View file

@ -33,6 +33,8 @@ public class ThemeColorPaletteTable extends ThemeColorTable {
@Override
protected void filter() {
super.filter(); // this call will update 'colors'
List<ColorValue> filtered = new ArrayList<>();
for (ColorValue colorValue : colors) {

View file

@ -34,7 +34,7 @@ import ghidra.util.Swing;
/**
* Color Table for Theme Dialog
*/
public class ThemeColorTable extends JPanel implements ActionContextProvider {
public class ThemeColorTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeColorTableModel colorTableModel;
private ColorValueEditor colorEditor = new ColorValueEditor(this::colorValueChanged);
@ -87,6 +87,17 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
return new ThemeColorTableModel(valuesProvider);
}
@Override
public void setShowSystemValues(boolean show) {
colorTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return colorTableModel.isShowingSystemValues();
}
void colorValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@ -118,7 +129,7 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
ColorValue themeValue = colorTableModel.getThemeValue(id);
return new ThemeTableContext<>(currentValue, themeValue);
return new ThemeTableContext<>(currentValue, themeValue, this);
}
return null;
}

View file

@ -16,6 +16,7 @@
package docking.theme.gui;
import java.awt.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Supplier;
@ -44,6 +45,7 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
private GThemeValueMap lightDefaultValues;
private GThemeValueMap darkDefaultValues;
private GThemeValuesCache valuesCache;
private boolean showSystemValues;
public ThemeColorTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@ -51,9 +53,17 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
/**
* Reloads the just the current values shown in the table. Called whenever a color changes.
*/
* Reloads the just the current values shown in the table. Called whenever a color changes.
*/
public void reloadCurrent() {
currentValues = valuesCache.getCurrentValues();
colors = currentValues.getColors();
@ -86,7 +96,23 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
}
protected void filter() {
// for subclasses
List<ColorValue> filtered = new ArrayList<>();
for (ColorValue colorValue : colors) {
String id = colorValue.getId();
if (showSystemValues) {
filtered.add(colorValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(colorValue);
}
}
colors = filtered;
}
@Override

View file

@ -50,7 +50,6 @@ public class ThemeEditorDialog extends DialogComponentProvider {
private ThemeColorTable paletteTable;
private ThemeManager themeManager;
private GThemeValuesCache valuesCache;
public ThemeEditorDialog(ThemeManager themeManager) {
@ -107,6 +106,22 @@ public class ThemeEditorDialog extends DialogComponentProvider {
.onAction(c -> c.getThemeValue().installValue(themeManager))
.build();
addAction(resetValueAction);
DockingAction showSystemValuesAction =
new ActionBuilder("Toggle Show System Values", getTitle())
.popupMenuPath("Toggle Show System Values")
.withContext(ThemeTableContext.class)
.popupWhen(c -> true)
.helpLocation(new HelpLocation("Theming", "Toggle_Show_System_Values"))
.onAction(context -> toggleSystemValues(context))
.build();
addAction(showSystemValuesAction);
}
private void toggleSystemValues(ThemeTableContext<?> context) {
ThemeTable themeTable = context.getThemeTable();
boolean isShowing = themeTable.isShowingSystemValues();
themeTable.setShowSystemValues(!isShowing);
}
private void adjustFonts(int amount) {

View file

@ -35,7 +35,7 @@ import ghidra.util.Swing;
/**
* Font Table for Theme Dialog
*/
public class ThemeFontTable extends JPanel implements ActionContextProvider {
public class ThemeFontTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeFontTableModel fontTableModel;
private FontValueEditor fontEditor = new FontValueEditor(this::fontValueChanged);
@ -84,6 +84,17 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
}
@Override
public void setShowSystemValues(boolean show) {
fontTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return fontTableModel.isShowingSystemValues();
}
void fontValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@ -115,7 +126,7 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
FontValue themeValue = fontTableModel.getThemeValue(id);
return new ThemeTableContext<Font>(currentValue, themeValue);
return new ThemeTableContext<Font>(currentValue, themeValue, this);
}
return null;
}

View file

@ -17,15 +17,13 @@ package docking.theme.gui;
import java.awt.Component;
import java.awt.Font;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.function.Supplier;
import javax.swing.JLabel;
import docking.widgets.table.*;
import generic.theme.FontValue;
import generic.theme.GThemeValueMap;
import generic.theme.*;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.framework.plugintool.ServiceProviderStub;
@ -41,6 +39,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
private GThemeValueMap themeValues;
private GThemeValueMap defaultValues;
private GThemeValuesCache valuesProvider;
private boolean showSystemValues;
public ThemeFontTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@ -48,6 +47,34 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
protected void filter() {
List<FontValue> filtered = new ArrayList<>();
for (FontValue fontValue : fonts) {
String id = fontValue.getId();
if (showSystemValues) {
filtered.add(fontValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(fontValue);
}
}
fonts = filtered;
}
/**
* Reloads the just the current values shown in the table. Called whenever a font changes.
*/
@ -71,6 +98,8 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
fonts = currentValues.getFonts();
themeValues = valuesProvider.getThemeValues();
defaultValues = valuesProvider.getDefaultValues();
filter();
}
@Override
@ -172,6 +201,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
return renderer;
}
@Override
public Comparator<ResolvedFont> getComparator() {
return (v1, v2) -> {
if (v1 == null && v2 == null) {
@ -220,5 +250,6 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
}
private record ResolvedFont(String id, String refId, Font font) {/**/}
private record ResolvedFont(String id, String refId, Font font) {
/**/}
}

View file

@ -33,7 +33,7 @@ import ghidra.util.Swing;
/**
* Icon Table for Theme Dialog
*/
public class ThemeIconTable extends JPanel implements ActionContextProvider {
public class ThemeIconTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeIconTableModel iconTableModel;
private IconValueEditor iconEditor = new IconValueEditor(this::iconValueChanged);
@ -80,6 +80,17 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
add(filterTable, BorderLayout.CENTER);
}
@Override
public void setShowSystemValues(boolean show) {
iconTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return iconTableModel.isShowingSystemValues();
}
void iconValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@ -111,7 +122,7 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
IconValue themeValue = iconTableModel.getThemeValue(id);
return new ThemeTableContext<Icon>(currentValue, themeValue);
return new ThemeTableContext<Icon>(currentValue, themeValue, this);
}
return null;
}

View file

@ -16,8 +16,7 @@
package docking.theme.gui;
import java.awt.Component;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.function.Supplier;
import javax.swing.*;
@ -40,6 +39,7 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
private GThemeValueMap themeValues;
private GThemeValueMap defaultValues;
private GThemeValuesCache valuesProvider;
private boolean showSystemValues;
public ThemeIconTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@ -47,6 +47,34 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
protected void filter() {
List<IconValue> filtered = new ArrayList<>();
for (IconValue iconValue : icons) {
String id = iconValue.getId();
if (showSystemValues) {
filtered.add(iconValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(iconValue);
}
}
icons = filtered;
}
/**
* Reloads the just the current values shown in the table. Called whenever an icon changes.
*/
@ -70,6 +98,8 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
icons = currentValues.getIcons();
themeValues = valuesProvider.getThemeValues();
defaultValues = valuesProvider.getDefaultValues();
filter();
}
@Override
@ -242,6 +272,6 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
}
}
private record ResolvedIcon(String id, String refId, Icon icon) {/**/}
private record ResolvedIcon(String id, String refId, Icon icon) {
/**/}
}

View file

@ -0,0 +1,34 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package docking.theme.gui;
/**
* A common interface for theme tables
*/
public interface ThemeTable {
/**
* True signals to show IDs used for system values
* @param show true signals to show IDs used for system values
*/
public void setShowSystemValues(boolean show);
/**
* True if showing system IDs
* @return true if showing system IDs
*/
public boolean isShowingSystemValues();
}

View file

@ -27,10 +27,21 @@ public class ThemeTableContext<T> extends ActionContext {
private ThemeValue<T> currentValue;
private ThemeValue<T> themeValue;
private ThemeTable themeTable;
public ThemeTableContext(ThemeValue<T> currentValue, ThemeValue<T> themeValue) {
public ThemeTableContext(ThemeValue<T> currentValue, ThemeValue<T> themeValue,
ThemeTable themeTable) {
this.currentValue = currentValue;
this.themeValue = themeValue;
this.themeTable = themeTable;
}
/**
* Returns the theme table for this context
* @return the table
*/
public ThemeTable getThemeTable() {
return themeTable;
}
/**

View file

@ -26,7 +26,7 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
import org.jdesktop.animation.timing.interpolation.PropertySetter;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.WindowUtilities;
import generic.util.image.ImageUtils;
@ -878,7 +878,7 @@ public class AnimationUtils {
double cx = emphasizedBounds.getCenterX();
double cy = emphasizedBounds.getCenterY();
g2d.rotate(rad, cx, cy);
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
int iw = emphasizedBounds.width;
int ih = emphasizedBounds.height;

View file

@ -26,6 +26,7 @@ import docking.widgets.label.GDHtmlLabel;
import generic.theme.GColor;
import generic.theme.GColorUIResource;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.theme.GThemeDefaults.Colors.Tables;
/**
* A common base class for list and table renderer objects, unifying the Ghidra look and feel.
@ -165,6 +166,14 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
return ALT_BACKGROUND_COLOR;
}
protected Color getErrorForegroundColor(boolean isSelected) {
return isSelected ? Tables.ERROR_SELECTED : Tables.ERROR_UNSELECTED;
}
protected Color getUneditableForegroundColor(boolean isSelected) {
return isSelected ? Tables.UNEDITABLE_SELECTED : Tables.UNEDITABLE_UNSELECTED;
}
// ==================================================================================================
// Methods overridden for performance reasons (see DefaultTableCellRenderer &
// DefaultListCellRenderer)

View file

@ -101,6 +101,7 @@ public class DropDownMultiSelectionTextField<T> extends DropDownSelectionTextFie
}
previewList.setOpaque(true);
previewList.setBackground(PREVIEW_WINDOW_BGCOLOR);
previewList.setForeground(PREVIEW_WINDOW_FGCOLOR);
previewList.setFocusable(false);
previewList.setModel(new DefaultListModel<String>());
}

View file

@ -29,7 +29,7 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.label.GDHtmlLabel;
import docking.widgets.list.GList;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import generic.util.WindowUtilities;
import ghidra.util.StringUtilities;
import ghidra.util.SystemUtilities;
@ -63,7 +63,8 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
private static final int DEFAULT_MAX_UPDATE_DELAY = 2000;
private static final int MIN_HEIGHT = 300;
private static final int MIN_WIDTH = 200;
protected static final Color PREVIEW_WINDOW_BGCOLOR = Colors.BACKGROUND;
protected static final Color PREVIEW_WINDOW_BGCOLOR = Tooltips.BACKGROUND;
protected static final Color PREVIEW_WINDOW_FGCOLOR = Tooltips.FOREGROUND;
private JWindow toolTipWindow; // delayed initialization for parenting
private JWindow matchingWindow; // delayed initialization for parenting
@ -157,6 +158,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
previewLabel = new GDHtmlLabel();
previewLabel.setOpaque(true);
previewLabel.setBackground(PREVIEW_WINDOW_BGCOLOR);
previewLabel.setForeground(PREVIEW_WINDOW_FGCOLOR);
previewLabel.setVerticalAlignment(SwingConstants.TOP);
previewLabel.setFocusable(false);
}
@ -343,7 +345,9 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
updateWindowLocation();
showMatchingWindow();
getPreviewPaneComponent().setBackground(PREVIEW_WINDOW_BGCOLOR);
JComponent previewComponent = getPreviewPaneComponent();
previewComponent.setBackground(PREVIEW_WINDOW_BGCOLOR);
previewComponent.setForeground(PREVIEW_WINDOW_FGCOLOR);
toolTipWindow.setVisible(hasPreview());
}
}
@ -574,10 +578,8 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
matchingWindow = new JWindow(parentWindow);
matchingWindow.setFocusable(false);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(
BorderFactory.createBevelBorder(BevelBorder.RAISED,
new GColor("color.border.bevel.highlight"),
new GColor("color.border.bevel.shadow")));
scrollPane.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
new GColor("color.border.bevel.highlight"), new GColor("color.border.bevel.shadow")));
scrollPane.setFocusable(false);
scrollPane.getVerticalScrollBar().setFocusable(false);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

View file

@ -32,7 +32,6 @@ import docking.widgets.label.GDLabel;
import docking.widgets.list.GList;
import docking.widgets.list.GListAutoLookup;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.util.exception.AssertException;
class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryModelIf {
@ -186,7 +185,7 @@ class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryMod
});
listEditor = new JPanel(new BorderLayout());
listEditor.setBorder(BorderFactory.createLineBorder(Java.BORDER));
listEditor.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
listEditor.add(listEditorLabel, BorderLayout.WEST);
listEditor.add(listEditorField, BorderLayout.CENTER);

View file

@ -24,7 +24,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.util.Msg;
import ghidra.util.filechooser.GhidraFileChooserModel;
@ -111,7 +111,7 @@ class FileEditor extends AbstractCellEditor implements TableCellEditor {
// match the spacing of non-editing cells
editor.setBorder(
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0),
BorderFactory.createLineBorder(Java.BORDER)));
BorderFactory.createLineBorder(Colors.BORDER)));
}
private void handleDoubleClick(Point p) {

View file

@ -30,7 +30,6 @@ import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.filechooser.GhidraFileChooserMode;
import docking.widgets.table.*;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors.Tables;
import generic.util.Path;
import ghidra.framework.options.SaveState;
import ghidra.framework.preferences.Preferences;
@ -232,8 +231,7 @@ public class PathManager {
if (column == PathManagerModel.COLUMN_PATH) {
Path path = (Path) value;
if (!isValidPath(path)) {
renderer.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
: Tables.FG_ERROR_UNSELECTED);
renderer.setForeground(getErrorForegroundColor(data.isSelected()));
}
}
return renderer;

View file

@ -29,7 +29,6 @@ import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.filechooser.GhidraFileChooserMode;
import docking.widgets.table.*;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.framework.preferences.Preferences;
import ghidra.util.filechooser.GhidraFileChooserModel;
import ghidra.util.filechooser.GhidraFileFilter;
@ -265,8 +264,7 @@ public class PathnameTablePanel extends JPanel {
label.setText(pathName.toString());
if (!fileExists) {
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
: Tables.FG_ERROR_UNSELECTED);
label.setForeground(getErrorForegroundColor(data.isSelected()));
}
return label;

View file

@ -33,7 +33,7 @@ import docking.widgets.table.GTableFilterPanel;
import docking.widgets.table.RowObjectFilterModel;
import docking.widgets.table.columnfilter.*;
import docking.widgets.table.constrainteditor.ColumnConstraintEditor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Messages;
import generic.util.WindowUtilities;
import ghidra.util.HelpLocation;
@ -383,7 +383,7 @@ public class ColumnFilterDialog<R> extends ReusableDialogComponentProvider
headerPanel.add(new GLabel("Filter Value", SwingConstants.CENTER));
headerPanel.setBorder(new CompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER),
BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.BORDER),
BorderFactory.createEmptyBorder(4, 0, 4, 0)));
return headerPanel;
}

View file

@ -409,7 +409,7 @@ public class GraphComponent<V extends VisualVertex, E extends VisualEdge<V>, G e
mainPanel.add(layeredPane, BorderLayout.CENTER);
satellite.setBorder(BorderFactory.createLineBorder(Colors.Java.BORDER));
satellite.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
undockedSatellitePanel = new JPanel(new BorderLayout());
undockedSatellitePanel.addComponentListener(new ComponentAdapter() {

View file

@ -128,7 +128,7 @@ public class VisualVertexSatelliteRenderer<V extends VisualVertex, E extends Vis
bounds.height + (offset * 2));
if (isGraphScaledEnoughToBeDifficultToSee(rc)) {
g.setColor(Colors.Java.BORDER);
g.setColor(Colors.BORDER);
g.drawOval(bounds.x - offset, bounds.y - offset, bounds.width + (offset * 2),
bounds.height + (offset * 2));
g.drawOval(bounds.x - offset - 1, bounds.y - offset - 1,

View file

@ -153,7 +153,7 @@ public class VisualVertexRenderer<V extends VisualVertex, E extends VisualEdge<V
g.fill(shape);
// an outline
g.setColor(Colors.Java.BORDER);
g.setColor(Colors.BORDER);
g.draw(shape);
g.setPaint(oldPaint);

View file

@ -19,60 +19,85 @@ import static generic.theme.SystemThemeIds.*;
import java.awt.Color;
/** TODO doc how clients should use this in their code, with
/**
* This class contains many suitable default values for commonly used concepts. See each static
* class below.
* <P>
* The values in this class can be used where standard colors are desired. For example, where
* clients used to hard-code black for the font color:
* <PRE>
* <CODE>
* JLabel label = new JLabel():
* label.setColor(Color.BLACK);
* </CODE>
* </PRE>
* Can instead be programmed to use the system's current theme font color instead:
* <PRE>
* <CODE>
* import generic.theme.GThemeDefaults.Colors;
*
* ...
*
* JLabel label = new JLabel():
* label.setColor(Colors.FOREGROUND);
* </CODE>
* </PRE>
* Note that in the second example, you can use the shorthand version of the values in this class
* as long as you import them correctly. This means you do not have to use this form:
* <PRE>
* <CODE>
* component.setColor(GThemeDefaults.Colors.FOREGROUND);
* </CODE>
* </PRE>
*
*
*
* Colors.BACKGROUND
* Colors.Java.BORDER
*/
public class GThemeDefaults {
public static class Ids {
public static class Ids {
public static class Fonts {
public static final String MONOSPACED = "font.monospaced";
}
}
/**
* Colors mapped to system values
* Colors mapped to common system widget concepts, such as foreground, background, border, etc.
*/
public static class Colors {
//@formatter:off
// standard color concepts defined by LookAndFeel
public static final GColor BG_CONTROL = new GColor(BG_CONTROL_ID);
public static final GColor BG_VIEW = new GColor(BG_VIEW_ID);
public static final GColor BG_TOOLTIP = new GColor(BG_TOOLTIP_ID);
public static final GColor BG_VIEW_SELECTED = new GColor(BG_VIEW_SELECTED_ID);
public static final GColor BG_BORDER = new GColor(BG_BORDER_ID);
public static final GColor FG_CONTROL = new GColor(FG_CONTROL_ID);
public static final GColor FG_VIEW = new GColor(FG_VIEW_ID);
public static final GColor FG_TOOLTIP = new GColor(FG_TOOLTIP_ID);
public static final GColor FG_VIEW_SELECTED = new GColor(FG_VIEW_SELECTED_ID);
public static final GColor FG_DISABLED = new GColor(FG_DISABLED_ID);
// generic color concepts
public static final GColor BACKGROUND = new GColor("color.bg");
public static final GColor CURSOR = new GColor("color.cursor.focused");
public static final GColor ERROR = new GColor("color.fg.error");
public static final GColor FOREGROUND = new GColor("color.fg");
public static final GColor FOREGROUND_DISABLED = new GColor("color.fg.disabled");
public static final GColor CURSOR = new GColor("color.cursor.focused");
public static final GColor ERROR = new GColor("color.fg.error");
public static final GColor BORDER = new GColor(BG_BORDER_ID);
//@formatter:on
public static class Java {
public static final GColor BORDER = BG_BORDER;
}
/**
* Color values to use for tables
*/
public static class Tables {
//@formatter:off
public static final GColor FG_ERROR_SELECTED = new GColor("color.fg.error.table.selected");
public static final GColor FG_ERROR_UNSELECTED = new GColor("color.fg.error.table.unselected");
public static final GColor FG_UNEDITABLE_SELECTED = new GColor("color.fg.table.uneditable.selected");
public static final GColor FG_UNEDITABLE_UNSELECTED = new GColor("color.fg.table.uneditable.unselected");
public static final GColor ERROR_SELECTED = new GColor("color.fg.error.table.selected");
public static final GColor ERROR_UNSELECTED = new GColor("color.fg.error.table.unselected");
public static final GColor UNEDITABLE_SELECTED = new GColor("color.fg.table.uneditable.selected");
public static final GColor UNEDITABLE_UNSELECTED = new GColor("color.fg.table.uneditable.unselected");
//@formatter:on
}
/**
* Color values to use with tooltips
*/
public static class Tooltips {
@SuppressWarnings("hiding") // we know there is another 'BACKGROUND' field in this file
public static final GColor BACKGROUND = new GColor(BG_TOOLTIP_ID);
@SuppressWarnings("hiding") // we know there is another 'FOREGROUND' field in this file
public static final GColor FOREGROUND = new GColor(FG_TOOLTIP_ID);
}
/**
* 'Messages' is primarily used by system dialogs to display status. That the colors are
* used for foregrounds is implied.
@ -89,7 +114,8 @@ public class GThemeDefaults {
}
/**
* Generic palette colors, using color names, that may be changed along with the theme
* Generic palette colors, using color names, that may be changed along with the theme.
* These are not all defined palette colors, but some of the more commonly used colors.
*/
public static class Palette {
@ -119,7 +145,7 @@ public class GThemeDefaults {
/**
* Returns a new {@link GColor} for the given palette name.
* <p>
* For a list of supported palette IDs, see {@code docking.palette.theme.properties}.
* For a list of supported palette IDs, see {@code gui.palette.theme.properties}.
* <p>
* It is preferred to use the static colors defined in {@link Palette} when possible, as
* it prevents excess object creation. This method should be used when the desired

View file

@ -161,8 +161,18 @@ public class Gui {
return themeManager.isDarkTheme();
}
/**
* Returns true if the given id is a system-defined id, such as those starting with
* {@code laf.color} or {@code system.color}.
*
* @param id the id
* @return true if the given id is a system-defined id
*/
public static boolean isSystemId(String id) {
return id.startsWith("laf.") || id.startsWith("system.");
}
static void setThemeManager(ThemeManager manager) {
themeManager = manager;
}
}

View file

@ -18,17 +18,19 @@ package generic.theme;
import generic.theme.laf.UiDefaultsMapper;
/**
* These are the standard system ids defined to represent general LookAndFeel color and font
* concepts. Various LaF have different names for these concepts and even defines additional
* concepts. These are the ones we use regardless of the LookAndFeel being used. When we
* load a specific LookAndFeel, a {@link UiDefaultsMapper}, specific to that LaF is used to map
* its system ids to our standard system ids. Also, {@link GThemeDefaults} uses these system
* ids to define colors that can be used throughout the application without using these ids
* This class provides a set of IDs that can be used in the application, regardless of which Look
* and Feel (LaF) is being used.
* <P>
* Various LaFs have different names for common concepts and even define additional concepts not
* listed here. The values in this class are those the application used use regardless of the LaF
* being used. When we load a specific LaF, a {@link UiDefaultsMapper} specific to that LaF is used
* to map its common LaF ids to these standard system ids. The {@link GThemeDefaults} uses these
* system ids to define colors that can be used throughout the application without using these ids
* directly.
* <P>
* The ids are assigned to categories as follows:
* <UL>
* <LI>CONTROL- these ids are used for colors and fonts for general system components such as
* <LI>CONTROL- these ids are used for colors and fonts for general system components such as
* Buttons, Checkboxes, or anything that doesn't fit into one of the other areas</LI>
* <LI>VIEW - these ids are used for the colors and fonts used for widgets that display data
* such as Trees, Tables, TextFieds, and Lists</LI>
@ -45,7 +47,6 @@ import generic.theme.laf.UiDefaultsMapper;
* <LI> FG_DISABLED - the foreground color when the component is disabled
* <LI> BG_BORDER - the border color
* <LI> FONT - the font
*
* </UL>
*/
public class SystemThemeIds {

View file

@ -24,7 +24,7 @@ import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
/**
* Maintains a week set of components associated with a given font id. Whenever the font changes
* Maintains a weak set of components associated with a given font id. Whenever the font changes
* for the font id, this class will update the component's font to the new value.
*/
public class ComponentFontRegistry {

View file

@ -194,7 +194,7 @@ public abstract class LookAndFeelManager {
/**
* Binds the component to the font identified by the given font id. Whenever the font for
* the font id changes, the component will updated with the new font.
* the font id changes, the component will be updated with the new font.
* @param component the component to set/update the font
* @param fontId the id of the font to register with the given component
*/
@ -213,7 +213,7 @@ public abstract class LookAndFeelManager {
}
/**
* Subclass provide this method to install the specific look and feel.
* Subclasses may override this method to install a specific look and feel.
*
* @throws ClassNotFoundException if the <code>LookAndFeel</code>
* class could not be found
@ -231,7 +231,7 @@ public abstract class LookAndFeelManager {
}
/**
* Subclass can override this method to do specific LookAndFeel fix ups
* Subclass may override this method to do specific LookAndFeel fix ups
*/
protected void fixupLookAndFeelIssues() {
// no generic fix-ups at this time.

View file

@ -25,8 +25,8 @@ import ghidra.util.exception.AssertException;
/**
* Nimbus {@link LookAndFeelManager}. Specialized so that it can return the Nimbus installer and
* do specialized updating when icons or fonts change. Basically, needs to re-install a new
* instance of the Nimbus LookAndFeel each time a font or icon changes
* perform specialized updating when icons or fonts change. Basically, this class needs to
* re-install a new instance of the Nimbus LookAndFeel each time a font or icon changes.
*/
public class NimbusLookAndFeelManager extends LookAndFeelManager {
@ -60,9 +60,9 @@ public class NimbusLookAndFeelManager extends LookAndFeelManager {
private void reinstallNimubus() {
try {
/**
/*
* In order to get Nimbus to honor changes to fonts and icons in the UiDefaults,
* we have to reinstall nimbus. Reinstalling nimbus is a bit different that the first
* we have to reinstall Nimbus. Reinstalling Nimbus is a bit different than the original
* install. First, we don't want to re-install the java defaults, the current ones are
* fine and we don't want loose any current theme values changes. Second, when we
* get font and theme value overrides, we want to use all the current values as they
@ -93,16 +93,16 @@ public class NimbusLookAndFeelManager extends LookAndFeelManager {
@Override
protected void processJavaDefaults() {
// The GNimbusLookAndFeel already extracted the java defaults and installed them in the Gui
// We already extracted the java defaults and installed them in the Gui
}
@Override
protected void fixupLookAndFeelIssues() {
super.fixupLookAndFeelIssues();
// fix scroll bar grabber disappearing. See https://bugs.openjdk.java.net/browse/JDK-8134828
// This fix looks like it should not cause harm even if the bug is fixed on the jdk side.
// fix scroll bar grabber disappearing. See
// https://bugs.openjdk.java.net/browse/JDK-8134828. This fix looks like it should not cause
// harm even if the bug is fixed on the jdk side.
UIDefaults defaults = UIManager.getDefaults();
defaults.put("ScrollBar.minimumThumbSize", new Dimension(30, 30));

View file

@ -42,7 +42,7 @@ import ghidra.util.Msg;
* {@link BasicLookAndFeel} values.
* <P>
* Subclasses can override the mapping of these standard system values for particular LaFs that have
* different keys or color assignments.
* different ids or color assignments.
* <P>
* Some basic concepts:
* <UL>

View file

@ -30,8 +30,8 @@ import docking.dnd.GClipboard;
import docking.dnd.StringTransferable;
import docking.widgets.OptionDialog;
import docking.widgets.label.GIconLabel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.Gui;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.framework.model.DomainFile;
import ghidra.framework.plugintool.PluginTool;
import ghidra.util.HelpLocation;
@ -118,7 +118,7 @@ public class AboutDomainObjectUtils {
auxArea.setCaretPosition(0); // move cursor to BOF...
JScrollPane sp = new JScrollPane(auxArea);
sp.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createLineBorder(Java.BORDER), "Additional Information"));
BorderFactory.createLineBorder(Colors.BORDER), "Additional Information"));
sp.setPreferredSize(new Dimension(1, 175)); //width is ignored by border layout...
JScrollBar sb = sp.getVerticalScrollBar();

View file

@ -37,7 +37,6 @@ import docking.widgets.filechooser.GhidraFileChooserMode;
import docking.widgets.label.GDLabel;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GThemeDefaults.Colors.Messages;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.framework.plugintool.PluginTool;
import ghidra.framework.preferences.Preferences;
import ghidra.util.HelpLocation;
@ -60,8 +59,6 @@ class EditPluginPathDialog extends DialogComponentProvider {
static final String ADD_DIR_BUTTON_TEXT = "Add Dir ...";
static final String ADD_JAR_BUTTON_TEXT = "Add Jar ...";
private final static Color INVALID_PATH_COLOR = Tables.FG_ERROR_UNSELECTED;
private final static Color INVALID_SELECTED_PATH_COLOR = Tables.FG_ERROR_SELECTED;
private final static Color STATUS_MESSAGE_COLOR = Messages.NORMAL;
final static String EMPTY_STATUS = " ";
@ -467,7 +464,7 @@ class EditPluginPathDialog extends DialogComponentProvider {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
boolean pathOK = new File(value).canRead();
if (!pathOK) {
setForeground(isSelected ? INVALID_SELECTED_PATH_COLOR : INVALID_PATH_COLOR);
setForeground(getErrorForegroundColor(isSelected));
}
return this;

View file

@ -22,7 +22,6 @@ import java.util.*;
import docking.widgets.table.*;
import docking.widgets.table.threaded.ThreadedTableModel;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.docking.settings.Settings;
import ghidra.framework.Application;
import ghidra.framework.plugintool.ServiceProvider;
@ -76,8 +75,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
@Override
protected TableColumnDescriptor<ExtensionDetails> createTableColumnDescriptor() {
TableColumnDescriptor<ExtensionDetails> descriptor =
new TableColumnDescriptor<>();
TableColumnDescriptor<ExtensionDetails> descriptor = new TableColumnDescriptor<>();
descriptor.addVisibleColumn(new ExtensionInstalledColumn(), INSTALLED_COL, true);
descriptor.addVisibleColumn(new ExtensionNameColumn(), NAME_COL, true);
@ -259,8 +257,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public String getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public String getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getName();
}
@ -289,8 +287,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public String getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public String getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getDescription();
}
@ -319,8 +317,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public String getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public String getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
String version = rowObject.getVersion();
@ -356,8 +354,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public Boolean getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public Boolean getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.isInstalled();
}
}
@ -379,8 +377,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public String getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public String getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getInstallPath();
}
}
@ -402,8 +400,8 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
@Override
public String getValue(ExtensionDetails rowObject, Settings settings,
Object data, ServiceProvider sp) throws IllegalArgumentException {
public String getValue(ExtensionDetails rowObject, Settings settings, Object data,
ServiceProvider sp) throws IllegalArgumentException {
return rowObject.getArchivePath();
}
}
@ -416,8 +414,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
ExtensionDetails extension = getSelectedExtension(data.getRowViewIndex());
if (!isValidVersion(extension)) {
comp.setForeground(
data.isSelected() ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
comp.setForeground(getErrorForegroundColor(data.isSelected()));
}
return comp;

View file

@ -27,6 +27,7 @@ import docking.widgets.HyperlinkComponent;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.*;
import generic.theme.*;
import generic.theme.GThemeDefaults.Colors;
import ghidra.framework.plugintool.PluginConfigurationModel;
import ghidra.framework.plugintool.PluginTool;
import ghidra.framework.plugintool.util.*;
@ -130,7 +131,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
initializeLabelSection();
initializeDescriptionSection();
setBorder(BorderFactory.createLineBorder(GThemeDefaults.Colors.Java.BORDER));
setBorder(BorderFactory.createLineBorder(Colors.BORDER));
updateCheckBoxState();
}

View file

@ -28,7 +28,7 @@ import docking.DialogComponentProvider;
import docking.action.DockingAction;
import docking.action.DockingActionIf;
import docking.widgets.fieldpanel.FieldPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.clipboard.*;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.codebrowser.CodeViewerProvider;
@ -75,7 +75,7 @@ public class ClipboardPluginScreenShots extends GhidraScreenShotGenerator {
captureListingCallMnemonic(start, end);
placeImagesSideBySide(image, menuImage);
drawBorder(Java.BORDER);
drawBorder(Colors.BORDER);
}
private void cropCopyMenu() {

View file

@ -29,7 +29,6 @@ import org.junit.Test;
import docking.DockableComponent;
import docking.widgets.fieldpanel.FieldPanel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.GhidraOptions;
import ghidra.app.cmd.comments.SetCommentCmd;
@ -74,7 +73,7 @@ public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator {
Rectangle cursor = getCursorBounds();
captureListingRange(0x0040be40, 0x0040be56, 600);
drawBorder(Java.BORDER);
drawBorder(Colors.BORDER);
drawTextWithArrowNearOpenStructureIcon("Closed", cursor);
@ -95,7 +94,7 @@ public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator {
Rectangle cursor = getCursorBounds();
captureListingRange(0x0040be40, 0x0040be56, 600);
drawBorder(Java.BORDER);
drawBorder(Colors.BORDER);
drawTextWithArrowNearOpenStructureIcon("Open", cursor);
}

View file

@ -37,7 +37,6 @@ import docking.widgets.OptionDialog;
import docking.widgets.table.GTable;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.framework.Application;
import ghidra.framework.LoggingInitialization;
@ -138,7 +137,7 @@ public class ToolScreenShots extends GhidraScreenShotGenerator {
tool.executeBackgroundCommand(new DummyBackgroundCommand(), program);
Border inner = BorderFactory.createRaisedBevelBorder();
Border outer = BorderFactory.createLineBorder(Java.BORDER);
Border outer = BorderFactory.createLineBorder(Colors.BORDER);
statusBar.setBorder(BorderFactory.createCompoundBorder(outer, inner));
captureComponent(statusBar);
program.endTransaction(id, false);