mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-3550 - Fixed some theme foreground colors that were not updating
correctly
This commit is contained in:
parent
7a6ddc4992
commit
b87f8781e6
3 changed files with 28 additions and 27 deletions
|
@ -12,7 +12,8 @@ color.bg.version.tracking.dual.listing.highlight.markup.same = color.palette.lig
|
|||
color.bg.version.tracking.dual.listing.highlight.markup.conflict = color.palette.gold
|
||||
|
||||
color.bg.version.tracking.filter.formatted.field.error = color.palette.lightgray
|
||||
color.bg.version.tracking.filter.formatted.field.editing = color.palette.khaki
|
||||
color.bg.version.tracking.filter.formatted.field.editing = color.bg.filterfield
|
||||
color.fg.version.tracking.filter.formatted.field.editing = color.fg.filterfield
|
||||
|
||||
color.bg.version.tracking.match.table.locked.out = color.palette.aliceblue
|
||||
color.bg.version.tracking.match.table.markup.status.applied = color.palette.limegreen
|
||||
|
|
|
@ -23,20 +23,23 @@ import java.text.ParseException;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.InputVerifier;
|
||||
import javax.swing.JFormattedTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.feature.vt.gui.filters.Filter.FilterEditingStatus;
|
||||
import ghidra.util.SystemUtilities;
|
||||
|
||||
public class FilterFormattedTextField extends JFormattedTextField {
|
||||
private static final Color ERROR_BACKGROUND_COLOR =
|
||||
new GColor("color.bg.version.tracking.filter.formatted.field.error");
|
||||
protected static final Color EDITING_BACKGROUND_COLOR =
|
||||
private static final Color EDITING_BACKGROUND_COLOR =
|
||||
new GColor("color.bg.version.tracking.filter.formatted.field.editing");
|
||||
private static final String TEXT_FIELD_BACKGROUND_COLOR_KEY = "TextField.background";
|
||||
private static final Color EDITING_FOREGROUND_COLOR =
|
||||
new GColor("color.fg.version.tracking.filter.formatted.field.editing");
|
||||
|
||||
private Set<FilterStatusListener> listeners = new HashSet<>();
|
||||
|
||||
|
@ -74,6 +77,8 @@ public class FilterFormattedTextField extends JFormattedTextField {
|
|||
});
|
||||
|
||||
addPropertyChangeListener("value", evt -> editingFinished());
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
public void disableFocusEventProcessing() {
|
||||
|
@ -175,27 +180,22 @@ public class FilterFormattedTextField extends JFormattedTextField {
|
|||
}
|
||||
|
||||
private void update() {
|
||||
setBackground(getCurrentColor());
|
||||
filterStatusChanged(currentStatus);
|
||||
}
|
||||
|
||||
private Color getCurrentColor() {
|
||||
updateStatus();
|
||||
// if ( isError ) {
|
||||
// return ERROR_BACKGROUND_COLOR;
|
||||
// }
|
||||
// if ( isEdited() ) {
|
||||
// return EDITING_BACKGROUND_COLOR;
|
||||
// }
|
||||
|
||||
Color defaultColor = UIManager.getColor(TEXT_FIELD_BACKGROUND_COLOR_KEY);
|
||||
if (isError) {
|
||||
return ERROR_BACKGROUND_COLOR;
|
||||
setForeground(Colors.FOREGROUND);
|
||||
setBackground(ERROR_BACKGROUND_COLOR);
|
||||
}
|
||||
if (hasNonDefaultValue()) {
|
||||
return EDITING_BACKGROUND_COLOR;
|
||||
else if (hasNonDefaultValue()) {
|
||||
setForeground(EDITING_FOREGROUND_COLOR);
|
||||
setBackground(EDITING_BACKGROUND_COLOR);
|
||||
}
|
||||
return defaultColor;
|
||||
else { // default
|
||||
setForeground(Colors.FOREGROUND);
|
||||
setBackground(Colors.BACKGROUND);
|
||||
}
|
||||
|
||||
filterStatusChanged(currentStatus);
|
||||
}
|
||||
|
||||
private void updateStatus() {
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package ghidra.framework.main;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
@ -28,6 +29,7 @@ import docking.StatusBarSpacer;
|
|||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GIcon;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -39,14 +41,13 @@ import log.LogListener;
|
|||
import log.LogPanelAppender;
|
||||
|
||||
/**
|
||||
* A JPanel that contains a label to show the last message displayed. It also has a button to
|
||||
* show the Console.
|
||||
* A JPanel that contains a label to show the last message displayed. It also has a button to
|
||||
* show the Console.
|
||||
*/
|
||||
public class LogPanel extends JPanel implements LogListener {
|
||||
|
||||
private JButton button;
|
||||
private JLabel label;
|
||||
private Color defaultColor;
|
||||
|
||||
private BufferedSwingRunner messageUpdater = new BufferedSwingRunner();
|
||||
|
||||
|
@ -57,7 +58,6 @@ public class LogPanel extends JPanel implements LogListener {
|
|||
button = new EmptyBorderButton(new GIcon("icon.console"));
|
||||
label = new GDLabel();
|
||||
label.setName("Details");
|
||||
defaultColor = label.getForeground();
|
||||
panel.add(label, BorderLayout.CENTER);
|
||||
|
||||
JPanel eastPanel = new JPanel(new HorizontalLayout(0));
|
||||
|
@ -96,7 +96,7 @@ public class LogPanel extends JPanel implements LogListener {
|
|||
public void messageLogged(String message, boolean isError) {
|
||||
|
||||
messageUpdater.run(() -> {
|
||||
label.setForeground(isError ? Messages.ERROR : defaultColor);
|
||||
label.setForeground(isError ? Messages.ERROR : Colors.FOREGROUND);
|
||||
String text = message.replace("\n", " ");
|
||||
label.setText(text);
|
||||
label.setToolTipText(text);
|
||||
|
@ -105,7 +105,7 @@ public class LogPanel extends JPanel implements LogListener {
|
|||
|
||||
/**
|
||||
* Extracts the {@link LogPanelAppender} from the root logger configuration
|
||||
* and hands an instance of this panel to it.
|
||||
* and hands an instance of this panel to it.
|
||||
*/
|
||||
private void addLogAppender() {
|
||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue