From 15e923cc63ea4af1c85f343c84d43f2544cba963 Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:26:00 -0400 Subject: [PATCH] GP-2084: Add Tool.getStatusInfo --- .../java/docking/AbstractDockingTool.java | 18 +- .../java/docking/DockingWindowManager.java | 272 +++++++++++------- .../src/main/java/docking/RootNode.java | 18 +- .../Docking/src/main/java/docking/Tool.java | 130 ++++++--- 4 files changed, 273 insertions(+), 165 deletions(-) diff --git a/Ghidra/Framework/Docking/src/main/java/docking/AbstractDockingTool.java b/Ghidra/Framework/Docking/src/main/java/docking/AbstractDockingTool.java index ddacbc84d1..008f8bd558 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/AbstractDockingTool.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/AbstractDockingTool.java @@ -26,8 +26,7 @@ import ghidra.framework.options.ToolOptions; import ghidra.util.Swing; /** - * A partial implementation of {@link Tool} that serves as a place to share common - * functionality + * A partial implementation of {@link Tool} that serves as a place to share common functionality */ public abstract class AbstractDockingTool implements Tool { @@ -93,6 +92,11 @@ public abstract class AbstractDockingTool implements Tool { } } + @Override + public String getStatusInfo() { + return winMgr.getStatusText(); + } + @Override public void clearStatusInfo() { winMgr.setStatusText(""); @@ -185,12 +189,12 @@ public abstract class AbstractDockingTool implements Tool { } /** - * Set the menu group associated with a cascaded submenu. This allows - * a cascading menu item to be grouped with a specific set of actions. - * The default group for a cascaded submenu is the name of the submenu. + * Set the menu group associated with a cascaded submenu. This allows a cascading menu item to + * be grouped with a specific set of actions. The default group for a cascaded submenu is the + * name of the submenu. * - * @param menuPath menu name path where the last element corresponds - * to the specified group name. + * @param menuPath menu name path where the last element corresponds to the specified group + * name. * @param group group name * @see #setMenuGroup(String[], String, String) */ diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java index f06f1712ef..18b0d44d76 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java @@ -44,17 +44,17 @@ import ghidra.util.task.SwingUpdateManager; import util.CollectionUtils; /** - * Manages the "Docking" arrangement of a set of components and actions. The components can be "docked" - * together or exist in their own window. Actions can be associated with components so they + * Manages the "Docking" arrangement of a set of components and actions. The components can be + * "docked" together or exist in their own window. Actions can be associated with components so they * "move" with the component as it moved from one location to another. *

- * Components are added via ComponentProviders. A ComponentProvider is an interface for getting - * a component and its related information. The docking window manager will get the component - * from the provider as needed. It is up to the provider if it wants to reuse the component or - * recreate a new one when the component is requested. When the user hides a component (by using - * the x button on the component header), the docking window manager removes all - * knowledge of the component and will request it again from the provider if the component - * is again shown. The provider is also notified whenever a component is hidden and shown. + * Components are added via ComponentProviders. A ComponentProvider is an interface for getting a + * component and its related information. The docking window manager will get the component from the + * provider as needed. It is up to the provider if it wants to reuse the component or recreate a new + * one when the component is requested. When the user hides a component (by using the x button on + * the component header), the docking window manager removes all knowledge of the component and will + * request it again from the provider if the component is again shown. The provider is also notified + * whenever a component is hidden and shown. */ public class DockingWindowManager implements PropertyChangeListener, PlaceholderInstaller { @@ -65,8 +65,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * The owner name for docking windows actions. - *

Warning: Any action with this owner will get removed every time the 'Window' menu is - * rebuilt, with the exception if reserved key bindings. + *

+ * Warning: Any action with this owner will get removed every time the 'Window' menu is rebuilt, + * with the exception if reserved key bindings. */ public static final String DOCKING_WINDOWS_OWNER = "DockingWindows"; public static final String TOOL_PREFERENCES_XML_NAME = "PREFERENCES"; @@ -113,6 +114,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Constructs a new DockingWindowManager + * * @param tool the tool * @param images the images to use for windows in this window manager */ @@ -127,7 +129,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder * @param images the list of icons to set on the window * @param modal if true then the root window will be a modal dialog instead of a frame * @param isDocking true for normal operation, false to suppress docking support(removes - * component headers and window menu) + * component headers and window menu) * @param hasStatusBar if true a status bar will be created for the main window * @param factory the drop target factory */ @@ -161,6 +163,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Sets the help service for the all docking window managers. + * * @param helpSvc the help service to use. */ public static void setHelpService(HelpService helpSvc) { @@ -172,6 +175,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the global help service. + * * @return the global help service. */ public static HelpService getHelpService() { @@ -188,6 +192,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Get the docking window manager instance which corresponds to the specified window. + * * @param win the window for which to find its parent docking window manager. * @return docking window manager or null if unknown. */ @@ -221,8 +226,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * A convenience method for getting the window for component and then calling * {@link #getInstanceForWindow(Window)}. + * * @param component The component for which to get the associated {@link DockingWindowManager} - * instance. + * instance. * @return The {@link DockingWindowManager} instance associated with component */ public static synchronized DockingWindowManager getInstance(Component component) { @@ -240,6 +246,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the last active docking window manager which is visible. + * * @return the last active docking window manager which is visible. */ public static synchronized DockingWindowManager getActiveInstance() { @@ -260,6 +267,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns a new list of all DockingWindowManager instances know to exist. + * * @return a new list of all DockingWindowManager instances know to exist. */ public static synchronized List getAllDockingWindowManagers() { @@ -268,6 +276,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * The specified docking window manager has just become active + * * @param mgr the window manager that became active. */ static synchronized void setActiveManager(DockingWindowManager mgr) { @@ -277,9 +286,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Register a specific Help content URL for a component. - * The DocWinListener will be notified with the helpURL if the specified - * component 'c' has focus and the help key is pressed. + * Register a specific Help content URL for a component. The DocWinListener will be notified + * with the helpURL if the specified component 'c' has focus and the help key is pressed. + * * @param c component on which to set help. * @param helpLocation help content location */ @@ -288,8 +297,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Set the tool name which is displayed as the title - * for all windows. + * Set the tool name which is displayed as the title for all windows. + * * @param toolName tool name / title */ public void setToolName(String toolName) { @@ -298,6 +307,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Set the Icon for all windows. + * * @param icon image icon */ public void setIcon(ImageIcon icon) { @@ -328,6 +338,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the tool that owns this manager + * * @return the tool */ public Tool getTool() { @@ -336,6 +347,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the root window frame. + * * @return the root window frame. */ public JFrame getRootFrame() { @@ -347,6 +359,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Sets the provider that should get the default focus when no component has focus. + * * @param provider the provider that should get the default focus when no component has focus. */ public void setDefaultComponent(ComponentProvider provider) { @@ -355,6 +368,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Get the window that contains the specified Provider's component + * * @param provider component provider * @return window or null if component is not visible or not found */ @@ -368,6 +382,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Get the provider that contains the specified component + * * @param c the component * @return the provider; null if now containing provider is found */ @@ -390,6 +405,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the active window (or the root window if nobody has yet been made active). + * * @return the active window. */ public Window getActiveWindow() { @@ -402,6 +418,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the current active component. + * * @return the current active component. */ public Component getActiveComponent() { @@ -413,6 +430,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the component which has focus + * * @return the placeholder */ public ComponentPlaceholder getFocusedComponent() { @@ -432,8 +450,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Sets the visible state of the set of docking windows. - * @param state if true the main window and all sub-windows are set to be visible. If - * state is false, then all windows are set to be invisible. + * + * @param state if true the main window and all sub-windows are set to be visible. If state is + * false, then all windows are set to be invisible. */ public synchronized void setVisible(boolean state) { if (state != isVisible) { @@ -447,6 +466,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns true if the set of windows associated with this window manager are visible. + * * @return true if the set of windows associated with this window manager are visible. */ public boolean isVisible() { @@ -455,6 +475,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns true if the specified provider's component is visible + * * @param provider component provider * @return true if the specified provider's component is visible */ @@ -467,8 +488,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Adds a new component (via the provider) to be managed by this docking window manager. - * The component is initially hidden. + * Adds a new component (via the provider) to be managed by this docking window manager. The + * component is initially hidden. + * * @param provider the component provider */ public void addComponent(ComponentProvider provider) { @@ -476,8 +498,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Adds a new component (vial the provider) to be managed by this docking window manager. - * The component will be initially shown or hidden based on the the "show" parameter. + * Adds a new component (vial the provider) to be managed by this docking window manager. The + * component will be initially shown or hidden based on the the "show" parameter. + * * @param provider the component provider. * @param show indicates whether or not the component should be initially shown. */ @@ -512,8 +535,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Returns the ComponentProvider with the given name. If more than one provider exists with the name, - * one will be returned, but it could be any one of them. + * Returns the ComponentProvider with the given name. If more than one provider exists with the + * name, one will be returned, but it could be any one of them. + * * @param name the name of the provider to return. * @return a provider with the given name, or null if no providers with that name exist. */ @@ -549,7 +573,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Gets all components providers with a matching class. Some component providers will have + * Gets all components providers with a matching class. Some component providers will have * multiple instances in the tool * * @param clazz The class of the provider @@ -567,7 +591,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Returns the component provider that is the conceptual parent of the given component. More + * Returns the component provider that is the conceptual parent of the given component. More * precisely, this will return the component provider whose * {@link ComponentProvider#getComponent() component} is the parent of the given component. * @@ -595,9 +619,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Set whether a component's header should be shown; the header is the - * component that is dragged in order to move the component within the - * tool, or out of the tool into a separate window. + * Set whether a component's header should be shown; the header is the component that is dragged + * in order to move the component within the tool, or out of the tool into a separate window. + * * @param provider provider of the visible component in the tool * @param b true means to show the header */ @@ -638,6 +662,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the current subtitle for the component for the given provider. + * * @param provider the component provider of the component for which to get its subtitle. * @return the current subtitle for the component for the given provider. */ @@ -650,8 +675,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Removes the ComponentProvider (component) from the docking windows manager. The location - * of the window will be remember and reused if the provider is added back in later. + * Removes the ComponentProvider (component) from the docking windows manager. The location of + * the window will be remember and reused if the provider is added back in later. + * * @param provider the provider to be removed. */ public void removeComponent(ComponentProvider provider) { @@ -703,6 +729,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns any action that is bound to the given keystroke for the tool associated with this * DockingWindowManager instance. + * * @param keyStroke The keystroke to check for key bindings. * @return The action that is bound to the keystroke, or null of there is no binding for the * given keystroke. @@ -728,7 +755,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Hides or shows the component associated with the given provider. - *


+ *

+ *
* Note: This method will not show the given provider if it has not previously been * added via addComponent(...). * @@ -805,8 +833,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Releases all resources used by this docking window manager. Once the dispose method - * is called, no other calls to this object should be made. + * Releases all resources used by this docking window manager. Once the dispose method is + * called, no other calls to this object should be made. */ public synchronized void dispose() { if (root == null) { @@ -905,6 +933,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Generates a JDOM element object for saving the window managers state to XML. + * * @param rootXMLElement The root element to which to save XML data. */ public void saveToXML(Element rootXMLElement) { @@ -925,6 +954,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Save this docking window manager's window layout and positioning information as XML. + * * @return An XML element with the above information. */ public Element saveWindowingDataToXml() { @@ -933,6 +963,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Restores the docking window managers state from the XML information. + * * @param rootXMLElement JDOM element from which to extract the state information. */ public void restoreFromXML(Element rootXMLElement) { @@ -942,6 +973,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Restore to the docking window manager the layout and positioning information from XML. + * * @param rootXMLElement JDOM element from which to extract the state information. */ public void restoreWindowDataFromXml(Element rootXMLElement) { @@ -1010,8 +1042,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Sorts the active providers by window group. This ensures that the dependent window groups - * are loaded after their dependencies have been. + * Sorts the active providers by window group. This ensures that the dependent window groups are + * loaded after their dependencies have been. */ private List> sortActiveProviders( Map activeProviders) { @@ -1065,6 +1097,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Moves the component associated with the given source placeholder object from its current * docked location to its own window that will be anchored at the given point. + * * @param source the component placeholder containing the component to be moved. * @param p the location at which to create a new window for the component. */ @@ -1106,8 +1139,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Notifies the docking windows listener that the close button has been pressed on - * the main window frame. + * Notifies the docking windows listener that the close button has been pressed on the main + * window frame. */ void close() { tool.close(); @@ -1330,14 +1363,13 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Display an text edit box on top of the specified component. + * * @param defaultText initial text to be displayed in edit box * @param c component over which the edit box will be placed - * @param r specifies the bounds of the edit box relative to the - * component. The height is ignored. The default text field height - * is used as the preferred height. - * @param listener when the edit is complete, this listener is notified - * with the new text. The edit box is dismissed prior to notifying - * the listener. + * @param r specifies the bounds of the edit box relative to the component. The height is + * ignored. The default text field height is used as the preferred height. + * @param listener when the edit is complete, this listener is notified with the new text. The + * edit box is dismissed prior to notifying the listener. */ public void showEditWindow(String defaultText, Component c, Rectangle r, EditListener listener) { @@ -1603,9 +1635,10 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Adds a PreferenceState object to this window manager instance that is bound to the given - * key. When the state of the tool using this window manager is saved, then the mapped - * preferences will also be saved. + * Adds a PreferenceState object to this window manager instance that is bound to the given key. + * When the state of the tool using this window manager is saved, then the mapped preferences + * will also be saved. + * * @param key The key with which to store the preferences. * @param state The state object to store. * @see #getPreferenceState(String) @@ -1619,8 +1652,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Gets a preferences state object stored with the given key. The state objects are loaded - * from persistent storage when the tool using this window manager has its state loaded. + * Gets a preferences state object stored with the given key. The state objects are loaded from + * persistent storage when the tool using this window manager has its state loaded. + * * @param key The key with which to store the preferences. * @return the PrefrenceState object stored by the given key, or null if one does not exist * @see #putPreferenceState(String, PreferenceState) @@ -1631,6 +1665,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Removes the Preferences state for the given key. + * * @param key the key to the preference state to be removed */ public void removePreferenceState(String key) { @@ -1669,13 +1704,11 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Shows the dialog using the window containing the given componentProvider as its - * parent window + * Shows the dialog using the window containing the given componentProvider as its parent window * * @param dialogComponent the DialogComponentProvider object to be shown in a dialog. - * @param centeredOnProvider the component provider that is used to find a parent - * window for this dialog. The dialog is centered on this component - * provider's component. + * @param centeredOnProvider the component provider that is used to find a parent window for + * this dialog. The dialog is centered on this component provider's component. */ public void showDialog(DialogComponentProvider dialogComponent, ComponentProvider centeredOnProvider) { @@ -1688,15 +1721,14 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Shows the dialog using the given parent component to find a parent window and to - * position the dialog. If a Window can be found containing the given component, it - * will be used as the parent window for the dialog. If the component is null or not - * contained in a window, the current active window manager will be used to parent - * the dialog. If there are no active tools, then a frame will be created to parent - * the dialog. + * Shows the dialog using the given parent component to find a parent window and to position the + * dialog. If a Window can be found containing the given component, it will be used as the + * parent window for the dialog. If the component is null or not contained in a window, the + * current active window manager will be used to parent the dialog. If there are no active + * tools, then a frame will be created to parent the dialog. * * @param parent the component whose window over which the given dialog will be shown; null - * signals to use the active window + * signals to use the active window * @param dialogComponent the DialogComponentProvider object to be shown in a dialog. * @see #getParentWindow(Component) for parenting notes */ @@ -1705,19 +1737,19 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Shows the dialog using the given parent window using the optional component for - * positioning. + * Shows the dialog using the given parent window using the optional component for positioning. * - *

Warning: this method allows user to explicitly pass a parent window and component over - * which to be centered. There is no reason to use this method in the standard workflow. - * This method exists strictly to handle future unforeseen use cases. Use at your own - * risk of incorrectly parenting dialogs. + *

+ * Warning: this method allows user to explicitly pass a parent window and component over which + * to be centered. There is no reason to use this method in the standard workflow. This method + * exists strictly to handle future unforeseen use cases. Use at your own risk of incorrectly + * parenting dialogs. * - * @param parent the component whose window over which the given dialog will be shown; cannot - * be null + * @param parent the component whose window over which the given dialog will be shown; cannot be + * null * @param dialogComponent the DialogComponentProvider object to be shown in a dialog - * @param centeredOnComponent the component over which the dialog will be centered; cannot - * be null + * @param centeredOnComponent the component over which the dialog will be centered; cannot be + * null */ public static void showDialog(Window parent, DialogComponentProvider dialogComponent, Component centeredOnComponent) { @@ -1996,8 +2028,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Sets the icon for this window's 'home button'. This button, when pressed, - * will show the tool's main application window. + * Sets the icon for this window's 'home button'. This button, when pressed, will show the + * tool's main application window. * * @param icon the button's icon * @param callback the callback to execute when the button is pressed by the user @@ -2008,6 +2040,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns true if a status bar is present. + * * @return true if a status bar is present. */ public boolean hasStatusBar() { @@ -2015,14 +2048,13 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Add a new status item component to the status area. The preferred height and border - * for the component will be altered. The components preferred width will be - * preserved. + * Add a new status item component to the status area. The preferred height and border for the + * component will be altered. The components preferred width will be preserved. + * * @param c the status item component to add * @param addBorder True signals to add a border to the status area - * @param rightSide component will be added to the right-side of the status - * area if true, else it will be added immediately after the status text area - * if false. + * @param rightSide component will be added to the right-side of the status area if true, else + * it will be added immediately after the status text area if false. */ public void addStatusItem(JComponent c, boolean addBorder, boolean rightSide) { root.addStatusItem(c, addBorder, rightSide); @@ -2030,6 +2062,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Remove the specified status item. + * * @param c status component previously added. */ public void removeStatusItem(JComponent c) { @@ -2038,6 +2071,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Set the status text in the active component window + * * @param text status text */ public void setStatusText(String text) { @@ -2047,11 +2081,11 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Set the status text in the active component window - * - * @param text string to be displayed in the Status display area - * @param beep whether to beep or not - */ + * Set the status text in the active component window + * + * @param text string to be displayed in the Status display area + * @param beep whether to beep or not + */ public void setStatusText(String text, boolean beep) { if (root == null) { return; @@ -2063,6 +2097,15 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } } + /** + * Get the status text in the active component window + * + * @return string currently displayed in the Status display area + */ + public String getStatusText() { + return root.getStatusText(); + } + /** * A convenience method to make an attention-grabbing noise to the user */ @@ -2080,16 +2123,17 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Set the menu group associated with a cascaded submenu. This allows - * a cascading menu item to be grouped with a specific set of actions. + * Set the menu group associated with a cascaded submenu. This allows a cascading menu item to + * be grouped with a specific set of actions. *

* The default group for a cascaded submenu is the name of the submenu. *

* - * @param menuPath menu name path where the last element corresponds to the specified group name. + * @param menuPath menu name path where the last element corresponds to the specified group + * name. * @param group group name - * @param menuSubGroup the name used to sort the cascaded menu within other menu items at - * its level + * @param menuSubGroup the name used to sort the cascaded menu within other menu items at its + * level */ public void setMenuGroup(String[] menuPath, String group, String menuSubGroup) { actionToGuiMapper.setMenuGroup(menuPath, group, menuSubGroup); @@ -2097,8 +2141,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Tests if the given component is one of a known list of component classes that we - * don't ever want to get keyboard focus. Currently excluded is JScrollPane + * Tests if the given component is one of a known list of component classes that we don't ever + * want to get keyboard focus. Currently excluded is JScrollPane + * * @param c the component to test for exclusion * @return true if the component should not be allowed to have keyboard focus. */ @@ -2109,6 +2154,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Sets the mode such that all satellite docking windows always appear on top of the root window + * * @param windowsOnTop true to set mode to on top, false to disable on top mode. */ public void setWindowsOnTop(boolean windowsOnTop) { @@ -2118,6 +2164,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns true if the window mode is "satellite windows always on top of root window". + * * @return true if the window mode is "satellite windows always on top of root window". */ public boolean isWindowsOnTop() { @@ -2126,6 +2173,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns a list with all the windows in the windowStack. Used for testing. + * * @param includeMain if true, include the main root window. * @return a list with all the windows in the windowStack. Used for testing. */ @@ -2169,6 +2217,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the root window. + * * @return the root window. */ public Window getMainWindow() { @@ -2197,7 +2246,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Shows a popup menu over the given component. If this given component is not part of the + * Shows a popup menu over the given component. If this given component is not part of the * docking windows hierarchy, then no action is taken. * * @param component the component @@ -2238,8 +2287,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Adds the given popup action provider to this tool. This provider will be called each - * time the popup menu is about to be shown. + * Adds the given popup action provider to this tool. This provider will be called each time the + * popup menu is about to be shown. + * * @param provider the provider */ public void addPopupActionProvider(PopupActionProvider provider) { @@ -2248,6 +2298,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Removes the given popup action provider + * * @param provider the provider */ public void removePopupActionProvider(PopupActionProvider provider) { @@ -2255,9 +2306,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Returns a list of temporary popup actions to be returned. Only those actions which have - * a suitable popup menu path will be considered. This mechanism allows clients to - * add transient actions to be added to the tool without the accompanying management overhead. + * Returns a list of temporary popup actions to be returned. Only those actions which have a + * suitable popup menu path will be considered. This mechanism allows clients to add transient + * actions to be added to the tool without the accompanying management overhead. * * @param context the ActionContext * @return list of temporary actions @@ -2285,6 +2336,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * Returns the default action context for the tool + * * @return the default action context for the tool */ public ActionContext getDefaultToolContext() { @@ -2293,10 +2345,10 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Gets the {@link ActionContext} appropriate for the given action. This will normally - * be the context from the currently focused {@link ComponentProvider}. If that - * context is not valid for the given action and the action supports using the default - * tool context, then the default tool context will be returned. Otherwise, returns null. + * Gets the {@link ActionContext} appropriate for the given action. This will normally be the + * context from the currently focused {@link ComponentProvider}. If that context is not valid + * for the given action and the action supports using the default tool context, then the default + * tool context will be returned. Otherwise, returns null. * * @param action the action for which to get an {@link ActionContext} * @return the {@link ActionContext} appropriate for the given action or null @@ -2326,8 +2378,10 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder /** * This call will notify any context listeners that the context has changed. * - *

Our {@link #contextChanged(ComponentProvider)} method will eventually call back into this + *

+ * Our {@link #contextChanged(ComponentProvider)} method will eventually call back into this * method after any buffering has taken place. + * * @param context the context */ void doContextChanged(ActionContext context) { @@ -2337,8 +2391,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder } /** - * Registers a callback to be notified when the given component has been parented to - * a docking window manager + * Registers a callback to be notified when the given component has been parented to a docking + * window manager * * @param component the component that will be parented in a docking window system * @param listener the listener to be notified the component was parented @@ -2380,9 +2434,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder //================================================================================================== /** - * A class that tracks placeholders that are activated (brought to the front). If a - * placeholder is activated too frequently, this class will emphasize that window, under the - * assumption that the user doesn't see the window. + * A class that tracks placeholders that are activated (brought to the front). If a placeholder + * is activated too frequently, this class will emphasize that window, under the assumption that + * the user doesn't see the window. */ private class ActivatedInfo { diff --git a/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java b/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java index 89c4b38967..d77bebf246 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/RootNode.java @@ -52,9 +52,10 @@ class RootNode extends WindowNode { /** * Constructs a new root node for the given DockingWindowsManager. + * * @param mgr the DockingWindowsManager * @param toolName the name of the tool to be displayed in all the top-level windows. - * @param factory a factory for creating drop targets for this nodes windows; may be null + * @param factory a factory for creating drop targets for this nodes windows; may be null */ RootNode(DockingWindowManager mgr, String toolName, List images, boolean isModal, DropTargetFactory factory) { @@ -139,8 +140,8 @@ class RootNode extends WindowNode { } /** - * Set the tool name which is displayed as the title - * for all windows. + * Set the tool name which is displayed as the title for all windows. + * * @param toolName tool name / title */ void setToolName(String toolName) { @@ -176,6 +177,7 @@ class RootNode extends WindowNode { /** * Set the Icon for all windows. + * * @param icon image icon */ void setIcon(ImageIcon icon) { @@ -190,6 +192,7 @@ class RootNode extends WindowNode { /** * Sets the main frame and all sub windows visible state. + * * @param state true to show them, false to make them invisible. */ void setVisible(boolean state) { @@ -210,6 +213,7 @@ class RootNode extends WindowNode { /** * Creates a new sub-window for the given component a positions it at the given location. + * * @param info the component to be put in its own window. * @param loc the location for the new window. */ @@ -230,6 +234,7 @@ class RootNode extends WindowNode { /** * Adds the component to the main window. + * * @param info the component to be added. */ void add(ComponentPlaceholder info, WindowPosition initialPosition) { @@ -288,6 +293,7 @@ class RootNode extends WindowNode { /** * Get the window which contains the specified component. + * * @param info component info * @return window or null if component is not visible or not found. */ @@ -401,6 +407,7 @@ class RootNode extends WindowNode { /** * Returns the tool name of the tool. + * * @return the tool name of the tool. */ String getToolName() { @@ -445,6 +452,7 @@ class RootNode extends WindowNode { /** * Restores the component hierarchy from the given XML JDOM element. + * * @param root the XML from which to restore the state. */ List restoreFromXML(Element rootNodeElement) { @@ -585,6 +593,10 @@ class RootNode extends WindowNode { } } + public String getStatusText() { + return statusBar.getStatusText(); + } + public Window getMainWindow() { return windowWrapper.getWindow(); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/Tool.java b/Ghidra/Framework/Docking/src/main/java/docking/Tool.java index cb7f5cb014..92850732af 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/Tool.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/Tool.java @@ -27,55 +27,58 @@ import ghidra.framework.options.ToolOptions; import ghidra.framework.plugintool.ServiceProvider; /** - * Generic tool interface for managing {@link ComponentProvider}s and - * {@link DockingActionIf actions} + * Generic tool interface for managing {@link ComponentProvider}s and {@link DockingActionIf + * actions} */ public interface Tool extends ServiceProvider { /** - * Returns a combination of the tool name and the instance name of the form - * tool name(instance name), e.g., SomeTool(2) + * Returns a combination of the tool name and the instance name of the form tool name(instance + * name), e.g., SomeTool(2) + * * @return the tool name */ public String getName(); /** * Returns true if tool is visible + * * @return true if tool is visible */ public boolean isVisible(); /** - * Sets the tool visible or invisible. This method is used by - * the Project to make it's tools visible or invisible depending on whether - * this tool is in is the active workspace. + * Sets the tool visible or invisible. This method is used by the Project to make it's tools + * visible or invisible depending on whether this tool is in is the active workspace. * * @param visibility true specifies that the tool should be visible */ public void setVisible(boolean visibility); /** - * Brings this tool to the front. Places this tool at the top of the - * stacking order and shows it in front of any other tools. + * Brings this tool to the front. Places this tool at the top of the stacking order and shows it + * in front of any other tools. */ public void toFront(); /** * Get the icon that the tool is using + * * @return the icon that the tool is using */ public ImageIcon getIcon(); /** * Adds the ComponentProvider to the tool, optionally making it visible. + * * @param componentProvider the provider to add to the tool * @param show if true, the component is made visible. */ public void addComponentProvider(ComponentProvider componentProvider, boolean show); /** - * Removes the given ComponentProvider from the tool. When a provider has been removed - * from the tool it is considered disposed and should not be reused. + * Removes the given ComponentProvider from the tool. When a provider has been removed from the + * tool it is considered disposed and should not be reused. * * @param componentProvider the provider to remove from the tool */ @@ -91,51 +94,64 @@ public interface Tool extends ServiceProvider { /** * Set the status information + * * @param text non-html string to be displayed in the Status display area */ public void setStatusInfo(String text); /** - * Set the status information - * @param text string to be displayed in the Status display area - * @param beep whether to be or not - */ + * Set the status information + * + * @param text string to be displayed in the Status display area + * @param beep whether to be or not + */ public void setStatusInfo(String text, boolean beep); + /** + * Get the status information + * + * @return the string displayed in the Status area + */ + public String getStatusInfo(); + /** * Clear the status information */ public void clearStatusInfo(); /** - * Set the menu group associated with a cascaded submenu. This allows - * a cascading menu item to be grouped with a specific set of actions. + * Set the menu group associated with a cascaded submenu. This allows a cascading menu item to + * be grouped with a specific set of actions. *

* The default group for a cascaded submenu is the name of the submenu. *

* - * @param menuPath menu name path where the last element corresponds to the specified group name. + * @param menuPath menu name path where the last element corresponds to the specified group + * name. * @param group group name - * @param menuSubGroup the name used to sort the cascaded menu within other menu items at - * its level + * @param menuSubGroup the name used to sort the cascaded menu within other menu items at its + * level */ public void setMenuGroup(String[] menuPath, String group, String menuSubGroup); /** * Adds the action to the tool. + * * @param action the action to be added. */ public void addAction(DockingActionIf action); /** - * Removes the given action from the tool. When an action is removed from the tool it will - * be disposed and should not be reused. + * Removes the given action from the tool. When an action is removed from the tool it will be + * disposed and should not be reused. + * * @param action the action to be removed. */ public void removeAction(DockingActionIf action); /** * Adds the action to the given provider as a local action. + * * @param componentProvider the provider to add the action to. * @param action the DockingAction to add to the componentProvider. */ @@ -143,20 +159,23 @@ public interface Tool extends ServiceProvider { /** * Removes the action from the provider + * * @param componentProvider the component provider from which to remove the action. * @param action the action to remove. */ public void removeLocalAction(ComponentProvider componentProvider, DockingActionIf action); /** - * Adds the given popup action provider to this tool. This provider will be called each - * time the popup menu is about to be shown. + * Adds the given popup action provider to this tool. This provider will be called each time the + * popup menu is about to be shown. + * * @param provider the provider */ public void addPopupActionProvider(PopupActionProvider provider); /** * Removes the given popup action provider + * * @param provider the provider */ public void removePopupActionProvider(PopupActionProvider provider); @@ -164,9 +183,10 @@ public interface Tool extends ServiceProvider { /** * Return a set of all actions in the tool. * - *

Note: the result may contain conceptually duplicate actions, which is when multiple - * actions exist that share the same full name (the full name is the action name with the - * owner name, such as "My Action (MyPlugin)". + *

+ * Note: the result may contain conceptually duplicate actions, which is when multiple actions + * exist that share the same full name (the full name is the action name with the owner name, + * such as "My Action (MyPlugin)". * * @return set of all actions */ @@ -175,9 +195,10 @@ public interface Tool extends ServiceProvider { /** * Returns all actions for the given owner * - *

Note: the result may contain conceptually duplicate actions, which is when multiple - * actions exist that share the same full name (the full name is the action name with the - * owner name, such as "My Action (MyPlugin)". + *

+ * Note: the result may contain conceptually duplicate actions, which is when multiple actions + * exist that share the same full name (the full name is the action name with the owner name, + * such as "My Action (MyPlugin)". * * @param owner the action owner's name * @return the actions @@ -186,26 +207,30 @@ public interface Tool extends ServiceProvider { /** * Returns the active component provider, that which has focus + * * @return the active provider */ public ComponentProvider getActiveComponentProvider(); /** * Shows or hides the component provider in the tool + * * @param componentProvider the provider to either show or hide. * @param visible true to show the provider, false to hide it. */ public void showComponentProvider(ComponentProvider componentProvider, boolean visible); /** - * Shows the dialog using the tool's root frame as a parent. Also, remembers any size and location - * adjustments made by the user for the next time the dialog is shown. + * Shows the dialog using the tool's root frame as a parent. Also, remembers any size and + * location adjustments made by the user for the next time the dialog is shown. + * * @param dialogComponent the DialogComponentProvider object to be shown in a dialog. */ public void showDialog(DialogComponentProvider dialogComponent); /** * Returns the parent window for the given provider + * * @param componentProvider the provider * @return the window */ @@ -213,12 +238,14 @@ public interface Tool extends ServiceProvider { /** * Makes the given ComponentProvider move to the front if it is tabbed with other components. + * * @param componentProvider the provider to move to the top of its stacking order. */ public void toFront(ComponentProvider componentProvider); /** * Returns true if the given ComponentProvider is currently visible. + * * @param componentProvider the provider to check for visibility. * @return true if the given ComponentProvider is currently visible. */ @@ -227,22 +254,25 @@ public interface Tool extends ServiceProvider { /** * Returns true if the ComponentProvider is the currently active provider. The active provider * is the provider that has keyboard focus and provides the current action context. + * * @param componentProvider the provider to check for active. - * @return true if the ComponentProvider is the currently active provider. + * @return true if the ComponentProvider is the currently active provider. */ public boolean isActive(ComponentProvider componentProvider); /** * Indicates to the tool that the given componentProvider's title has changed. + * * @param componentProvider the componentProvider whose title has changed. */ public void updateTitle(ComponentProvider componentProvider); /** - * Signals to the tool that the provider's context has changed. This lets toolbar and - * menu actions update enablement based on current context. + * Signals to the tool that the provider's context has changed. This lets toolbar and menu + * actions update enablement based on current context. * - *

Pass null to signal that the entire tool's context has changed + *

+ * Pass null to signal that the entire tool's context has changed * * @param provider the provider whose context changed; null to signal the tool's context */ @@ -250,25 +280,29 @@ public interface Tool extends ServiceProvider { /** * Adds the given context listener to this tool + * * @param listener the listener to add */ public void addContextListener(DockingContextListener listener); /** * Removes the given context listener to this tool + * * @param listener the listener to add */ public void removeContextListener(DockingContextListener listener); /** * Returns the DockingWindowManger for this tool. + * * @return the DockingWindowManger for this tool. */ public DockingWindowManager getWindowManager(); /** - * Get the options for the given category name; if no options exist with - * the given name, then one is created. + * Get the options for the given category name; if no options exist with the given name, then + * one is created. + * * @param categoryName the category name * @return the options */ @@ -276,21 +310,24 @@ public interface Tool extends ServiceProvider { /** * Toggles the "change" state of the tool... + * * @param changed true indicates that the tool config has changed. */ public void setConfigChanged(boolean changed); /** * Return true if the tool's configuration has changed - * @return true if the tool's configuration has changed + * + * @return true if the tool's configuration has changed */ public boolean hasConfigChanged(); /** * Returns the class that manages actions for the tool. * - *

Most clients will not need to use this methods. Instead, actions should be added to - * the tool via {@link #addAction(DockingActionIf)} and + *

+ * Most clients will not need to use this methods. Instead, actions should be added to the tool + * via {@link #addAction(DockingActionIf)} and * {@link #addLocalAction(ComponentProvider, DockingActionIf)}. * * @return the action manager @@ -298,16 +335,17 @@ public interface Tool extends ServiceProvider { public DockingToolActions getToolActions(); /** - * Suggests the tool to attempt to close(). This will be as though the user - * selected the close menu option on the tool or hit the closeWindow x button in - * the upper corner (Windows systems). + * Suggests the tool to attempt to close(). This will be as though the user selected the close + * menu option on the tool or hit the closeWindow x button in the upper corner (Windows + * systems). */ public void close(); /** - * Returns the default {@link ActionContext} for the tool. The default context is the context + * Returns the default {@link ActionContext} for the tool. The default context is the context * the default ComponentProvider for the tool. - * @return the default {@link ActionContext} for the tool + * + * @return the default {@link ActionContext} for the tool */ public ActionContext getDefaultToolContext();