mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-1981 - Theming - Project Module
This commit is contained in:
parent
780d4b7671
commit
2f453099ba
23 changed files with 189 additions and 166 deletions
|
@ -1,15 +0,0 @@
|
|||
// TODO using this now as a placeholder for a palette/swatch
|
||||
|
||||
[Defaults]
|
||||
|
||||
|
||||
color.palette.material.primary = #6200EE
|
||||
color.palette.material.primary.variant = #3700B3
|
||||
color.palette.material.secondary = #03DAC6
|
||||
color.palette.material.secondary.variant = #018786
|
||||
|
||||
[Dark Defaults]
|
||||
|
||||
color.palette.material.primary = #BB86FC
|
||||
color.palette.material.secondary = #03DAC6
|
||||
color.palette.material.secondary.variant = #018786
|
|
@ -36,10 +36,8 @@ color.palette.white = white
|
|||
|
||||
[Dark Defaults]
|
||||
|
||||
// TODO replace values above with dark values
|
||||
#color.palette.black = lightgray
|
||||
#color.palette.yellow = rgb(191, 191, 64) // olive
|
||||
|
||||
color.palette.cyan = #00CCCC // less harsh
|
||||
color.palette.black = lightgray
|
||||
color.palette.blue = deepskyblue
|
||||
color.palette.cyan = #00CCCC // less harsh
|
||||
color.palette.yellow = rgb(191, 191, 64) // olive
|
||||
color.palette.magenta = plum
|
|
@ -38,6 +38,8 @@ color.bg.table.row = color.bg
|
|||
color.bg.table.row.alt = rgb(237,243,254)
|
||||
color.fg.table.uneditable.selected = yellow
|
||||
color.fg.table.uneditable.unselected = lightgray
|
||||
color.fg.table = color.fg
|
||||
color.fg.table.unselected = white
|
||||
color.fg.error.table.unselected = color.fg.error
|
||||
color.fg.error.table.selected = lightpink
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ public class GThemeDefaults {
|
|||
|
||||
public static class Ids {
|
||||
|
||||
public static final String COLOR_BG = "color.bg"; // TODO do we need this?; rename to use 'background'?
|
||||
|
||||
public static class Java {
|
||||
public static final String BORDER = "system.color.border"; // TODO
|
||||
}
|
||||
|
@ -49,7 +47,6 @@ public class GThemeDefaults {
|
|||
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 TOOLTIP_BACKGROUND = new GColor("color.bg.tooltip");
|
||||
//@formatter:on
|
||||
|
||||
|
@ -58,22 +55,21 @@ public class GThemeDefaults {
|
|||
}
|
||||
|
||||
public static class Tables {
|
||||
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");
|
||||
//@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 FG_UNSELECTED = new GColor("color.fg.table");
|
||||
public static final GColor FG_SELECTED = new GColor("color.fg.table.unselected");
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
public static class Dialogs {
|
||||
public static final GColor FG_MESSAGE_NORMAL =
|
||||
new GColor("color.fg.dialog.status.normal");
|
||||
public static final GColor FG_MESSAGE_ERROR =
|
||||
new GColor("color.fg.dialog.status.error");
|
||||
//@formatter:off
|
||||
public static final GColor FG_MESSAGE_NORMAL = new GColor("color.fg.dialog.status.normal");
|
||||
public static final GColor FG_MESSAGE_ERROR = new GColor("color.fg.dialog.status.error");
|
||||
//@formatter:on
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,23 +79,26 @@ public class GThemeDefaults {
|
|||
public static class Palette {
|
||||
|
||||
/** Transparent color */
|
||||
public static final Color NO_COLOR = new GColor("color.palette.nocolor");
|
||||
public static final Color NO_COLOR = palette("nocolor");
|
||||
|
||||
public static final GColor BLACK = new GColor("color.palette.black");
|
||||
public static final GColor BLUE = new GColor("color.palette.blue");
|
||||
public static final GColor CYAN = new GColor("color.palette.cyan");
|
||||
public static final GColor GOLD = new GColor("color.palette.gold");
|
||||
public static final GColor GRAY = new GColor("color.palette.gray");
|
||||
public static final GColor GREEN = new GColor("color.palette.green");
|
||||
public static final GColor LIGHT_GRAY = new GColor("color.palette.lightgray");
|
||||
public static final GColor LIME = new GColor("color.palette.lime");
|
||||
public static final GColor MAGENTA = new GColor("color.palette.magenta");
|
||||
public static final GColor ORANGE = new GColor("color.palette.orange");
|
||||
public static final GColor PINK = new GColor("color.palette.pink");
|
||||
public static final GColor RED = new GColor("color.palette.red");
|
||||
public static final GColor WHITE = new GColor("color.palette.white");
|
||||
public static final GColor YELLOW = new GColor("color.palette.yellow");
|
||||
public static final GColor BLACK = palette("black");
|
||||
public static final GColor BLUE = palette("blue");
|
||||
public static final GColor CYAN = palette("cyan");
|
||||
public static final GColor GOLD = palette("gold");
|
||||
public static final GColor GRAY = palette("gray");
|
||||
public static final GColor GREEN = palette("green");
|
||||
public static final GColor LIGHT_GRAY = palette("lightgray");
|
||||
public static final GColor LIME = palette("lime");
|
||||
public static final GColor MAGENTA = palette("magenta");
|
||||
public static final GColor ORANGE = palette("orange");
|
||||
public static final GColor PINK = palette("pink");
|
||||
public static final GColor RED = palette("red");
|
||||
public static final GColor WHITE = palette("white");
|
||||
public static final GColor YELLOW = palette("yellow");
|
||||
|
||||
private static GColor palette(String name) {
|
||||
return new GColor("color.palette." + name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@ public class TempColorUtils {
|
|||
return new Color(r, g, b);
|
||||
}
|
||||
|
||||
public static Color withAlpha(Color c, int a) {
|
||||
return new Color(c.getRed(), c.getGreen(), c.getBlue(), a);
|
||||
}
|
||||
|
||||
public static Color blend1(Color primary, Color secondary) {
|
||||
int red = (primary.getRed() * 2 + secondary.getRed()) / 3;
|
||||
int green = (primary.getGreen() * 2 + secondary.getGreen()) / 3;
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
[Defaults]
|
||||
|
||||
color.fg.extensionpanel.details.author = blue
|
||||
color.fg.extensionpanel.details.date = blue
|
||||
color.fg.extensionpanel.details.description = blue
|
||||
color.fg.extensionpanel.details.name = rgb(0, 204, 51)
|
||||
color.fg.extensionpanel.path = blue
|
||||
color.fg.extensionpanel.details.title = rgb(140, 0, 0)
|
||||
color.fg.extensionpanel.details.version = blue
|
||||
|
||||
color.fg.pluginpanel.name = color.fg
|
||||
color.fg.pluginpanel.description = gray
|
||||
|
||||
color.bg.panel.details = color.bg
|
||||
|
||||
color.fg.pluginpanel.details.title = maroon
|
||||
color.fg.pluginpanel.details.name.no.dependents = limeGreen
|
||||
color.fg.pluginpanel.details.name.has.dependents = red
|
||||
|
@ -21,13 +28,25 @@ color.border.pluginpanel = darkGray
|
|||
color.fg.plugin.installer.table.has.dependents = red
|
||||
color.fg.plugin.installer.table.has.dependents.selected = pink
|
||||
|
||||
color.bg.ghidra.file.data.version.icon.dark = #8282FF
|
||||
color.bg.ghidra.file.data.version.icon.light = #9F9FFF
|
||||
|
||||
color.bg.logviwer.table.debug = rgb(135, 191, 212)
|
||||
color.bg.logviwer.table.error = red
|
||||
color.bg.logviwer.table.fatal = firebrick
|
||||
color.bg.logviwer.table.info = rgb(225, 225, 225)
|
||||
color.bg.logviwer.table.trace = white
|
||||
color.bg.logviwer.table.warn = rgb(255, 236, 50)
|
||||
color.fg.logviewer.table = black
|
||||
color.fg.logviewer.table.selected = black
|
||||
|
||||
color.bg.project.access.panel.table.selection = lavender
|
||||
color.fg.project.access.panel.table.selection = black
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
||||
|
||||
|
||||
color.fg.pluginpanel.name = #d3d3d3 // LightGray
|
||||
color.fg.pluginpanel.description = #808080 // Gray
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import docking.dnd.GClipboard;
|
|||
import docking.dnd.StringTransferable;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
@ -116,7 +117,7 @@ public class AboutDomainObjectUtils {
|
|||
auxArea.setCaretPosition(0); // move cursor to BOF...
|
||||
JScrollPane sp = new JScrollPane(auxArea);
|
||||
sp.setBorder(BorderFactory.createTitledBorder(
|
||||
BorderFactory.createLineBorder(Color.black), "Additional Information"));
|
||||
BorderFactory.createLineBorder(Java.BORDER), "Additional Information"));
|
||||
sp.setPreferredSize(new Dimension(1, 175)); //width is ignored by border layout...
|
||||
|
||||
JScrollBar sb = sp.getVerticalScrollBar();
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.Icon;
|
|||
import db.DBHandle;
|
||||
import db.Field;
|
||||
import db.buffers.*;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.framework.client.ClientUtil;
|
||||
import ghidra.framework.client.NotConnectedException;
|
||||
import ghidra.framework.model.*;
|
||||
|
@ -1623,8 +1624,10 @@ public class GhidraFileData {
|
|||
if (item instanceof DatabaseItem) {
|
||||
BufferFile bufferFile = ((DatabaseItem) item).open();
|
||||
try {
|
||||
newParentData.getLocalFileSystem().createDatabase(pathname, targetName,
|
||||
FileIDFactory.createFileID(), bufferFile, null, contentType, true,
|
||||
newParentData.getLocalFileSystem()
|
||||
.createDatabase(pathname, targetName,
|
||||
FileIDFactory.createFileID(), bufferFile, null, contentType,
|
||||
true,
|
||||
monitor, user);
|
||||
}
|
||||
finally {
|
||||
|
@ -1634,7 +1637,8 @@ public class GhidraFileData {
|
|||
else if (item instanceof DataFileItem) {
|
||||
InputStream istream = ((DataFileItem) item).getInputStream();
|
||||
try {
|
||||
newParentData.getLocalFileSystem().createDataFile(pathname, targetName,
|
||||
newParentData.getLocalFileSystem()
|
||||
.createDataFile(pathname, targetName,
|
||||
istream, null, contentType, monitor);
|
||||
}
|
||||
finally {
|
||||
|
@ -1675,8 +1679,10 @@ public class GhidraFileData {
|
|||
return null; // TODO: not sure this can ever happen - IOException will probably occur instead
|
||||
}
|
||||
try {
|
||||
destFolderData.getLocalFileSystem().createDatabase(pathname, targetName,
|
||||
FileIDFactory.createFileID(), bufferFile, null, contentType, true, monitor,
|
||||
destFolderData.getLocalFileSystem()
|
||||
.createDatabase(pathname, targetName,
|
||||
FileIDFactory.createFileID(), bufferFile, null, contentType, true,
|
||||
monitor,
|
||||
user);
|
||||
}
|
||||
finally {
|
||||
|
@ -1808,8 +1814,10 @@ public class GhidraFileData {
|
|||
|
||||
class VersionIcon implements Icon {
|
||||
|
||||
private static Color VERSION_ICON_COLOR_DARK = new Color(0x82, 0x82, 0xff);
|
||||
private static Color VERSION_ICON_COLOR_LIGHT = new Color(0x9f, 0x9f, 0xff);
|
||||
private static Color VERSION_ICON_COLOR_DARK =
|
||||
new GColor("color.bg.ghidra.file.data.version.icon.dark");
|
||||
private static Color VERSION_ICON_COLOR_LIGHT =
|
||||
new GColor("color.bg.ghidra.file.data.version.icon.light");
|
||||
|
||||
private static final int WIDTH = 18;
|
||||
private static final int HEIGHT = 17;
|
||||
|
|
|
@ -35,6 +35,8 @@ import docking.widgets.filechooser.GhidraFileChooser;
|
|||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors.Dialogs;
|
||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
@ -57,9 +59,9 @@ 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 int SIDE_MARGIN = 5;
|
||||
private final static Color INVALID_PATH_COLOR = Color.red.brighter();
|
||||
private final static Color INVALID_SELECTED_PATH_COLOR = Color.pink;
|
||||
private final static Color STATUS_MESSAGE_COLOR = Color.blue.brighter();
|
||||
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 = Dialogs.FG_MESSAGE_NORMAL;
|
||||
final static String EMPTY_STATUS = " ";
|
||||
|
||||
private ExtensionFileFilter JAR_FILTER =
|
||||
|
|
|
@ -30,6 +30,7 @@ import docking.options.editor.ButtonPanelFactory;
|
|||
import docking.tool.ToolConstants;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.list.ListPanel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.framework.ToolUtils;
|
||||
import ghidra.framework.model.ToolTemplate;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
@ -174,7 +175,7 @@ class ImportGhidraToolsDialog extends DialogComponentProvider {
|
|||
while (itr.hasNext()) {
|
||||
tools[count] = itr.next();
|
||||
checkboxes[count] = new GCheckBox(tools[count], false);
|
||||
checkboxes[count].setBackground(Color.WHITE);
|
||||
checkboxes[count].setBackground(Colors.BACKGROUND);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.logging.log4j.core.config.Configuration;
|
|||
import docking.StatusBarSpacer;
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Dialogs;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.layout.HorizontalLayout;
|
||||
|
@ -95,7 +96,7 @@ public class LogPanel extends JPanel implements LogListener {
|
|||
public void messageLogged(String message, boolean isError) {
|
||||
|
||||
messageUpdater.run(() -> {
|
||||
label.setForeground(isError ? Color.RED : defaultColor);
|
||||
label.setForeground(isError ? Dialogs.FG_MESSAGE_ERROR : defaultColor);
|
||||
String text = message.replace("\n", " ");
|
||||
label.setText(text);
|
||||
label.setToolTipText(text);
|
||||
|
|
|
@ -28,6 +28,7 @@ import docking.widgets.checkbox.GCheckBox;
|
|||
import docking.widgets.list.GListCellRenderer;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.wizard.AbstractWizardJPanel;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.app.util.GenericHelpTopics;
|
||||
import ghidra.framework.client.RepositoryAdapter;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
@ -64,8 +65,10 @@ public class ProjectAccessPanel extends AbstractWizardJPanel {
|
|||
protected String repositoryName;
|
||||
protected HelpLocation helpLoc;
|
||||
|
||||
protected final Color SELECTION_BG_COLOR = new Color(204, 204, 255);
|
||||
protected final Color SELECTION_FG_COLOR = Color.BLACK;
|
||||
protected final Color SELECTION_BG_COLOR =
|
||||
new GColor("color.bg.project.access.panel.table.selection");
|
||||
protected final Color SELECTION_FG_COLOR =
|
||||
new GColor("color.fg.project.access.panel.table.selection");
|
||||
|
||||
protected PluginTool tool;
|
||||
|
||||
|
@ -174,10 +177,6 @@ public class ProjectAccessPanel extends AbstractWizardJPanel {
|
|||
return repositoryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the main gui panel, containing the known users, button, and user access
|
||||
* panels.
|
||||
*/
|
||||
protected void createMainPanel(String[] knownUsers, boolean anonymousServerAccessAllowed) {
|
||||
|
||||
JPanel mainPanel = new JPanel();
|
||||
|
@ -337,7 +336,6 @@ public class ProjectAccessPanel extends AbstractWizardJPanel {
|
|||
* Creates a new user access panel.
|
||||
*
|
||||
* @param user the current user
|
||||
* @param userList the list of users to display in the table
|
||||
*/
|
||||
UserAccessPanel(String user) {
|
||||
setLayout(new BorderLayout());
|
||||
|
@ -383,8 +381,8 @@ public class ProjectAccessPanel extends AbstractWizardJPanel {
|
|||
|
||||
List<String> users = new ArrayList<>();
|
||||
int[] selectedRows = table.getSelectedRows();
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
User user = tableModel.getRowObject(selectedRows[i]);
|
||||
for (int selectedRow : selectedRows) {
|
||||
User user = tableModel.getRowObject(selectedRow);
|
||||
users.add(user.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.event.ListSelectionListener;
|
|||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.framework.model.ToolConnection;
|
||||
import ghidra.framework.model.ToolManager;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
@ -343,7 +344,7 @@ class ToolConnectionPanel extends JPanel implements ListSelectionListener {
|
|||
for (int i = 0; i < checkboxes.length; i++) {
|
||||
|
||||
checkboxes[i] = new GCheckBox(eventNames[i]);
|
||||
checkboxes[i].setBackground(Color.white);
|
||||
checkboxes[i].setBackground(Colors.BACKGROUND);
|
||||
|
||||
boolean isConnected = tc.isConnected(eventNames[i]);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ import javax.swing.CellRendererPane;
|
|||
import javax.swing.table.*;
|
||||
|
||||
import docking.widgets.table.GTable;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.framework.main.datatree.DataTreeDragNDropHandler;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
|
||||
|
@ -172,10 +174,9 @@ public class ProjectDataTableDnDHandler implements DragSourceListener, DragGestu
|
|||
Graphics2D g2 = (Graphics2D) graphics;
|
||||
GradientPaint mask;
|
||||
Color treeBackground = table.getBackground();
|
||||
Color transparentTreeBackground = new Color(treeBackground.getRed(),
|
||||
treeBackground.getGreen(), treeBackground.getBlue(), 200);
|
||||
Color transparentTreeBackground = TempColorUtils.withAlpha(treeBackground, 200);
|
||||
mask = new GradientPaint(0, 0, transparentTreeBackground, 0, size.height >> 1,
|
||||
new Color(1.0f, 1.0f, 1.0f, 0.0f));
|
||||
Palette.NO_COLOR);
|
||||
g2.setPaint(mask);
|
||||
|
||||
// Sets the alpha composite
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.logging.log4j.Level;
|
|||
|
||||
import docking.widgets.table.GTableCellRenderer;
|
||||
import docking.widgets.table.GTableCellRenderingData;
|
||||
import generic.theme.GColor;
|
||||
|
||||
/**
|
||||
* Renderer for the {@link FVTable} that will set the background color based on
|
||||
|
@ -30,12 +31,14 @@ import docking.widgets.table.GTableCellRenderingData;
|
|||
*/
|
||||
public class LogLevelTableCellRenderer extends GTableCellRenderer {
|
||||
|
||||
private static final Color TRACE_COLOR = Color.WHITE;
|
||||
private static final Color DEBUG_COLOR = new Color(135, 191, 212);
|
||||
private static final Color INFO_COLOR = new Color(225, 225, 225);
|
||||
private static final Color WARN_COLOR = new Color(255, 236, 50);
|
||||
private static final Color ERROR_COLOR = Color.RED;
|
||||
private static final Color FATAL_COLOR = Color.RED.darker();
|
||||
private static final Color TRACE_COLOR = new GColor("color.bg.logviwer.table.trace");
|
||||
private static final Color DEBUG_COLOR = new GColor("color.bg.logviwer.table.debug");
|
||||
private static final Color INFO_COLOR = new GColor("color.bg.logviwer.table.info");
|
||||
private static final Color WARN_COLOR = new GColor("color.bg.logviwer.table.warn");
|
||||
private static final Color ERROR_COLOR = new GColor("color.bg.logviwer.table.error");
|
||||
private static final Color FATAL_COLOR = new GColor("color.bg.logviwer.table.fatal");
|
||||
private static final Color FG = new GColor("color.fg.logviewer.table");
|
||||
private static final Color FG_SELECTED = new GColor("color.fg.logviewer.table.selected");
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||
|
@ -44,7 +47,7 @@ public class LogLevelTableCellRenderer extends GTableCellRenderer {
|
|||
|
||||
Object value = data.getValue();
|
||||
|
||||
setForeground(Color.black);
|
||||
setForeground(data.isSelected() ? FG_SELECTED : FG);
|
||||
|
||||
if (value.toString().equalsIgnoreCase(Level.DEBUG.toString())) {
|
||||
setBackground(DEBUG_COLOR);
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.awt.Point;
|
|||
import javax.swing.text.SimpleAttributeSet;
|
||||
|
||||
import docking.widgets.table.threaded.ThreadedTableModelListener;
|
||||
import generic.theme.GColor;
|
||||
|
||||
/**
|
||||
* Panel that shows information about the selected extension in the {@link ExtensionTablePanel}. This
|
||||
|
@ -30,6 +31,17 @@ import docking.widgets.table.threaded.ThreadedTableModelListener;
|
|||
*/
|
||||
class ExtensionDetailsPanel extends AbstractDetailsPanel {
|
||||
|
||||
private static final Color FG_COLOR_AUTHOR =
|
||||
new GColor("color.fg.extensionpanel.details.author");
|
||||
private static final Color FG_COLOR_DATE = new GColor("color.fg.extensionpanel.details.date");
|
||||
private static final Color FG_COLOR_DESCRIPTION =
|
||||
new GColor("color.fg.extensionpanel.details.description");
|
||||
private static final Color FG_COLOR_NAME = new GColor("color.fg.extensionpanel.details.name");
|
||||
private static final Color FG_COLOR_PATH = new GColor("color.fg.extensionpanel.path");
|
||||
private static final Color FG_COLOR_TITLE = new GColor("color.fg.extensionpanel.details.title");
|
||||
private static final Color FG_COLOR_VERSION =
|
||||
new GColor("color.fg.extensionpanel.details.version");
|
||||
|
||||
/** Attribute sets define the visual characteristics for each field */
|
||||
private SimpleAttributeSet nameAttrSet;
|
||||
private SimpleAttributeSet descrAttrSet;
|
||||
|
@ -120,12 +132,12 @@ class ExtensionDetailsPanel extends AbstractDetailsPanel {
|
|||
|
||||
@Override
|
||||
protected void createFieldAttributes() {
|
||||
titleAttrSet = createAttributeSet(new Color(140, 0, 0));
|
||||
nameAttrSet = createAttributeSet(new Color(0, 204, 51));
|
||||
descrAttrSet = createAttributeSet(Color.BLUE);
|
||||
authorAttrSet = createAttributeSet(Color.BLUE);
|
||||
createdOnAttrSet = createAttributeSet(Color.BLUE);
|
||||
versionAttrSet = createAttributeSet(Color.BLUE);
|
||||
pathAttrSet = createAttributeSet(Color.BLUE);
|
||||
titleAttrSet = createAttributeSet(FG_COLOR_TITLE);
|
||||
nameAttrSet = createAttributeSet(FG_COLOR_NAME);
|
||||
descrAttrSet = createAttributeSet(FG_COLOR_DESCRIPTION);
|
||||
authorAttrSet = createAttributeSet(FG_COLOR_AUTHOR);
|
||||
createdOnAttrSet = createAttributeSet(FG_COLOR_DATE);
|
||||
versionAttrSet = createAttributeSet(FG_COLOR_VERSION);
|
||||
pathAttrSet = createAttributeSet(FG_COLOR_PATH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.framework.plugintool.dialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
@ -23,6 +22,7 @@ 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;
|
||||
|
@ -415,17 +415,14 @@ class ExtensionTableModel extends ThreadedTableModel<ExtensionDetails, Object> {
|
|||
Component comp = super.getTableCellRendererComponent(data);
|
||||
|
||||
ExtensionDetails extension = getSelectedExtension(data.getRowViewIndex());
|
||||
if (data.isSelected()) {
|
||||
comp.setForeground(Color.WHITE);
|
||||
}
|
||||
else {
|
||||
if (isValidVersion(extension) || SystemUtilities.isInDevelopmentMode()) {
|
||||
comp.setForeground(Color.BLACK);
|
||||
comp.setForeground(data.isSelected() ? Tables.FG_SELECTED : Tables.FG_UNSELECTED);
|
||||
}
|
||||
else {
|
||||
comp.setForeground(Color.RED);
|
||||
}
|
||||
comp.setForeground(
|
||||
data.isSelected() ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
|
||||
}
|
||||
|
||||
return comp;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.framework.plugintool.dialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -25,6 +24,7 @@ import docking.DialogComponentProvider;
|
|||
import docking.action.*;
|
||||
import docking.tool.ToolConstants;
|
||||
import docking.widgets.OptionDialog;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.GenericHelpTopics;
|
||||
import ghidra.framework.main.AppInfo;
|
||||
import ghidra.framework.plugintool.PluginConfigurationModel;
|
||||
|
@ -55,7 +55,7 @@ public class ManagePluginsDialog extends DialogComponentProvider {
|
|||
this.pluginConfigurationModel = pluginConfigurationModel;
|
||||
pluginComponent = new PluginManagerComponent(tool, pluginConfigurationModel);
|
||||
JScrollPane scrollPane = new JScrollPane(pluginComponent);
|
||||
scrollPane.getViewport().setBackground(Color.white);
|
||||
scrollPane.getViewport().setBackground(Colors.BACKGROUND);
|
||||
scrollPane.getViewport().setViewPosition(new Point(0, 0));
|
||||
addWorkPanel(scrollPane);
|
||||
createActions(addSaveActions);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.framework.plugintool.dialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
|
@ -24,13 +23,14 @@ import javax.swing.border.Border;
|
|||
|
||||
import docking.util.image.ToolIconURL;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
class ToolIconUrlRenderer extends GListCellRenderer<ToolIconURL> {
|
||||
private Border emptyBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
|
||||
private Border blueLineBorder = BorderFactory.createLineBorder(Color.BLUE, 2);
|
||||
private Border emptyBlueBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
|
||||
private Border blueCompoundBorder =
|
||||
BorderFactory.createCompoundBorder(emptyBlueBorder, blueLineBorder);
|
||||
private Border selectedBorder = BorderFactory.createLineBorder(Palette.BLUE, 2);
|
||||
private Border emptySelectedBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
|
||||
private Border selectedCompoundBorder =
|
||||
BorderFactory.createCompoundBorder(emptySelectedBorder, selectedBorder);
|
||||
|
||||
ToolIconUrlRenderer() {
|
||||
setBorder(emptyBorder);
|
||||
|
@ -49,7 +49,7 @@ class ToolIconUrlRenderer extends GListCellRenderer<ToolIconURL> {
|
|||
// lie to our parent about the selected status to disable the background selection color
|
||||
super.getListCellRendererComponent(list, toolIconUrl, index, false, cellHasFocus);
|
||||
setIcon(toolIconUrl.getIcon());
|
||||
setBorder(isSelected ? blueCompoundBorder : emptyBorder);
|
||||
setBorder(isSelected ? selectedCompoundBorder : emptyBorder);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,13 @@
|
|||
*/
|
||||
package ghidra.framework.task.gui;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.framework.task.GTaskManager;
|
||||
import ghidra.framework.task.GTaskResult;
|
||||
import resources.Icons;
|
||||
|
@ -55,7 +57,7 @@ public class GTaskResultPanel extends JPanel {
|
|||
public Component getListCellRendererComponent(JList<? extends GTaskResultInfo> list,
|
||||
GTaskResultInfo value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
setIcon(getIcon(value.getResult()));
|
||||
setBackground(Color.white);
|
||||
setBackground(Colors.BACKGROUND);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,16 +15,18 @@
|
|||
*/
|
||||
package ghidra.framework.task.gui.taskview;
|
||||
|
||||
import ghidra.framework.task.GScheduledTask;
|
||||
import ghidra.framework.task.GTaskGroup;
|
||||
import ghidra.framework.task.gui.GProgressBar;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
|
||||
import org.jdesktop.animation.timing.Animator;
|
||||
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.framework.task.GScheduledTask;
|
||||
import ghidra.framework.task.GTaskGroup;
|
||||
import ghidra.framework.task.gui.GProgressBar;
|
||||
|
||||
public abstract class AbstractTaskInfo implements Comparable<AbstractTaskInfo> {
|
||||
private final boolean useAnimation;
|
||||
private Animator backgroundAnimator;
|
||||
|
@ -72,8 +73,8 @@ public abstract class AbstractTaskInfo implements Comparable<AbstractTaskInfo> {
|
|||
if (component == null) {
|
||||
component = new ScheduledTaskPanel(getLabelText(), getIndention());
|
||||
if (useAnimation) {
|
||||
Color startColor = Color.YELLOW;
|
||||
Color endColor = Color.white;
|
||||
Color startColor = Palette.YELLOW;
|
||||
Color endColor = Colors.BACKGROUND;
|
||||
backgroundAnimator =
|
||||
PropertySetter.createAnimator(4000, this, "Background", startColor, endColor);
|
||||
backgroundAnimator.start();
|
||||
|
@ -99,7 +100,7 @@ public abstract class AbstractTaskInfo implements Comparable<AbstractTaskInfo> {
|
|||
getComponent().addProgressBar();
|
||||
if (backgroundAnimator != null) {
|
||||
backgroundAnimator.stop();
|
||||
component.setBackground(Color.WHITE);
|
||||
component.setBackground(Colors.BACKGROUND);
|
||||
backgroundAnimator = null;
|
||||
}
|
||||
return getComponent().getProgressBar();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,13 +15,6 @@
|
|||
*/
|
||||
package ghidra.framework.task.gui.taskview;
|
||||
|
||||
import ghidra.framework.task.*;
|
||||
import ghidra.framework.task.gui.GProgressBar;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.task.CancelledListener;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
@ -34,6 +26,13 @@ import javax.swing.*;
|
|||
import org.jdesktop.animation.timing.*;
|
||||
|
||||
import docking.util.GraphicsUtils;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.framework.task.*;
|
||||
import ghidra.framework.task.gui.GProgressBar;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.task.CancelledListener;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
||||
/*
|
||||
* The TaskViewer manages a component for showing the running and waiting tasks of a GTaskManager.
|
||||
|
@ -45,10 +44,10 @@ public class TaskViewer {
|
|||
private static final int MIN_DELAY = 250;
|
||||
private static final int MAX_DELAY = 1000;
|
||||
|
||||
private Deque<AbstractTaskInfo> runningList = new LinkedList<AbstractTaskInfo>();
|
||||
private LinkedList<AbstractTaskInfo> waitingList = new LinkedList<AbstractTaskInfo>();
|
||||
private LinkedList<AbstractTaskInfo> scrollAwayList = new LinkedList<AbstractTaskInfo>();
|
||||
private Queue<Runnable> runnableQueue = new ConcurrentLinkedQueue<Runnable>();
|
||||
private Deque<AbstractTaskInfo> runningList = new LinkedList<>();
|
||||
private LinkedList<AbstractTaskInfo> waitingList = new LinkedList<>();
|
||||
private LinkedList<AbstractTaskInfo> scrollAwayList = new LinkedList<>();
|
||||
private Queue<Runnable> runnableQueue = new ConcurrentLinkedQueue<>();
|
||||
private SwingUpdateManager updateManager;
|
||||
private GTaskManager taskManager;
|
||||
private TaskViewerTaskListener taskListener;
|
||||
|
@ -70,24 +69,15 @@ public class TaskViewer {
|
|||
|
||||
buildComponent();
|
||||
taskListener = new TaskViewerTaskListener();
|
||||
updateComponentsRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateComponentsRunnable = () -> {
|
||||
while (!runnableQueue.isEmpty()) {
|
||||
Runnable runnable = runnableQueue.poll();
|
||||
runnable.run();
|
||||
}
|
||||
updateComponent();
|
||||
}
|
||||
};
|
||||
updateManager = new SwingUpdateManager(MIN_DELAY, MAX_DELAY, updateComponentsRunnable);
|
||||
animationRunnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
startScrollingAwayAnimation(0);
|
||||
}
|
||||
};
|
||||
animationRunnable = () -> startScrollingAwayAnimation(0);
|
||||
|
||||
completedTimingTarget = new TimingTargetAdapter() {
|
||||
@Override
|
||||
|
@ -270,7 +260,7 @@ public class TaskViewer {
|
|||
|
||||
Font font = new Font("Sanf Serif", Font.BOLD, 36);
|
||||
g.setFont(font);
|
||||
g.setColor(new Color(0, 0, 200));
|
||||
g.setColor(Palette.BLUE);
|
||||
if (messageDimension == null) {
|
||||
FontMetrics fontMetrics = getFontMetrics(font);
|
||||
messageDimension = fontMetrics.getStringBounds(TEXT, g2).getBounds();
|
||||
|
@ -331,19 +321,16 @@ public class TaskViewer {
|
|||
|
||||
@Override
|
||||
public void suspendedStateChanged(boolean isSuspended) {
|
||||
SystemUtilities.runSwingLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SystemUtilities.runSwingLater(() -> {
|
||||
layeredPane.invalidate();
|
||||
layeredPane.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private class InitializeRunnable implements Runnable {
|
||||
private GTaskGroup currentGroup;
|
||||
private List<GScheduledTask> scheduledTasks = new ArrayList<GScheduledTask>();
|
||||
private List<GScheduledTask> scheduledTasks = new ArrayList<>();
|
||||
private List<GScheduledTask> delayedTasks;
|
||||
private GScheduledTask runningTask;
|
||||
private List<TaskGroupScheduledRunnable> groupRunnables;
|
||||
|
@ -355,7 +342,7 @@ public class TaskViewer {
|
|||
runningTask = taskManager.getRunningTask();
|
||||
List<GTaskGroup> groups = taskManager.getScheduledGroups();
|
||||
|
||||
groupRunnables = new ArrayList<TaskGroupScheduledRunnable>();
|
||||
groupRunnables = new ArrayList<>();
|
||||
for (GTaskGroup gTaskGroup : groups) {
|
||||
groupRunnables.add(new TaskGroupScheduledRunnable(gTaskGroup));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,12 +15,14 @@
|
|||
*/
|
||||
package ghidra.framework.task.gui.taskview;
|
||||
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
|
||||
// This component is basically a JPanel that implements the Scrollable interface needed for the
|
||||
// TaskViewer.
|
||||
public class TaskViewerComponent extends JPanel implements Scrollable {
|
||||
|
@ -31,7 +32,7 @@ public class TaskViewerComponent extends JPanel implements Scrollable {
|
|||
|
||||
public TaskViewerComponent() {
|
||||
super(new VerticalLayout(0));
|
||||
setBackground(Color.WHITE);
|
||||
setBackground(Colors.BACKGROUND);
|
||||
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue