GT-3179 - Help - review fixes

This commit is contained in:
dragonmacher 2019-10-07 17:34:31 -04:00
parent 05b23fb9b4
commit 982c63f488
3 changed files with 16 additions and 5 deletions

View file

@ -1830,7 +1830,11 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
Component c = parent; Component c = parent;
while (c != null) { while (c != null) {
if (c instanceof Window) { // Note: using a Frame here means that we will not find and use a dialog that is a
// parent of 'c' if it itself is parented to a Frame. The issue is that
// Use Case 'C' above may not work correctly. If we find that to be the case,
// then we can try changing 'Frame' to 'Window' here.
if (c instanceof Frame) {
return (Window) c; return (Window) c;
} }
c = c.getParent(); c = c.getParent();

View file

@ -222,7 +222,7 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
if (isValidAndEnabled(actionData, localContext)) { if (isValidAndEnabled(actionData, localContext)) {
list.add(new ExecutableKeyActionAdapter(actionData.action, localContext)); list.add(new ExecutableKeyActionAdapter(actionData.action, localContext));
} }
else if (isValidAndEnabled(actionData, globalContext)) { else if (isValidAndEnabledGlobally(actionData, globalContext)) {
list.add(new ExecutableKeyActionAdapter(actionData.action, globalContext)); list.add(new ExecutableKeyActionAdapter(actionData.action, globalContext));
} }
} }
@ -235,6 +235,11 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
return a.isValidContext(localContext) && a.isEnabledForContext(localContext); return a.isValidContext(localContext) && a.isEnabledForContext(localContext);
} }
private boolean isValidAndEnabledGlobally(ActionData actionData, ActionContext globalContext) {
DockingActionIf a = actionData.action;
return a.isValidGlobalContext(globalContext) && a.isEnabledForContext(globalContext);
}
@Override @Override
public boolean isReservedKeybindingPrecedence() { public boolean isReservedKeybindingPrecedence() {
return false; // MultipleKeyActions can never be reserved return false; // MultipleKeyActions can never be reserved

View file

@ -15,12 +15,12 @@
*/ */
package docking.help; package docking.help;
import java.awt.Component; import java.awt.*;
import java.awt.Rectangle;
import java.awt.event.*; import java.awt.event.*;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.List;
import java.util.regex.*; import java.util.regex.*;
import javax.help.*; import javax.help.*;
@ -34,6 +34,7 @@ import docking.DockingUtils;
import docking.DockingWindowManager; import docking.DockingWindowManager;
import docking.actions.KeyBindingUtils; import docking.actions.KeyBindingUtils;
import docking.widgets.*; import docking.widgets.*;
import generic.util.WindowUtilities;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.exception.AssertException; import ghidra.util.exception.AssertException;
import ghidra.util.task.*; import ghidra.util.task.*;
@ -232,7 +233,8 @@ class HelpViewSearcher {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DockingWindowManager.showDialog(htmlEditorPane, findDialog); Window helpWindow = WindowUtilities.windowForComponent(htmlEditorPane);
DockingWindowManager.showDialog(helpWindow, findDialog);
} }
} }