mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-25 02:57:57 +08:00
Merge remote-tracking branch 'origin/GP-5344-dragonmacher-front-end-tool-closing-fix'
This commit is contained in:
@@ -1104,17 +1104,21 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
|
||||
Tool tool = getTool();
|
||||
DockingWindowManager myDwm = tool.getWindowManager();
|
||||
boolean isFrustrated = isFrustrated();
|
||||
boolean isFocused = isFocused();
|
||||
if (isFocused && !isFrustrated) {
|
||||
// the user has decided to hide this component and is not madly clicking
|
||||
setVisible(false);
|
||||
// the user has decided to hide this component and is not madly clicking; also, we
|
||||
// don't allow the last component in a window to be closed in order to prevent an
|
||||
// empty window.
|
||||
if (!myDwm.isLastComponentInWindow(ComponentProvider.this)) {
|
||||
setVisible(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean emphasize = getComponent().isShowing() && isFrustrated;
|
||||
Tool tool = getTool();
|
||||
DockingWindowManager myDwm = tool.getWindowManager();
|
||||
myDwm.showComponent(ComponentProvider.this, true, emphasize);
|
||||
}
|
||||
|
||||
|
||||
@@ -478,6 +478,20 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
||||
return windowNode.getComponentCount() == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given provider is the last provider in its window.
|
||||
* @param provider the provider
|
||||
* @return true if the given provider is the last provider in its window.
|
||||
*/
|
||||
public boolean isLastComponentInWindow(ComponentProvider provider) {
|
||||
Window providerWindow = getProviderWindow(provider);
|
||||
WindowNode providerNode = root.getNodeForWindow(providerWindow);
|
||||
if (providerNode != null) {
|
||||
return providerNode.getComponentCount() == 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visible state of the set of docking windows.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user