Merge remote-tracking branch 'origin/GP-1-dragonmacher-front-end-fix'

This commit is contained in:
Ryan Kurtz 2025-02-25 07:12:15 -05:00
commit 26d3c933e7
2 changed files with 13 additions and 4 deletions

View file

@ -206,13 +206,19 @@ class DockableToolBarManager {
@Override
public boolean isEnabledForContext(ActionContext context) {
DockingWindowManager dwm = DockingWindowManager.getActiveInstance();
ComponentProvider provider = context.getComponentProvider();
if (provider == null) {
// Some context providers do not specify the provider when creating a contexts
DockingWindowManager dwm = DockingWindowManager.getActiveInstance();
provider = dwm.getActiveComponentProvider();
}
return provider == dockableComponent.getComponentProvider();
if (provider != dockableComponent.getComponentProvider()) {
return false;
}
// don't allow the last component in a window to be closed to prevent an empty window
return !dwm.isLastComponentInWindow(provider);
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -56,6 +56,9 @@ public class ShowActionChooserDialogAction extends DockingAction {
private void showActionsDialog(Tool tool, DockingFrame frame, ActionContext context) {
ComponentProvider provider = tool.getWindowManager().getActiveComponentProvider();
if (provider == null) {
return; // this can happen if there is no active provider
}
ActionChooserDialog actionsDialog = new ActionChooserDialog(tool, provider, context);
tool.showDialog(actionsDialog);
}