mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-0 fixing fieldpanel test after blinking cusror change
This commit is contained in:
parent
3ec2dfb201
commit
9ec93ee41f
4 changed files with 32 additions and 10 deletions
|
@ -42,7 +42,7 @@ import docking.widgets.indexedscrollpane.IndexScrollListener;
|
||||||
import docking.widgets.indexedscrollpane.IndexedScrollable;
|
import docking.widgets.indexedscrollpane.IndexedScrollable;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import generic.theme.ThemeManager;
|
import generic.theme.Gui;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
|
|
||||||
public class FieldPanel extends JPanel
|
public class FieldPanel extends JPanel
|
||||||
|
@ -401,9 +401,7 @@ public class FieldPanel extends JPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeCursorBlinking() {
|
private void initializeCursorBlinking() {
|
||||||
ThemeManager themeManager = ThemeManager.getInstance();
|
setBlinkCursor(Gui.isBlinkingCursors());
|
||||||
boolean blinkingCursors = themeManager != null ? themeManager.isBlinkingCursors() : true;
|
|
||||||
setBlinkCursor(blinkingCursors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -220,4 +220,28 @@ public class Gui {
|
||||||
static void setThemeManager(ThemeManager manager) {
|
static void setThemeManager(ThemeManager manager) {
|
||||||
themeManager = manager;
|
themeManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets application's blinking cursor state. This will affect all JTextFields, JTextAreas,
|
||||||
|
* JTextPanes via {@link UIDefaults}. Custom components can also respect this setting by
|
||||||
|
* either adding a {@link ThemeListener} or overriding {@link JComponent#updateUI()}
|
||||||
|
* <P> NOTE: This method is a bit odd here as it doesn't really apply to a theme. But it
|
||||||
|
* requires manipulation of the look and feel which is managed by the theme. If other
|
||||||
|
* application level properties come along and also require changing the UIDefaults,
|
||||||
|
* perhaps a more general solution might be to add a way for clients to register a callback
|
||||||
|
* so that they get a chance to change the UIDefaults map as the look and feel is loaded.
|
||||||
|
* @param b true for blinking text cursors, false for non-blinking text cursors
|
||||||
|
*/
|
||||||
|
public static void setBlinkingCursors(boolean b) {
|
||||||
|
themeManager.setBlinkingCursors(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the application should allow blinking cursors, false otherwise. Custom
|
||||||
|
* components can use this method to determine if they should have a blinking cursor or not.
|
||||||
|
* @return true if the application should allow blinking cursors, false otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean isBlinkingCursors() {
|
||||||
|
return themeManager.isBlinkingCursors();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,8 +679,8 @@ public abstract class ThemeManager {
|
||||||
* so that they get a chance to change the UIDefaults map as the look and feel is loaded.
|
* so that they get a chance to change the UIDefaults map as the look and feel is loaded.
|
||||||
* @param b true for blinking text cursors, false for non-blinking text cursors
|
* @param b true for blinking text cursors, false for non-blinking text cursors
|
||||||
*/
|
*/
|
||||||
public void setBlinkingCursors(boolean b) {
|
protected void setBlinkingCursors(boolean b) {
|
||||||
throw new UnsupportedOperationException();
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -688,7 +688,7 @@ public abstract class ThemeManager {
|
||||||
* components can use this method to determine if they should have a blinking cursor or not.
|
* components can use this method to determine if they should have a blinking cursor or not.
|
||||||
* @return true if the application should allow blinking cursors, false otherwise.
|
* @return true if the application should allow blinking cursors, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isBlinkingCursors() {
|
protected boolean isBlinkingCursors() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import docking.util.AnimationUtils;
|
||||||
import docking.util.image.ToolIconURL;
|
import docking.util.image.ToolIconURL;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
import generic.theme.ThemeManager;
|
import generic.theme.Gui;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.util.GenericHelpTopics;
|
import ghidra.app.util.GenericHelpTopics;
|
||||||
|
@ -379,7 +379,7 @@ public class FrontEndTool extends PluginTool implements OptionsChangeListener {
|
||||||
shouldRestorePreviousProject = options.getBoolean(RESTORE_PREVIOUS_PROJECT_NAME, true);
|
shouldRestorePreviousProject = options.getBoolean(RESTORE_PREVIOUS_PROJECT_NAME, true);
|
||||||
|
|
||||||
boolean blink = options.getBoolean(BLINKING_CURSORS_OPTION_NAME, true);
|
boolean blink = options.getBoolean(BLINKING_CURSORS_OPTION_NAME, true);
|
||||||
ThemeManager.getInstance().setBlinkingCursors(blink);
|
Gui.setBlinkingCursors(blink);
|
||||||
|
|
||||||
options.addOptionsChangeListener(this);
|
options.addOptionsChangeListener(this);
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ public class FrontEndTool extends PluginTool implements OptionsChangeListener {
|
||||||
shouldRestorePreviousProject = (Boolean) newValue;
|
shouldRestorePreviousProject = (Boolean) newValue;
|
||||||
}
|
}
|
||||||
else if (BLINKING_CURSORS_OPTION_NAME.equals(optionName)) {
|
else if (BLINKING_CURSORS_OPTION_NAME.equals(optionName)) {
|
||||||
ThemeManager.getInstance().setBlinkingCursors((Boolean) newValue);
|
Gui.setBlinkingCursors((Boolean) newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue