mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +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
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue