Ghidra is a software reverse engineering (SRE) framework
Minor event mask refactor
dragonmacher04ef00b4a306
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.javaindex c994e014a8..130d2039a8 100644--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java+++ b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java@@ -17,7 +17,8 @@ package ghidra.examples;import java.awt.BorderLayout;import java.awt.FlowLayout;-import java.awt.event.*;+import java.awt.event.KeyEvent;+import java.awt.event.MouseEvent;import javax.swing.*;@@ -66,7 +67,8 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {Icon icon = new GIcon("icon.sample.action.hello.world");action.setMenuBarData(new MenuData(new String[] { "Misc", "Hello World" }, icon));action.setKeyBindingData(- new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)));+ new KeyBindingData(+ KeyStroke.getKeyStroke(KeyEvent.VK_W, DockingUtils.CONTROL_KEY_MODIFIER_MASK)));// puts the action on the local toolbar.action.setToolBarData(new ToolBarData(icon));diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ViewInstructionDetailsAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ViewInstructionDetailsAction.javaindex 97910b13c5..fa72436d36 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ViewInstructionDetailsAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ViewInstructionDetailsAction.java@@ -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.@@ -23,6 +23,7 @@ import java.awt.event.KeyEvent;import javax.swing.*;import docking.DialogComponentProvider;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.widgets.fieldpanel.FieldPanel;@@ -45,7 +46,7 @@ public class ViewInstructionDetailsAction extends ListingContextAction {this.listingMergePanelPlugin = listingMergePanelPlugin;setPopupMenuData(new MenuData(new String[] { "View Instruction Details..." }, null,"ViewInstructionDetails"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK |+ setKeyBindingData(new KeyBindingData(KeyEvent.VK_R, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.SHIFT_DOWN_MASK));setEnabled(true);setDescription("Display a dialog indicating details, such as references, for the " +diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/AddBookmarkAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/AddBookmarkAction.javaindex 2a0e8ddb82..9ddea11034 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/AddBookmarkAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/AddBookmarkAction.java@@ -15,10 +15,10 @@*/package ghidra.app.plugin.core.bookmark;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import ghidra.app.context.ListingActionContext;import ghidra.program.model.address.Address;@@ -44,7 +44,8 @@ class AddBookmarkAction extends DockingAction {setDescription("Add Notes bookmark to current location");// ACTIONS - auto generatedsetPopupMenuData(new MenuData(new String[] { "Bookmark..." }, null, "Bookmark"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_D, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.javaindex bceb56c422..9e7e59a6a9 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java@@ -17,7 +17,6 @@ package ghidra.app.plugin.core.clipboard;import java.awt.Window;import java.awt.datatransfer.*;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.io.IOException;import java.util.*;@@ -402,7 +401,8 @@ public class ClipboardPlugin extends ProgramPluginsetPopupMenuData(new MenuData(new String[] { "Copy" }, "Clipboard"));setToolBarData(new ToolBarData(new GIcon("icon.plugin.clipboard.copy"),"Clipboard"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_C, DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation("ClipboardPlugin", "Copy"));clipboardService.customizeClipboardAction(this);}@@ -436,7 +436,8 @@ public class ClipboardPlugin extends ProgramPluginsetPopupMenuData(new MenuData(new String[] { "Paste" }, "Clipboard"));setToolBarData(new ToolBarData(new GIcon("icon.plugin.clipboard.paste"), "Clipboard"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_V, DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation("ClipboardPlugin", "Paste"));clipboardService.customizeClipboardAction(this);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/CloneCodeViewerAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/CloneCodeViewerAction.javaindex ffec11468f..faf41291fb 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/CloneCodeViewerAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/CloneCodeViewerAction.java@@ -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.@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import generic.theme.GIcon;import ghidra.app.context.ProgramActionContext;@@ -40,7 +41,7 @@ public class CloneCodeViewerAction extends DockingAction {setDescription("Create a snapshot (disconnected) copy of this Listing window ");setHelpLocation(new HelpLocation("Snapshots", "Snapshots_Start"));setKeyBindingData(new KeyBindingData(KeyEvent.VK_T,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));}@Overridediff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoNextFunctionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoNextFunctionAction.javaindex 246b1d0bf4..568ac6a7b9 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoNextFunctionAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoNextFunctionAction.java@@ -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.@@ -15,11 +15,11 @@*/package ghidra.app.plugin.core.codebrowser.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.KeyStroke;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.tool.ToolConstants;@@ -47,7 +47,8 @@ public class GotoNextFunctionAction extends NavigatableContextAction {null, "GoTo");menuData.setMenuSubGroup("za");setMenuBarData(menuData);- KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK);+ KeyStroke keyStroke =+ KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, DockingUtils.CONTROL_KEY_MODIFIER_MASK);setKeyBindingData(new KeyBindingData(keyStroke));setHelpLocation(new HelpLocation(HelpTopics.NAVIGATION, "Next_Previous_Function"));addToWindowWhen(NavigatableActionContext.class);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoPreviousFunctionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoPreviousFunctionAction.javaindex 4f9780ae4c..f0d3c99386 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoPreviousFunctionAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/actions/GotoPreviousFunctionAction.java@@ -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.@@ -15,11 +15,11 @@*/package ghidra.app.plugin.core.codebrowser.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.KeyStroke;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.tool.ToolConstants;@@ -47,7 +47,8 @@ public class GotoPreviousFunctionAction extends NavigatableContextAction {null, "GoTo");menuData.setMenuSubGroup("zb");setMenuBarData(menuData);- KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK);+ KeyStroke keyStroke =+ KeyStroke.getKeyStroke(KeyEvent.VK_UP, DockingUtils.CONTROL_KEY_MODIFIER_MASK);setKeyBindingData(new KeyBindingData(keyStroke));setHelpLocation(new HelpLocation(HelpTopics.NAVIGATION, "Next_Previous_Function"));addToWindowWhen(NavigatableActionContext.class);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.javaindex 4cf3720b49..8a09ff6557 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java@@ -480,7 +480,8 @@ public class CommentsDialog extends ReusableDialogComponentProvider implements Kreturn;}- if ((modifiers & InputEvent.CTRL_DOWN_MASK) == InputEvent.CTRL_DOWN_MASK) {+ if ((modifiers &+ DockingUtils.CONTROL_KEY_MODIFIER_MASK) == DockingUtils.CONTROL_KEY_MODIFIER_MASK) {okCallback(); // Control-Enter allows closes the dialoge.consume();return;diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CopyAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CopyAction.javaindex d04959c781..ea8ed82e6c 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CopyAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CopyAction.java@@ -15,13 +15,9 @@*/package ghidra.app.plugin.core.datamgr.actions;-import static docking.KeyBindingPrecedence.ActionMapLevel;-import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;-import ghidra.app.plugin.core.datamgr.DataTypesActionContext;-import ghidra.app.plugin.core.datamgr.tree.*;+import static docking.KeyBindingPrecedence.*;import java.awt.datatransfer.*;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.util.ArrayList;import java.util.List;@@ -30,11 +26,15 @@ import javax.swing.KeyStroke;import javax.swing.tree.TreePath;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.widgets.tree.GTree;import docking.widgets.tree.GTreeNode;import docking.widgets.tree.support.GTreeNodeTransferable;import docking.widgets.tree.support.GTreeTransferHandler;+import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;+import ghidra.app.plugin.core.datamgr.DataTypesActionContext;+import ghidra.app.plugin.core.datamgr.tree.*;public class CopyAction extends DockingAction {private Clipboard clipboard;@@ -46,7 +46,7 @@ public class CopyAction extends DockingAction {setPopupMenuData(new MenuData(new String[] { "Copy" }, group));setKeyBindingData(new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_C,- InputEvent.CTRL_DOWN_MASK), ActionMapLevel));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK), ActionMapLevel));setEnabled(true);}@@ -109,7 +109,8 @@ public class CopyAction extends DockingAction {* @param clipboard clipboard in which to place our contents* @param list list of nodes to place into the clipboard*/- private void setClipboardContents(GTree gTree, Clipboard clipboard, final List<GTreeNode> list) {+ private void setClipboardContents(GTree gTree, Clipboard clipboard,+ final List<GTreeNode> list) {GTreeTransferHandler dragNDropHandler = gTree.getDragNDropHandler();Transferable contents = new GTreeNodeTransferable(dragNDropHandler, list);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CutAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CutAction.javaindex 4dd7e9ea5a..ac89a6848a 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CutAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CutAction.java@@ -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.@@ -16,7 +16,6 @@package ghidra.app.plugin.core.datamgr.actions;import java.awt.datatransfer.*;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.util.ArrayList;import java.util.List;@@ -24,8 +23,7 @@ import java.util.List;import javax.swing.KeyStroke;import javax.swing.tree.TreePath;-import docking.ActionContext;-import docking.KeyBindingPrecedence;+import docking.*;import docking.action.*;import docking.widgets.tree.GTree;import docking.widgets.tree.GTreeNode;@@ -44,7 +42,7 @@ public class CutAction extends DockingAction {clipboard = plugin.getClipboard();setPopupMenuData(new MenuData(new String[] { "Cut" }, "Edit"));setKeyBindingData(new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_X,- InputEvent.CTRL_DOWN_MASK), KeyBindingPrecedence.ActionMapLevel));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK), KeyBindingPrecedence.ActionMapLevel));setEnabled(true);clipboardOwner = new ClipboardOwner() {diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/PasteAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/PasteAction.javaindex d0dfe535b9..c7f6710710 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/PasteAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/PasteAction.java@@ -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.@@ -17,15 +17,13 @@ package ghidra.app.plugin.core.datamgr.actions;import java.awt.datatransfer.*;import java.awt.dnd.DnDConstants;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.util.*;import javax.swing.KeyStroke;import javax.swing.tree.TreePath;-import docking.ActionContext;-import docking.KeyBindingPrecedence;+import docking.*;import docking.action.*;import docking.widgets.tree.GTree;import docking.widgets.tree.GTreeNode;@@ -48,7 +46,8 @@ public class PasteAction extends DockingAction {this.tool = plugin.getTool();setPopupMenuData(new MenuData(new String[] { "Paste" }, "Edit"));setKeyBindingData(- new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK),+ new KeyBindingData(+ KeyStroke.getKeyStroke(KeyEvent.VK_V, DockingUtils.CONTROL_KEY_MODIFIER_MASK),KeyBindingPrecedence.ActionMapLevel));}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.javaindex 25c8aec00c..3121563f54 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.highlight;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.*;import docking.tool.ToolConstants;import ghidra.app.CorePluginPackage;@@ -101,7 +101,7 @@ public class SetHighlightPlugin extends Plugin {setHighlightFromSelectionAction.setPopupMenuData(new MenuData(SET_HIGHLIGHT_POPUPPATH,HIGHLIGHT_GROUP));setHighlightFromSelectionAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_H,- InputEvent.CTRL_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHighlightFromSelectionAction.addToWindowWhen(NavigatableActionContext.class);tool.addAction(setHighlightFromSelectionAction);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/CompletionWindowTrigger.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/CompletionWindowTrigger.javaindex f2c937e55f..577d96c59a 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/CompletionWindowTrigger.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/CompletionWindowTrigger.java@@ -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.@@ -16,16 +16,17 @@package ghidra.app.plugin.core.interpreter;import java.awt.AWTKeyStroke;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.KeyStroke;+import docking.DockingUtils;+public enum CompletionWindowTrigger {//@formatter:offTAB(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0, false)),- CONTROL_SPACE(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_DOWN_MASK, false));+ CONTROL_SPACE(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, DockingUtils.CONTROL_KEY_MODIFIER_MASK, false));//@formatter:onprivate KeyStroke keyStroke;diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapProvider.javaindex 64bd4bce5a..e620ee86a2 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapProvider.java@@ -25,6 +25,7 @@ import javax.swing.table.TableColumn;import javax.swing.table.TableModel;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.action.builder.ActionBuilder;import docking.action.builder.ToggleActionBuilder;@@ -565,7 +566,7 @@ class MemoryMapProvider extends ComponentProviderAdapter {setStatusText("");if (!e.isPopupTrigger()) {if ((e.getModifiersEx() &- (InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)) == 0) {+ (DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)) == 0) {navigateToAddress();}}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.javaindex 079fd71d1a..d94c25de07 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java@@ -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.@@ -22,6 +22,7 @@ import javax.swing.Icon;import javax.swing.KeyStroke;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.menu.ActionState;import docking.menu.MultiStateDockingAction;@@ -376,7 +377,7 @@ public class NextPreviousBookmarkAction extends MultiStateDockingAction<String>private KeyStroke getKeyStroke() {return KeyStroke.getKeyStroke(KeyEvent.VK_B,- InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK);+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK);}//==================================================================================================diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousDefinedDataAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousDefinedDataAction.javaindex 2e6dbaf3bb..295760ec6d 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousDefinedDataAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousDefinedDataAction.java@@ -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.@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.framework.plugintool.PluginTool;import ghidra.program.model.address.Address;@@ -48,7 +49,7 @@ public class NextPreviousDefinedDataAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_D, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousFunctionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousFunctionAction.javaindex d117ebd0fa..8d78cb18f5 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousFunctionAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousFunctionAction.java@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.app.nav.Navigatable;import ghidra.app.services.GoToService;@@ -48,7 +49,7 @@ public class NextPreviousFunctionAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_F, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousInstructionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousInstructionAction.javaindex 1718d66cda..c5aa8ff46a 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousInstructionAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousInstructionAction.java@@ -22,6 +22,7 @@ import javax.help.UnsupportedOperationException;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.app.context.NavigatableActionContext;import ghidra.framework.plugintool.PluginTool;@@ -47,7 +48,7 @@ public class NextPreviousInstructionAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_I, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousLabelAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousLabelAction.javaindex b86664eedd..d761ad8ecf 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousLabelAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousLabelAction.java@@ -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.@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.framework.plugintool.PluginTool;import ghidra.program.model.address.Address;@@ -45,7 +46,7 @@ public class NextPreviousLabelAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_L, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousSameBytesAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousSameBytesAction.javaindex 3ffec5d091..357ca6b59e 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousSameBytesAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousSameBytesAction.java@@ -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.@@ -22,6 +22,7 @@ import java.util.Iterator;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.framework.plugintool.PluginTool;import ghidra.program.model.address.Address;@@ -55,7 +56,7 @@ public class NextPreviousSameBytesAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_V, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousUndefinedAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousUndefinedAction.javaindex 47bd993b9f..1bfc05ef43 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousUndefinedAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousUndefinedAction.java@@ -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.@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import javax.swing.KeyStroke;+import docking.DockingUtils;import generic.theme.GIcon;import ghidra.framework.plugintool.PluginTool;import ghidra.program.model.address.Address;@@ -43,7 +44,7 @@ public class NextPreviousUndefinedAction extends AbstractNextPreviousAction {@Overrideprotected KeyStroke getKeyStroke() {- return KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK |+ return KeyStroke.getKeyStroke(KeyEvent.VK_U, DockingUtils.CONTROL_KEY_MODIFIER_MASK |InputEvent.ALT_DOWN_MASK);}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/MultiTabPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/MultiTabPlugin.javaindex db6509da84..868685e68d 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/MultiTabPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/MultiTabPlugin.java@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.progmgr;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.*;@@ -127,7 +126,8 @@ public class MultiTabPlugin extends Plugin implements DomainObjectListener, Optinew MenuData(new String[] { ToolConstants.MENU_NAVIGATION, "Go To Program..." }, null,ToolConstants.MENU_NAVIGATION_GROUP_WINDOWS, MenuData.NO_MNEMONIC, firstGroup));goToProgramAction- .setKeyBindingData(new KeyBindingData(KeyEvent.VK_F7, InputEvent.CTRL_DOWN_MASK));+ .setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_F7, DockingUtils.CONTROL_KEY_MODIFIER_MASK));goToProgramAction.setEnabled(false);goToProgramAction.setDescription(@@ -177,7 +177,8 @@ public class MultiTabPlugin extends Plugin implements DomainObjectListener, Optinew String[] { ToolConstants.MENU_NAVIGATION, "Go To Last Active Program" }, null,ToolConstants.MENU_NAVIGATION_GROUP_WINDOWS, MenuData.NO_MNEMONIC, secondGroup));goToLastActiveProgramAction- .setKeyBindingData(new KeyBindingData(KeyEvent.VK_F6, InputEvent.CTRL_DOWN_MASK));+ .setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_F6, DockingUtils.CONTROL_KEY_MODIFIER_MASK));goToLastActiveProgramAction.setEnabled(false);goToLastActiveProgramAction.setDescription("Activates the last program used before the current program");diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.javaindex 7c7a657125..90ea8a5308 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java@@ -25,6 +25,7 @@ import javax.swing.JComponent;import org.jdom.Element;import docking.ComponentProvider;+import docking.DockingUtils;import docking.action.*;import docking.widgets.OptionDialog;import ghidra.app.CorePluginPackage;@@ -180,7 +181,7 @@ public class ReferencesPlugin extends Plugin {new String[] { SUBMENU_NAME, CreateDefaultReferenceAction.DEFAULT_MENU_ITEM_NAME },null, SHOW_REFS_GROUP));createAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_R,- InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK));createAction.setDescription("Create default forward reference");tool.addAction(createAction);@@ -733,8 +734,10 @@ public class ReferencesPlugin extends Plugin {path, addr, label, editRef.getReferenceType());if (tool.execute(cmd, p)) {- if (!p.getReferenceManager().getReferencesTo(- oldExtLoc.getExternalSpaceAddress()).hasNext() &&+ if (!p.getReferenceManager()+ .getReferencesTo(+ oldExtLoc.getExternalSpaceAddress())+ .hasNext() &&OptionDialog.YES_OPTION == OptionDialog.showYesNoDialog(tool.getActiveWindow(),"Delete Unused External Location?","Remove unused external location symbol '" + oldExtLoc.toString() + "'?")) {@@ -804,8 +807,10 @@ public class ReferencesPlugin extends Plugin {Reference oldRef) {if (oldRef == null) {- Reference[] refs = fromCodeUnit.getProgram().getReferenceManager().getReferencesFrom(- fromCodeUnit.getMinAddress(), opIndex);+ Reference[] refs = fromCodeUnit.getProgram()+ .getReferenceManager()+ .getReferencesFrom(+ fromCodeUnit.getMinAddress(), opIndex);if (refs.length != 0) {oldRef = refs[0];}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.javaindex 206322376d..1a4d1018da 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java@@ -15,12 +15,14 @@*/package ghidra.app.plugin.core.register;-import java.awt.event.*;+import java.awt.event.KeyEvent;+import java.awt.event.MouseEvent;import java.math.BigInteger;import java.util.ArrayList;import java.util.Collections;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import ghidra.app.CorePluginPackage;import ghidra.app.cmd.register.SetRegisterCmd;@@ -110,7 +112,7 @@ public class RegisterPlugin extends ProgramPlugin {setRegisterAction.setPopupMenuData(new MenuData(new String[] { "Set Register Values..." }, null, "Registers"));setRegisterAction.setKeyBindingData(- new KeyBindingData(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));+ new KeyBindingData(KeyEvent.VK_R, DockingUtils.CONTROL_KEY_MODIFIER_MASK));setRegisterAction.setDescription("Set register values in a program.");setRegisterAction.setHelpLocation(new HelpLocation("RegisterPlugin", "SetRegisterValues"));@@ -159,8 +161,10 @@ public class RegisterPlugin extends ProgramPlugin {Address addr = loc.getAddress();Register reg = loc.getRegister();RegisterValue regVal =- context.getProgram().getProgramContext().getNonDefaultValue(reg,- addr);+ context.getProgram()+ .getProgramContext()+ .getNonDefaultValue(reg,+ addr);return regVal != null && regVal.hasValue();}}@@ -191,8 +195,10 @@ public class RegisterPlugin extends ProgramPlugin {Address addr = loc.getAddress();Register reg = loc.getRegister();RegisterValue regVal =- context.getProgram().getProgramContext().getNonDefaultValue(reg,- addr);+ context.getProgram()+ .getProgramContext()+ .getNonDefaultValue(reg,+ addr);return regVal != null && regVal.hasValue();}}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/CutAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/CutAction.javaindex ff54947c61..4cf0d3eeaf 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/CutAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/CutAction.java@@ -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.@@ -18,7 +18,6 @@ package ghidra.app.plugin.core.symboltree.actions;import static docking.KeyBindingPrecedence.*;import java.awt.datatransfer.*;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.util.ArrayList;import java.util.List;@@ -27,6 +26,7 @@ import javax.swing.Icon;import javax.swing.KeyStroke;import javax.swing.tree.TreePath;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.widgets.tree.GTree;@@ -47,7 +47,8 @@ public class CutAction extends SymbolTreeContextAction {this.provider = provider;setEnabled(false);setPopupMenuData(new MenuData(new String[] { "Cut" }, CUT_ICON, "cut/paste"));- KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK);+ KeyStroke keyStroke =+ KeyStroke.getKeyStroke(KeyEvent.VK_X, DockingUtils.CONTROL_KEY_MODIFIER_MASK);setKeyBindingData(new KeyBindingData(keyStroke, ActionMapLevel));clipboardOwner = (currentClipboard, transferable) -> {diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/PasteAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/PasteAction.javaindex 90b663ea9f..02f11b7c03 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/PasteAction.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/PasteAction.java@@ -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.@@ -18,13 +18,13 @@ package ghidra.app.plugin.core.symboltree.actions;import java.awt.datatransfer.Clipboard;import java.awt.datatransfer.Transferable;import java.awt.dnd.DnDConstants;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.Icon;import javax.swing.KeyStroke;import javax.swing.tree.TreePath;+import docking.DockingUtils;import docking.KeyBindingPrecedence;import docking.action.KeyBindingData;import docking.action.MenuData;@@ -42,7 +42,8 @@ public class PasteAction extends SymbolTreeContextAction {super("Paste Symbols", plugin.getName());setPopupMenuData(new MenuData(new String[] { "Paste" }, PASTE_ICON, "cut/paste"));setKeyBindingData(- new KeyBindingData(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK),+ new KeyBindingData(+ KeyStroke.getKeyStroke(KeyEvent.VK_V, DockingUtils.CONTROL_KEY_MODIFIER_MASK),KeyBindingPrecedence.ActionMapLevel));}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalClipboardProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalClipboardProvider.javaindex aec5de7873..233222e952 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalClipboardProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalClipboardProvider.java@@ -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.@@ -28,8 +28,7 @@ import javax.swing.event.ChangeListener;import org.apache.commons.lang3.ArrayUtils;-import docking.ActionContext;-import docking.ComponentProvider;+import docking.*;import docking.action.DockingAction;import docking.action.KeyBindingData;import docking.dnd.StringTransferable;@@ -182,11 +181,11 @@ public class TerminalClipboardProvider implements ClipboardContentProviderServicswitch (action.getName()) {case "Copy":action.setKeyBindingData(new KeyBindingData(KeyEvent.VK_C,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));break;case "Paste":action.setKeyBindingData(new KeyBindingData(KeyEvent.VK_V,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));break;}}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalProvider.javaindex bee2e95dd4..b5e923dd86 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalProvider.java@@ -235,7 +235,7 @@ public class TerminalProvider extends ComponentProviderAdapter {.menuPath("Find").menuGroup("Find").keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK))+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "find")).onAction(this::activatedFind).buildAndInstallLocal(this);@@ -243,7 +243,7 @@ public class TerminalProvider extends ComponentProviderAdapter {.menuPath("Find Next").menuGroup("Find").keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_H,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK))+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "find_next")).enabledWhen(this::isEnabledFindStep).onAction(this::activatedFindNext)@@ -252,7 +252,7 @@ public class TerminalProvider extends ComponentProviderAdapter {.menuPath("Find Previous").menuGroup("Find").keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_G,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK))+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "find_previous")).enabledWhen(this::isEnabledFindStep).onAction(this::activatedFindPrevious)@@ -261,7 +261,7 @@ public class TerminalProvider extends ComponentProviderAdapter {.menuPath("Select All").menuGroup("Select").keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_A,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK))+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "select_all")).onAction(this::activatedSelectAll).buildAndInstallLocal(this);@@ -269,21 +269,23 @@ public class TerminalProvider extends ComponentProviderAdapter {.menuPath("Increase Font Size").menuGroup("View").keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK))+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "increase_font_size")).onAction(this::activatedIncreaseFontSize).buildAndInstallLocal(this);actionDecreaseSize = new ActionBuilder("Decrease Font Size", plugin.getName()).menuPath("Decrease Font Size").menuGroup("View")- .keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK))+ .keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS,+ DockingUtils.CONTROL_KEY_MODIFIER_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "decrease_font_size")).onAction(this::activatedDecreaseFontSize).buildAndInstallLocal(this);actionResetSize = new ActionBuilder("Reset Font Size", plugin.getName()).menuPath("Reset Font Size").menuGroup("View")- .keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK))+ .keyBinding(+ KeyStroke.getKeyStroke(KeyEvent.VK_0, DockingUtils.CONTROL_KEY_MODIFIER_MASK)).helpLocation(new HelpLocation(helpPlugin.getName(), "decrease_font_size")).onAction(this::activatedResetFontSize).buildAndInstallLocal(this);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.javaindex 1651eb7299..b57b12761b 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.java@@ -24,6 +24,7 @@ import java.util.ArrayList;import java.util.List;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.tool.ToolConstants;import docking.widgets.filechooser.GhidraFileChooser;@@ -400,7 +401,7 @@ public class ImporterPlugin extends PluginimportSelectionAction.setPopupMenuData(new MenuData(new String[] { title + "..." }, null,IMPORT_MENU_GROUP, MenuData.NO_MNEMONIC, "d"));importSelectionAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_I,- InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK));importSelectionAction.setDescription(IMPORTER_PLUGIN_DESC);importSelectionAction.setEnabled(tool.getProject() != null);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FileSystemBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FileSystemBrowserPlugin.javaindex 6f169f9145..3c3a42cebd 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FileSystemBrowserPlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FileSystemBrowserPlugin.java@@ -16,7 +16,6 @@package ghidra.plugins.fsbrowser;import java.awt.Component;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.io.File;import java.io.IOException;@@ -24,6 +23,7 @@ import java.util.*;import javax.swing.KeyStroke;+import docking.DockingUtils;import docking.action.DockingAction;import docking.action.builder.ActionBuilder;import docking.tool.ToolConstants;@@ -101,7 +101,8 @@ public class FileSystemBrowserPlugin extends Plugin.enabledWhen(ac -> tool.getProject() != null).menuPath(ToolConstants.MENU_FILE, "Open File System...").menuGroup("Import", "z")- .keyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK))+ .keyBinding(+ KeyStroke.getKeyStroke(KeyEvent.VK_I, DockingUtils.CONTROL_KEY_MODIFIER_MASK)).onAction(ac -> doOpenFileSystem()).buildAndInstall(tool);}diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingsTest.javaindex 93c89112ba..eec86145e8 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingsTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingsTest.java@@ -28,6 +28,7 @@ import javax.swing.table.*;import org.junit.*;+import docking.DockingUtils;import docking.DockingWindowManager;import docking.action.*;import docking.actions.KeyBindingUtils;@@ -152,8 +153,9 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {// set a key binding on an action that does not have a key bindingselectRowForAction(action1);JTextField keyField = getKeyField();- triggerActionKey(keyField, InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_X);- KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK);+ triggerActionKey(keyField, DockingUtils.CONTROL_KEY_MODIFIER_MASK, KeyEvent.VK_X);+ KeyStroke ks =+ KeyStroke.getKeyStroke(KeyEvent.VK_X, DockingUtils.CONTROL_KEY_MODIFIER_MASK);assertKeyFieldText(KeyBindingUtils.parseKeyStroke(ks));apply();@@ -176,8 +178,9 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {public void testSetKeyBinding3() throws Exception {selectRowForAction(action1);- typeKeyStroke(InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_HOME);- KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.CTRL_DOWN_MASK);+ typeKeyStroke(DockingUtils.CONTROL_KEY_MODIFIER_MASK, KeyEvent.VK_HOME);+ KeyStroke ks =+ KeyStroke.getKeyStroke(KeyEvent.VK_HOME, DockingUtils.CONTROL_KEY_MODIFIER_MASK);assertKeyFieldText(ks);apply();@@ -281,7 +284,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {setUpDialog();selectRowForAction(action1);- KeyStroke validKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK);+ KeyStroke validKeyStroke =+ KeyStroke.getKeyStroke(KeyEvent.VK_X, DockingUtils.CONTROL_KEY_MODIFIER_MASK);typeKeyStroke(validKeyStroke);assertKeyFieldText(validKeyStroke);diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/util/bean/opteditor/OptionsDialogTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/util/bean/opteditor/OptionsDialogTest.javaindex a6a713d401..b68b9fe570 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/util/bean/opteditor/OptionsDialogTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/util/bean/opteditor/OptionsDialogTest.java@@ -35,8 +35,7 @@ import javax.swing.tree.TreePath;import org.apache.commons.lang3.StringUtils;import org.junit.*;-import docking.DialogComponentProvider;-import docking.KeyEntryPanel;+import docking.*;import docking.action.DockingActionIf;import docking.actions.KeyBindingUtils;import docking.options.editor.*;@@ -468,7 +467,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {MouseBinding newMouseBinding = setMouseBinding(actionName, actionOwner, modifiers, button);int keyCode = KeyEvent.VK_Q;- modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;+ modifiers = DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK;KeyStroke newKeyStroke = setKeyBinding(actionName, actionOwner, modifiers, keyCode, 'Q');apply();@@ -498,7 +497,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {assertNull(defaultMouseBinding);int keyCode = KeyEvent.VK_Q;- int modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;+ int modifiers = DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK;KeyStroke newKeyStroke = setKeyBinding(actionName, actionOwner, modifiers, keyCode, 'Q');int button = 4;@@ -560,7 +559,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {assertOptionsKeyStroke(tool, actionName, actionOwner, defaultKeyStroke);int keyCode = KeyEvent.VK_Q;- int modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;+ int modifiers = DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK;KeyStroke newKeyStroke = setKeyBinding(actionName, actionOwner, modifiers, keyCode, 'Q');apply();@@ -587,7 +586,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {assertOptionsKeyStroke(frontEndTool, actionName, actionOwner, defaultKeyStroke);int keyCode = KeyEvent.VK_Q;- int modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;+ int modifiers = DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK;KeyStroke newKeyStroke = setKeyBinding(actionName, actionOwner, modifiers, keyCode, 'Q');apply();diff --git a/Ghidra/Features/Base/src/test/java/ghidra/framework/data/OptionsDBTest.java b/Ghidra/Features/Base/src/test/java/ghidra/framework/data/OptionsDBTest.javaindex 57931e2e91..3750f71411 100644--- a/Ghidra/Features/Base/src/test/java/ghidra/framework/data/OptionsDBTest.java+++ b/Ghidra/Features/Base/src/test/java/ghidra/framework/data/OptionsDBTest.java@@ -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.@@ -19,7 +19,6 @@ import static org.junit.Assert.*;import java.awt.Color;import java.awt.Font;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.beans.PropertyChangeListener;import java.beans.PropertyEditorSupport;@@ -31,6 +30,7 @@ import javax.swing.KeyStroke;import org.junit.*;+import docking.DockingUtils;import docking.test.AbstractDockingTest;import generic.theme.GThemeDefaults.Colors.Palette;import generic.theme.ThemeManager;@@ -239,7 +239,7 @@ public class OptionsDBTest extends AbstractDockingTest {@Testpublic void testSaveActionTrigger_MouseBinding() {- MouseBinding mb = new MouseBinding(1, InputEvent.CTRL_DOWN_MASK);+ MouseBinding mb = new MouseBinding(1, DockingUtils.CONTROL_KEY_MODIFIER_MASK);ActionTrigger trigger = new ActionTrigger(mb);options.setActionTrigger("Foo", trigger);saveAndRestoreOptions();@@ -249,7 +249,7 @@ public class OptionsDBTest extends AbstractDockingTest {@Testpublic void testSaveActionTrigger_KeyStrokeAndMouseBinding() {KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_A, 0);- MouseBinding mb = new MouseBinding(1, InputEvent.CTRL_DOWN_MASK);+ MouseBinding mb = new MouseBinding(1, DockingUtils.CONTROL_KEY_MODIFIER_MASK);ActionTrigger trigger = new ActionTrigger(ks, mb);options.setActionTrigger("Foo", trigger);saveAndRestoreOptions();diff --git a/Ghidra/Features/Base/src/test/java/ghidra/framework/options/OptionsTest.java b/Ghidra/Features/Base/src/test/java/ghidra/framework/options/OptionsTest.javaindex 50eb9ad547..99c08f48c5 100644--- a/Ghidra/Features/Base/src/test/java/ghidra/framework/options/OptionsTest.java+++ b/Ghidra/Features/Base/src/test/java/ghidra/framework/options/OptionsTest.java@@ -19,7 +19,6 @@ import static org.junit.Assert.*;import java.awt.Color;import java.awt.Font;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.beans.PropertyChangeListener;import java.beans.PropertyEditorSupport;@@ -34,6 +33,7 @@ import javax.swing.KeyStroke;import org.jdom.Element;import org.junit.*;+import docking.DockingUtils;import generic.test.AbstractGuiTest;import generic.theme.GThemeDefaults.Colors.Palette;import ghidra.util.*;@@ -182,7 +182,7 @@ public class OptionsTest extends AbstractGuiTest {@Testpublic void testSaveActionTrigger_MouseBinding() {- MouseBinding mb = new MouseBinding(1, InputEvent.CTRL_DOWN_MASK);+ MouseBinding mb = new MouseBinding(1, DockingUtils.CONTROL_KEY_MODIFIER_MASK);ActionTrigger trigger = new ActionTrigger(mb);options.setActionTrigger("Foo", trigger);saveAndRestoreOptions();@@ -192,7 +192,7 @@ public class OptionsTest extends AbstractGuiTest {@Testpublic void testSaveActionTrigger_KeyStrokeAndMouseBinding() {KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_A, 0);- MouseBinding mb = new MouseBinding(1, InputEvent.CTRL_DOWN_MASK);+ MouseBinding mb = new MouseBinding(1, DockingUtils.CONTROL_KEY_MODIFIER_MASK);ActionTrigger trigger = new ActionTrigger(ks, mb);options.setActionTrigger("Foo", trigger);saveAndRestoreOptions();diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ProgramByteViewerComponentProvider.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ProgramByteViewerComponentProvider.javaindex 7657878410..2de28c5a30 100644--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ProgramByteViewerComponentProvider.java+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ProgramByteViewerComponentProvider.java@@ -26,6 +26,7 @@ import java.util.Set;import javax.swing.*;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.widgets.fieldpanel.support.ViewerPosition;import generic.theme.GIcon;@@ -773,7 +774,7 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvisetDescription("Create a snapshot (disconnected) copy of this Bytes window ");setHelpLocation(new HelpLocation("Snapshots", "Snapshots_Start"));setKeyBindingData(new KeyBindingData(KeyEvent.VK_T,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));}@Overridediff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ToggleEditAction.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ToggleEditAction.javaindex fea85ae1c2..d4d3e0403c 100644--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ToggleEditAction.java+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ToggleEditAction.java@@ -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.@@ -19,6 +19,7 @@ import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import generic.theme.GIcon;import ghidra.framework.plugintool.Plugin;@@ -31,7 +32,7 @@ class ToggleEditAction extends ToggleDockingAction {this.provider = provider;setToolBarData(new ToolBarData(new GIcon("icon.base.edit.bytes"), "Byteviewer"));setKeyBindingData(new KeyBindingData(- KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));+ KeyEvent.VK_E, DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK));setDescription("Enable/Disable editing of bytes in Byte Viewer panels.");setSelected(false);diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/CloneDecompilerAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/CloneDecompilerAction.javaindex 864a5bd931..09d48d7d34 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/CloneDecompilerAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/CloneDecompilerAction.java@@ -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.@@ -20,6 +20,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.ToolBarData;import generic.theme.GIcon;@@ -36,7 +37,7 @@ public class CloneDecompilerAction extends AbstractDecompilerAction {setDescription("Create a snapshot (disconnected) copy of this Decompiler window ");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ToolBarSnapshot"));setKeyBindingData(new KeyBindingData(KeyEvent.VK_T,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));}@Overridediff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FindAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FindAction.javaindex 3b72a457f6..5f7e390a96 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FindAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FindAction.java@@ -15,11 +15,11 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import org.apache.commons.lang3.StringUtils;+import docking.DockingUtils;import docking.action.*;import docking.widgets.FindDialog;import ghidra.app.decompiler.component.DecompilerFindDialog;@@ -35,7 +35,8 @@ public class FindAction extends AbstractDecompilerAction {super("Find");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionFind"));setPopupMenuData(new MenuData(new String[] { "Find..." }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_F, DockingUtils.CONTROL_KEY_MODIFIER_MASK));setEnabled(true);}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeFieldAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeFieldAction.javaindex 64810b2da9..743c0d345b 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeFieldAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeFieldAction.java@@ -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.@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import ghidra.app.decompiler.ClangFieldToken;@@ -43,7 +43,8 @@ public class RetypeFieldAction extends AbstractDecompilerAction {super("Retype Field");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionRetypeField"));setPopupMenuData(new MenuData(new String[] { "Retype Field" }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_L, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}@Overridediff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeGlobalAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeGlobalAction.javaindex 47180483df..49bf132d34 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeGlobalAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeGlobalAction.java@@ -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.@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import ghidra.app.decompiler.*;@@ -48,7 +48,8 @@ public class RetypeGlobalAction extends AbstractDecompilerAction {super("Retype Global");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionRetypeGlobal"));setPopupMenuData(new MenuData(new String[] { "Retype Global" }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_L, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}@Overridediff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeLocalAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeLocalAction.javaindex 93d9209012..72577ea3fe 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeLocalAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeLocalAction.java@@ -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.@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import ghidra.app.decompiler.*;@@ -57,7 +57,8 @@ public class RetypeLocalAction extends AbstractDecompilerAction {super("Retype Variable");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionRetypeVariable"));setPopupMenuData(new MenuData(new String[] { "Retype Variable" }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_L, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}protected RetypeLocalAction(String name) {diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeReturnAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeReturnAction.javaindex 2761d6ef8f..21d45104be 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeReturnAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RetypeReturnAction.java@@ -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.@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.widgets.OptionDialog;@@ -51,7 +51,8 @@ public class RetypeReturnAction extends AbstractDecompilerAction {super("Retype Return");setHelpLocation(new HelpLocation(HelpTopics.DECOMPILER, "ActionRetypeReturn"));setPopupMenuData(new MenuData(new String[] { "Retype Return" }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_L, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}@Overridediff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.javaindex 160e523712..f7a2865cc5 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java@@ -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.@@ -15,10 +15,10 @@*/package ghidra.app.plugin.core.decompile.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import docking.ActionContext;+import docking.DockingUtils;import docking.action.DockingAction;import docking.action.KeyBindingData;import docking.widgets.EventTrigger;@@ -35,7 +35,8 @@ public class SelectAllAction extends DockingAction {public SelectAllAction(String owner, DecompilerPanel panel) {super("Select All", owner);this.panel = panel;- setKeyBindingData(new KeyBindingData(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_A, DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation(HelpTopics.SELECTION, getName()));}diff --git a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintClearAction.java b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintClearAction.javaindex ea4283553b..b52cbea8dd 100644--- a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintClearAction.java+++ b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintClearAction.java@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompiler.taint.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import ghidra.app.plugin.core.decompile.DecompilerActionContext;@@ -37,7 +37,8 @@ public class TaintClearAction extends TaintAbstractDecompilerAction {super("Clear Markers");setHelpLocation(new HelpLocation(TaintPlugin.HELP_LOCATION, "TaintClear"));setPopupMenuData(new MenuData(new String[] { "Taint", "Clear" }, "Decompile"));- setKeyBindingData(new KeyBindingData(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_S, DockingUtils.CONTROL_KEY_MODIFIER_MASK));this.plugin = plugin;}diff --git a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintQueryCustomAction.java b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintQueryCustomAction.javaindex 28de03be3f..9177d5a4a6 100644--- a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintQueryCustomAction.java+++ b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/decompiler/taint/actions/TaintQueryCustomAction.java@@ -15,9 +15,9 @@*/package ghidra.app.plugin.core.decompiler.taint.actions;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;+import docking.DockingUtils;import docking.action.KeyBindingData;import ghidra.app.plugin.core.decompiler.taint.TaintPlugin;import ghidra.app.plugin.core.decompiler.taint.TaintState.QueryType;@@ -27,7 +27,8 @@ public class TaintQueryCustomAction extends TaintAbstractQueryAction {public TaintQueryCustomAction(TaintPlugin plugin) {super(plugin, "CustomQuery", "Custom Taint Query", "Run custom taint query");queryType = QueryType.CUSTOM;- setKeyBindingData(new KeyBindingData(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(+ new KeyBindingData(KeyEvent.VK_Y, DockingUtils.CONTROL_KEY_MODIFIER_MASK));}}diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.javaindex 998ca3ab43..9015a64431 100644--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.functiongraph;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import java.util.*;@@ -784,7 +783,7 @@ public class FGActionManager {}};selectAllAction- .setKeyBindingData(new KeyBindingData(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK));+ .setKeyBindingData(new KeyBindingData(KeyEvent.VK_A, DockingUtils.CONTROL_KEY_MODIFIER_MASK));selectAllAction.setPopupMenuData(new MenuData(new String[] { selectionMenuName, "Select All Code Units" }, popupSelectionGroup3));selectAllActiondiff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.javaindex 03bdd25ab1..b2ae0923a0 100644--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java@@ -170,7 +170,7 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, FcloneAction.setHelpLocation(new HelpLocation("FunctionGraphPlugin", "Function_Graph_Action_Snapshot"));cloneAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_T,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));DockingAction optionsAction =new DockingAction("Function Graph Options", owner) {diff --git a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffActionManager.java b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffActionManager.javaindex bdef6282b5..5581363332 100644--- a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffActionManager.java+++ b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffActionManager.java@@ -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.@@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;import javax.swing.Icon;import docking.ActionContext;+import docking.DockingUtils;import docking.action.*;import docking.tool.ToolConstants;import docking.widgets.OptionDialog;@@ -300,7 +301,8 @@ class DiffActionManager {};icon = Icons.DOWN_ICON;nextDiffAction.setKeyBindingData(- new KeyBindingData('N', InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));+ new KeyBindingData('N',+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK));nextDiffAction.setPopupMenuData(new MenuData(new String[] { "Next Difference" }, icon, DIFF_NAVIGATE_GROUP));nextDiffAction.setToolBarData(new ToolBarData(icon, DIFF_NAVIGATE_GROUP));@@ -314,7 +316,8 @@ class DiffActionManager {};icon = Icons.UP_ICON;previousDiffAction.setKeyBindingData(- new KeyBindingData('P', InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));+ new KeyBindingData('P',+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.ALT_DOWN_MASK));previousDiffAction.setPopupMenuData(new MenuData(new String[] { "Previous Difference" }, icon, DIFF_NAVIGATE_GROUP));previousDiffAction.setToolBarData(new ToolBarData(icon, DIFF_NAVIGATE_GROUP));diff --git a/Ghidra/Framework/Docking/src/main/java/docking/actions/KeyBindingUtils.java b/Ghidra/Framework/Docking/src/main/java/docking/actions/KeyBindingUtils.javaindex 6d64c1a88a..a40842c72f 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/actions/KeyBindingUtils.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/actions/KeyBindingUtils.java@@ -719,7 +719,8 @@ public class KeyBindingUtils {// deprecated InputEvent mask types@SuppressWarnings("deprecation")private static boolean isControl(int mask) {- return (mask & InputEvent.CTRL_DOWN_MASK) != 0 || (mask & InputEvent.CTRL_MASK) != 0;+ return (mask & InputEvent.CTRL_DOWN_MASK) != 0 || (mask & InputEvent.CTRL_MASK) != 0 ||+ (mask & DockingUtils.CONTROL_KEY_MODIFIER_MASK) != 0;}// ignore the deprecated; remove when we are confident that all tool actions no longer use thediff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/autocomplete/TextFieldAutocompleter.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/autocomplete/TextFieldAutocompleter.javaindex f4a67e99d0..d0fa9b42b6 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/autocomplete/TextFieldAutocompleter.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/autocomplete/TextFieldAutocompleter.java@@ -963,7 +963,7 @@ public class TextFieldAutocompleter<T> {}}else if (e.getKeyCode() == KeyEvent.VK_SPACE &&- (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {+ (e.getModifiersEx() & DockingUtils.CONTROL_KEY_MODIFIER_MASK) != 0) {startCompletion((JTextField) e.getComponent());e.consume();}diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.javaindex fd3da3e359..15ccad9bad 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java@@ -102,10 +102,11 @@ public class FieldPanel extends JPanel// initialize the focus traversal keys to control Tab to free up the tab key for internal// field panel use. This is the same behavior that text components use.- KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK);+ KeyStroke ks =+ KeyStroke.getKeyStroke(KeyEvent.VK_TAB, DockingUtils.CONTROL_KEY_MODIFIER_MASK);setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Set.of(ks));ks = KeyStroke.getKeyStroke(KeyEvent.VK_TAB,- InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);+ DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK);setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Set.of(ks));addKeyListener(new FieldPanelKeyAdapter());diff --git a/Ghidra/Framework/Docking/src/test/java/docking/widgets/DropDownTextFieldTest.java b/Ghidra/Framework/Docking/src/test/java/docking/widgets/DropDownTextFieldTest.javaindex bb379e3eb4..7cc401ce48 100644--- a/Ghidra/Framework/Docking/src/test/java/docking/widgets/DropDownTextFieldTest.java+++ b/Ghidra/Framework/Docking/src/test/java/docking/widgets/DropDownTextFieldTest.java@@ -19,13 +19,15 @@ import static org.junit.Assert.*;import java.awt.Dimension;import java.awt.Point;-import java.awt.event.*;+import java.awt.event.KeyEvent;+import java.awt.event.MouseEvent;import javax.swing.JList;import javax.swing.JWindow;import org.junit.Test;+import docking.DockingUtils;import docking.widgets.DropDownTextFieldDataModel.SearchMode;/**@@ -639,7 +641,7 @@ public class DropDownTextFieldTest extends AbstractDropDownTextFieldTest<String>Point p = searchModeBounds.getLocation();long when = System.currentTimeMillis();- int mods = useControlKey ? InputEvent.CTRL_DOWN_MASK : 0;+ int mods = useControlKey ? DockingUtils.CONTROL_KEY_MODIFIER_MASK : 0;int x = p.x + 3; // add some fudgeint y = p.y + 3; // add some fudgeint clickCount = 1;@@ -650,11 +652,13 @@ public class DropDownTextFieldTest extends AbstractDropDownTextFieldTest<String>}private void toggleSearchModeViaKeyBinding() {- triggerKey(textField, InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_DOWN, KeyEvent.CHAR_UNDEFINED);+ triggerKey(textField, DockingUtils.CONTROL_KEY_MODIFIER_MASK, KeyEvent.VK_DOWN,+ KeyEvent.CHAR_UNDEFINED);}private void toggleSearchModeViaKeyBinding_Backwards() {- triggerKey(textField, InputEvent.CTRL_DOWN_MASK, KeyEvent.VK_UP, KeyEvent.CHAR_UNDEFINED);+ triggerKey(textField, DockingUtils.CONTROL_KEY_MODIFIER_MASK, KeyEvent.VK_UP,+ KeyEvent.CHAR_UNDEFINED);}private void showMatchingList() {diff --git a/Ghidra/Framework/Generic/src/main/java/generic/util/action/SystemKeyBindings.java b/Ghidra/Framework/Generic/src/main/java/generic/util/action/SystemKeyBindings.javaindex 2ec41dabf7..7ee28a4007 100644--- a/Ghidra/Framework/Generic/src/main/java/generic/util/action/SystemKeyBindings.java+++ b/Ghidra/Framework/Generic/src/main/java/generic/util/action/SystemKeyBindings.java@@ -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.@@ -20,7 +20,6 @@ import static java.awt.event.KeyEvent.*;import static javax.swing.KeyStroke.*;import java.awt.Toolkit;-import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import javax.swing.KeyStroke;@@ -54,8 +53,7 @@ public class SystemKeyBindings {public static final KeyStroke COMPONENT_THEME_INFO_KEY = getKeyStroke(VK_F9, CTRL_ALT_SHIFT);- public static final KeyStroke ACTION_CHOOSER_KEY =- KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.CTRL_DOWN_MASK);+ public static final KeyStroke ACTION_CHOOSER_KEY = getKeyStroke(KeyEvent.VK_3, CTRL);private SystemKeyBindings() {// utils classdiff --git a/Ghidra/Framework/Gui/src/main/java/gui/event/MouseBinding.java b/Ghidra/Framework/Gui/src/main/java/gui/event/MouseBinding.javaindex dfe8eed739..12810bfb0e 100644--- a/Ghidra/Framework/Gui/src/main/java/gui/event/MouseBinding.java+++ b/Ghidra/Framework/Gui/src/main/java/gui/event/MouseBinding.java@@ -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.@@ -17,6 +17,7 @@ package gui.event;import static org.apache.commons.lang3.StringUtils.*;+import java.awt.Toolkit;import java.awt.event.InputEvent;import java.awt.event.MouseEvent;import java.util.*;@@ -143,7 +144,8 @@ public class MouseBinding {iterator.remove();}else if (indexOfIgnoreCase(piece, CTRL) != -1) {- modifiers |= InputEvent.CTRL_DOWN_MASK;+ // This is the cross platform way to get the control key+ modifiers |= Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();iterator.remove();}else if (indexOfIgnoreCase(piece, ALT) != -1) {diff --git a/Ghidra/Framework/Gui/src/test/java/gui/event/MouseBindingTest.java b/Ghidra/Framework/Gui/src/test/java/gui/event/MouseBindingTest.javaindex 1855faf4bd..894440db51 100644--- a/Ghidra/Framework/Gui/src/test/java/gui/event/MouseBindingTest.java+++ b/Ghidra/Framework/Gui/src/test/java/gui/event/MouseBindingTest.java@@ -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.@@ -17,6 +17,7 @@ package gui.event;import static org.junit.Assert.*;+import java.awt.Toolkit;import java.awt.event.InputEvent;import java.awt.event.MouseEvent;@@ -26,7 +27,7 @@ import org.junit.Test;public class MouseBindingTest {- private static final int CTRL = InputEvent.CTRL_DOWN_MASK;+ private static final int CTRL = Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();private static final int SHIFT = InputEvent.SHIFT_DOWN_MASK;@Testdiff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVSlider.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVSlider.javaindex 0311e6cc18..7715af8a3b 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVSlider.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVSlider.java@@ -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.@@ -17,12 +17,12 @@ package ghidra.framework.main.logviewer.ui;import java.awt.event.*;import java.io.IOException;-import java.util.Iterator;import javax.swing.*;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;+import docking.DockingUtils;import ghidra.framework.main.logviewer.event.*;import ghidra.framework.main.logviewer.event.FVEvent.EventType;import ghidra.framework.main.logviewer.model.*;@@ -100,7 +100,6 @@ public class FVSlider extends JSlidercreateKeyBindings(table, model, reader, eventListener);}-/*** Sets the value of the slider based on the given file position.*@@ -143,11 +142,7 @@ public class FVSlider extends JSlider// Once we have that byte value, just set the slider to be the same.//int chunkRowStart = 0;- Iterator<Chunk> iter = model.iterator();-- while (iter.hasNext()) {- Chunk chunk = iter.next();-+ for (Chunk chunk : model) {// Figure out the starting row of the next chunk. If the row we want is less than// that, then we know we've found the chunk that contains our row.chunkRowStart += chunk.linesInChunk;@@ -208,7 +203,7 @@ public class FVSlider extends JSliderFVEvent tailOffEvt = new FVEvent(EventType.SCROLL_LOCK_ON, null);eventListener.send(tailOffEvt);-+FVEvent sliderChangedEvt = new FVEvent(EventType.SLIDER_CHANGED, filePosition);eventListener.send(sliderChangedEvt);@@ -257,7 +252,7 @@ public class FVSlider extends JSliderpublic void mouseExited(MouseEvent e) {// do nothing}-+/*** Returns the file position (long) for the given slider position (int). This is calculated by* computing the position of the slider as a percentage of its maximum, and applying the same@@ -325,7 +320,7 @@ public class FVSlider extends JSlider*/private void createKeyBindings(FVTable table, ChunkModel model, ChunkReader reader,FVEventListener eventListener) {-+// These key bindings are identical to the ones set in the FVTable class. These are// necessary for cases where the user hits a key that should manipulate the table, but// keyboard focus is on the slider.@@ -343,37 +338,41 @@ public class FVSlider extends JSlideram_table.put("Home", new HomeAction(eventListener));im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), "End");am_table.put("End", new EndAction(eventListener));-+// Recognize when the shift key has been pressed and released, so we know how to handle// selection.- im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.SHIFT_DOWN_MASK, false), "ShiftPressed");+ im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.SHIFT_DOWN_MASK, false),+ "ShiftPressed");am_table.put("ShiftPressed", new AbstractAction() {@Overridepublic void actionPerformed(ActionEvent e) {- table.setShiftDown(true);- }+ table.setShiftDown(true);+ }});im_table.put(KeyStroke.getKeyStroke("released SHIFT"), "ShiftReleased");am_table.put("ShiftReleased", new AbstractAction() {@Overridepublic void actionPerformed(ActionEvent e) {- table.setShiftDown(false);- }+ table.setShiftDown(false);+ }});-+// Now create a binding for the CTRL-A, select all action.- im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK, false), "SelectAll");- im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.META_DOWN_MASK, false), "SelectAll");+ im_table.put(+ KeyStroke.getKeyStroke(KeyEvent.VK_A, DockingUtils.CONTROL_KEY_MODIFIER_MASK, false),+ "SelectAll");+ im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.META_DOWN_MASK, false),+ "SelectAll");am_table.put("SelectAll", new AbstractAction() {@Overridepublic void actionPerformed(ActionEvent e) {try {model.selectedByteStart = 0;- model.selectedByteEnd = reader.getFileSize()-1;-+ model.selectedByteEnd = reader.getFileSize() - 1;+FVEvent copyEvt = new FVEvent(EventType.COPY_SELECTION, null);eventListener.send(copyEvt);}@@ -383,5 +382,5 @@ public class FVSlider extends JSlider}});}-+}diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVTable.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVTable.javaindex a4a1ccdd86..125a0385e7 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVTable.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/logviewer/ui/FVTable.java@@ -27,6 +27,7 @@ import javax.swing.event.ListSelectionEvent;import javax.swing.table.TableCellRenderer;import javax.swing.table.TableColumn;+import docking.DockingUtils;import docking.widgets.table.GTable;import ghidra.framework.main.logviewer.event.*;import ghidra.framework.main.logviewer.event.FVEvent.EventType;@@ -92,8 +93,9 @@ public class FVTable extends GTable// Set the cell renderer that will set the background color of the row based// on the log level.- getColumnModel().getColumn(FVTableModel.LEVEL_COL).setCellRenderer(- new LogLevelTableCellRenderer());+ getColumnModel().getColumn(FVTableModel.LEVEL_COL)+ .setCellRenderer(+ new LogLevelTableCellRenderer());// The selection listener is kicked off whenever the table selection has been changed. We// need to know this so we can store the selection in the viewport utility.@@ -282,7 +284,7 @@ public class FVTable extends GTablereturn;}((FVTableModel) getModel()).removeRowsFromTop(chunk.linesInChunk);-+// Now slide the viewport back up to account for what we just read in.viewportUtility.moveViewportUp(chunk.linesInChunk, false);}@@ -354,7 +356,7 @@ public class FVTable extends GTablereturn;}((FVTableModel) getModel()).removeRowsFromTop(chunk.linesInChunk);-+// Now slide the viewport back up to account for what we just read in.viewportUtility.moveViewportUp(chunk.linesInChunk, false);}@@ -413,7 +415,7 @@ public class FVTable extends GTable// Now slide the viewport back up to account for what we just read in.viewportUtility.moveViewportDown(lines.size(), false);-+if (model.getSize() > model.MAX_VISIBLE_CHUNKS) {Chunk chunk = model.remove(model.getSize() - 1);if (chunk == null) {@@ -488,7 +490,7 @@ public class FVTable extends GTable// Now slide the viewport back up to account for what we just read in.viewportUtility.moveViewportDown(lines.size(), false);-+// And remove chunks if necessary.if (model.getSize() > model.MAX_VISIBLE_CHUNKS) {Chunk chunk = model.remove(model.getSize() - 1);@@ -499,7 +501,6 @@ public class FVTable extends GTable}});-}catch (IOException e) {Msg.error(this, "Error reading previous chunk of data", e);@@ -545,8 +546,9 @@ public class FVTable extends GTableelse {Pair filePosFirstRow = model.getFilePositionForRow(selectedRows[0]);- Pair filePosLastRow = model.getFilePositionForRow(selectedRows[selectedRows.length - 1]);-+ Pair filePosLastRow =+ model.getFilePositionForRow(selectedRows[selectedRows.length - 1]);+if (filePosFirstRow == null || filePosLastRow == null) {return;}@@ -625,7 +627,8 @@ public class FVTable extends GTableam_table.put("PageUpSelection", new PageUpSelectionAction(eventListener));// Set up a key binding for copying selected rows to the clipboard.- im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK), "copyText");+ im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DockingUtils.CONTROL_KEY_MODIFIER_MASK),+ "copyText");im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.META_DOWN_MASK), "copyText");am_table.put("copyText", new AbstractAction() {@@ -658,7 +661,8 @@ public class FVTable extends GTable});// Now create a binding for the CTRL-A, select all action.- im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK, false),+ im_table.put(+ KeyStroke.getKeyStroke(KeyEvent.VK_A, DockingUtils.CONTROL_KEY_MODIFIER_MASK, false),"SelectAll");im_table.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.META_DOWN_MASK, false),"SelectAll");diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCopyAction.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCopyAction.javaindex e705ef56f8..b635b8049c 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCopyAction.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCopyAction.java@@ -15,16 +15,16 @@*/package ghidra.framework.main.projectdata.actions;-import java.awt.event.InputEvent;-import javax.swing.Icon;import javax.swing.tree.TreePath;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import generic.theme.GIcon;import ghidra.framework.main.AppInfo;-import ghidra.framework.main.datatree.*;+import ghidra.framework.main.datatree.DataTreeClipboardUtils;+import ghidra.framework.main.datatree.FrontEndProjectTreeContext;import ghidra.framework.model.Project;import ghidra.util.HelpLocation;@@ -34,7 +34,7 @@ public class ProjectDataCopyAction extends ProjectDataCopyCutBaseAction {public ProjectDataCopyAction(String owner, String group) {super("Copy", owner);setPopupMenuData(new MenuData(new String[] { "Copy" }, icon, group));- setKeyBindingData(new KeyBindingData('C', InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(new KeyBindingData('C', DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation("FrontEndPlugin", "Copy"));}diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCutAction.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCutAction.javaindex 61106dc85f..cd1974221c 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCutAction.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataCutAction.java@@ -15,11 +15,10 @@*/package ghidra.framework.main.projectdata.actions;-import java.awt.event.InputEvent;-import javax.swing.Icon;import javax.swing.tree.TreePath;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.widgets.tree.GTreeNode;@@ -34,7 +33,7 @@ public class ProjectDataCutAction extends ProjectDataCopyCutBaseAction {public ProjectDataCutAction(String owner, String group) {super("Cut", owner);setPopupMenuData(new MenuData(new String[] { "Cut" }, ICON, group));- setKeyBindingData(new KeyBindingData('X', InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(new KeyBindingData('X', DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation("FrontEndPlugin", "Cut"));}diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataPasteAction.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataPasteAction.javaindex 4fbd1b720b..19518d74d6 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataPasteAction.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataPasteAction.java@@ -15,13 +15,13 @@*/package ghidra.framework.main.projectdata.actions;-import java.awt.event.InputEvent;import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.swing.Icon;+import docking.DockingUtils;import docking.action.KeyBindingData;import docking.action.MenuData;import docking.widgets.tree.GTreeNode;@@ -39,7 +39,7 @@ public class ProjectDataPasteAction extends ProjectDataCopyCutBaseAction {public ProjectDataPasteAction(String owner, String group) {super("Paste", owner);setPopupMenuData(new MenuData(new String[] { "Paste" }, ICON, group));- setKeyBindingData(new KeyBindingData('V', InputEvent.CTRL_DOWN_MASK));+ setKeyBindingData(new KeyBindingData('V', DockingUtils.CONTROL_KEY_MODIFIER_MASK));setHelpLocation(new HelpLocation("FrontEndPlugin", "Paste"));}