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

@ -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;
@ -47,13 +46,13 @@ import utilities.util.FileUtilities;
* - Archive directory (hidden)
* </pre>
* <p>
* All columns are for display purposes only, except for the <code>installed</code> column, which
* is a checkbox allowing users to install/uninstall a particular extension.
*
* All columns are for display purposes only, except for the <code>installed</code> column, which
* is a checkbox allowing users to install/uninstall a particular extension.
*
*/
class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
/** We don't care about the ordering of other columns, but the install/uninstall checkbox should be
/** We don't care about the ordering of other columns, but the install/uninstall checkbox should be
the first one and the name col is our initial sort column. */
final static int INSTALLED_COL = 0;
final static int NAME_COL = 1;
@ -66,7 +65,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
/**
* Constructor.
*
*
* @param serviceProvider the tool providing the extensions table
*/
protected ExtensionTableModel(ServiceProvider 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);
@ -105,7 +103,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
return false;
}
// Do not allow GUI uninstallation of extensions manually installed in installation
// Do not allow GUI uninstallation of extensions manually installed in installation
// directory
if (extension.getInstallPath() != null && FileUtilities.isPathContainedWithin(
Application.getApplicationLayout().getApplicationInstallationDir().getFile(false),
@ -125,12 +123,12 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
super.setValueAt(aValue, rowIndex, columnIndex);
// We only care about the install column here, as it's the only one that
// is editable.
// is editable.
if (columnIndex != INSTALLED_COL) {
return;
}
// If the user does not have write permissions on the installation dir, they cannot
// If the user does not have write permissions on the installation dir, they cannot
// install.
ResourceFile installDir =
Application.getApplicationLayout().getExtensionInstallationDirs().get(0);
@ -202,7 +200,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
/**
* Returns true if the model has changed as a result of installing or uninstalling an extension
*
*
* @return true if the model has changed as a result of installing or uninstalling an extension
*/
public boolean hasModelChanged() {
@ -211,7 +209,7 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
/**
* Replaces the table model data with the given list.
*
*
* @param model the list to use as the model
*/
public void setModelData(List<ExtensionDetails> model) {
@ -228,11 +226,11 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
}
/**
* Returns the selected extension.
* Returns the selected extension.
* <p>
* Note that this table is single-selection only, so this will only
* ever return 1 item.
*
*
* @param row the selected row
* @return the selected extension, or null if nothing is selected
*/
@ -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();
}