diff --git a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParamsDialog.java b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParamsDialog.java index 801ad2d73b..dbba764f20 100644 --- a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParamsDialog.java +++ b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParamsDialog.java @@ -154,7 +154,7 @@ public class FunctionStartRFParamsDialog extends ReusableDialogComponentProvider private RandomForestTableModel tableModel; private Program trainingSource; private FunctionStartRFParams params; - private Vector moduli = new Vector<>(Arrays.asList(new Long[] { 4l, 8l, 16l, 32l })); + private List moduli = Arrays.asList(new Long[] { 4l, 8l, 16l, 32l }); private GComboBox modBox; private JButton trainButton; private JCheckBox includeBeforeAndAfterBox; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java index 7e09717f8c..f02fd816de 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java @@ -115,7 +115,6 @@ public class CreateBookmarkDialog extends DialogComponentProvider { categoryComboBox = new GhidraComboBox<>(getModel()); categoryComboBox.setEditable(true); - categoryComboBox.setEnterKeyForwarding(true); descriptionTextField = new JTextField(20); panel.add(new JLabel("Address: ", SwingConstants.RIGHT)); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/AbstractSettingsDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/AbstractSettingsDialog.java index f746cb190f..c14c093afc 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/AbstractSettingsDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/AbstractSettingsDialog.java @@ -235,7 +235,13 @@ public abstract class AbstractSettingsDialog extends DialogComponentProvider { @Override protected void okCallback() { - settingsTable.editingStopped(null); + + // prevent users from closing the dialog when pressing Enter to confirm an edit + if (settingsTable.isEditing()) { + settingsTable.editingStopped(null); + return; + } + apply(); close(); dispose(); @@ -694,8 +700,6 @@ public abstract class AbstractSettingsDialog extends DialogComponentProvider { private SettingsRowObject rowobject; SettingsEditor() { - comboBox.setEnterKeyForwarding(false); - comboBox.addActionListener(e -> fireEditingStopped()); intTextField.addChangeListener(e -> updateHexMode()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/AnnotationHandlerDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/AnnotationHandlerDialog.java index 4208d14782..daaebf3130 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/AnnotationHandlerDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/AnnotationHandlerDialog.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,8 +16,6 @@ package ghidra.app.plugin.core.datamgr.actions; import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.List; import javax.swing.JPanel; @@ -72,12 +70,6 @@ class AnnotationHandlerDialog extends DialogComponentProvider { outerPanel.getAccessibleContext().setAccessibleName("Annotation Handler"); handlerComboBox = new GhidraComboBox<>(handlerList); handlerComboBox.getAccessibleContext().setAccessibleName("Combo Box"); - handlerComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - okCallback(); - } - }); outerPanel.add(handlerComboBox, BorderLayout.NORTH); return outerPanel; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java index 2912c5b421..37d9b0cf57 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java @@ -63,7 +63,7 @@ public class OperandLabelDialog extends DialogComponentProvider { myChoice = new GhidraComboBox<>(); myChoice.setName("MYCHOICE"); myChoice.setEditable(true); - myChoice.addActionListener(ev -> okCallback()); + myChoice.getAccessibleContext().setAccessibleName("My Choice"); mainPanel.add(label); mainPanel.add(myChoice); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextDialog.java index 364c576c9b..3936aef131 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextDialog.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. @@ -192,12 +192,6 @@ class SearchTextDialog extends ReusableDialogComponentProvider { valueComboBox = new GhidraComboBox<>(); valueComboBox.setEditable(true); valueComboBox.setColumns(20); - valueComboBox.addActionListener(ev -> { - if (nextButton.isEnabled()) { - nextPrevious(true); // go forward - valueComboBox.requestFocus(); - } - }); valueComboBox.addEditorKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/EncodedStringsDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/EncodedStringsDialog.java index 0ec7c35352..87cc612a54 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/EncodedStringsDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/EncodedStringsDialog.java @@ -16,7 +16,8 @@ package ghidra.app.plugin.core.strings; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.io.File; import java.io.IOException; import java.lang.Character.UnicodeScript; @@ -449,35 +450,6 @@ public class EncodedStringsDialog extends DialogComponentProvider { EncodedStringsPlugin.CHARSET_DEFAULT_VALUE)); charsetComboBox.addItemListener(itemListener); charsetComboBox.setToolTipText("Which character set to use to decode the raw bytes."); - charsetComboBox.addKeyListener(new KeyListener() { - - @Override - public void keyTyped(KeyEvent e) { - // empty - } - - @Override - public void keyReleased(KeyEvent e) { - // empty - } - - @Override - public void keyPressed(KeyEvent e) { - // Note: we override the [ENTER] key handling to allow the user to invoke the - // dialog and just hit enter to create the string without having to do any - // clicking (otherwise the charset combobox consumes the keystroke) - if (e.getKeyChar() == '\n') { - e.consume(); - if (charsetComboBox.isPopupVisible()) { - charsetComboBox.setPopupVisible(false); - } - else { - EncodedStringsDialog.this.createButton.doClick(); - } - } - } - }); - } private void buildOptionsButtonComponents() { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/AddEditDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/AddEditDialog.java index ed5cbf9fb7..108a3b203c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/AddEditDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/AddEditDialog.java @@ -563,7 +563,6 @@ public class AddEditDialog extends ReusableDialogComponentProvider { labelNameChoices.setColumns(20); labelNameChoices.setName("label.name.choices"); GhidraComboBox comboBox = new GhidraComboBox<>(); - comboBox.setEnterKeyForwarding(true); namespaceChoices = comboBox; primaryCheckBox = new GCheckBox("Primary"); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToAddressLabelDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToAddressLabelDialog.java index 0db1f4e939..7610120838 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToAddressLabelDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToAddressLabelDialog.java @@ -199,7 +199,7 @@ public class GoToAddressLabelDialog extends ReusableDialogComponentProvider comboBox = new GhidraComboBox<>(); comboBox.setEditable(true); - comboBox.addActionListener(evt -> okCallback()); + String comboName = "Go To Address or Label Text Field / Combobox"; comboBox.setName(comboName); comboBox.getAccessibleContext().setAccessibleName(comboName); @@ -243,9 +243,9 @@ public class GoToAddressLabelDialog extends ReusableDialogComponentProvider private void readHistory(SaveState saveState) { String[] strs = saveState.getStrings("GO_TO_HISTORY", null); if (strs != null) { - for (int i = 0; i < strs.length; i++) { - if (!history.contains(strs[i])) { - history.add(strs[i]); + for (String str : strs) { + if (!history.contains(str)) { + history.add(str); } } truncateHistoryAsNeeded(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterDialog.java index 27998ca008..5bd5a9d72b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterDialog.java @@ -266,7 +266,6 @@ public class ImporterDialog extends DialogComponentProvider { Set orderedLoaders = new LinkedHashSet<>(loaderMap.keySet()); // maintain order loaderComboBox = new GhidraComboBox<>(orderedLoaders); loaderComboBox.addItemListener(e -> selectedLoaderChanged()); - loaderComboBox.setEnterKeyForwarding(true); loaderComboBox.getAccessibleContext().setAccessibleName("Loader Choices"); loaderComboBox.setRenderer( GComboBoxCellRenderer.createDefaultTextRenderer(loader -> loader.getName())); diff --git a/Ghidra/Features/DebugUtils/src/main/java/db/DbViewer.java b/Ghidra/Features/DebugUtils/src/main/java/db/DbViewer.java index e030acfded..470b29082e 100644 --- a/Ghidra/Features/DebugUtils/src/main/java/db/DbViewer.java +++ b/Ghidra/Features/DebugUtils/src/main/java/db/DbViewer.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. @@ -157,7 +157,7 @@ public class DbViewer extends JFrame { tables[i].getName() + " (" + Integer.toString(tables[i].getRecordCount()) + ")"; } combo = new GComboBox<>(names); - combo.addActionListener(e -> updateTable()); + combo.addItemListener(e -> updateTable()); subNorthPanel.add(combo); northPanel.add(subNorthPanel); mainPanel.add(northPanel, BorderLayout.NORTH); diff --git a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderDialog.java b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderDialog.java index 2ac4c02df1..7648b814ea 100644 --- a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderDialog.java +++ b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderDialog.java @@ -77,7 +77,6 @@ public class DecompilerTextFinderDialog extends ReusableDialogComponentProvider textCombo = new GhidraComboBox<>(); textCombo.setEditable(true); - textCombo.addActionListener(e -> doSearch()); textCombo.setColumns(20); textCombo.addDocumentListener(new DocumentListener() { diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/PopulateFidDialog.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/PopulateFidDialog.java index 597248a95a..af624e64c0 100644 --- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/PopulateFidDialog.java +++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/PopulateFidDialog.java @@ -257,7 +257,7 @@ public class PopulateFidDialog extends DialogComponentProvider { List fidFileList = FidFileManager.getInstance().getUserAddedFiles(); FidFile[] files = fidFileList.toArray(new FidFile[fidFileList.size()]); fidFileComboBox = new GComboBox<>(files); - fidFileComboBox.addActionListener(e -> updateLibraryChoices()); + fidFileComboBox.addItemListener(e -> updateLibraryChoices()); fidFileComboBox.getAccessibleContext().setAccessibleName("Fid File"); return fidFileComboBox; } diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/actions/ChooseMatchTagAction.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/actions/ChooseMatchTagAction.java index 3a796e2898..a6147e15e5 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/actions/ChooseMatchTagAction.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/actions/ChooseMatchTagAction.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. @@ -127,7 +127,6 @@ public class ChooseMatchTagAction extends DockingAction { tagComboBox = new MatchTagComboBox(session, matches, component, selectedTag); Dimension dim = new Dimension(50, tagComboBox.getPreferredSize().height); tagComboBox.setMinimumSize(dim); - tagComboBox.addActionListener(e -> fieldEdited()); panel.add(tagComboBox, BorderLayout.CENTER); return panel; } @@ -148,12 +147,5 @@ public class ChooseMatchTagAction extends DockingAction { VTMatchTag getSelectedTag() { return selectedTag; } - - /** - * An address edit action occurred in the panel so handle it as if ok button were pressed. - */ - public void fieldEdited() { - okCallback(); - } } } diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/editors/MatchTagCellEditor.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/editors/MatchTagCellEditor.java index 2e9fe437c0..ae36667d21 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/editors/MatchTagCellEditor.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/editors/MatchTagCellEditor.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * 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,10 +15,6 @@ */ package ghidra.feature.vt.gui.editors; -import ghidra.feature.vt.api.main.*; -import ghidra.feature.vt.gui.plugin.VTController; -import ghidra.util.SystemUtilities; - import java.awt.Component; import java.awt.event.*; import java.util.*; @@ -29,6 +24,9 @@ import javax.swing.table.TableCellEditor; import javax.swing.table.TableModel; import docking.widgets.table.RowObjectTableModel; +import ghidra.feature.vt.api.main.*; +import ghidra.feature.vt.gui.plugin.VTController; +import ghidra.util.SystemUtilities; public class MatchTagCellEditor extends AbstractCellEditor implements TableCellEditor { @@ -55,12 +53,6 @@ public class MatchTagCellEditor extends AbstractCellEditor implements TableCellE VTSession session = controller.getSession(); tag = match.getTag(); matchTagChoices = new MatchTagComboBox(session, matches, theTable, tag); - matchTagChoices.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stopCellEditing(); - } - }); matchTagChoices.addItemListener(new ItemListener() { @Override diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/ApplyMarkupPropertyEditor.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/ApplyMarkupPropertyEditor.java index 382873ab52..376a915ceb 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/ApplyMarkupPropertyEditor.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/ApplyMarkupPropertyEditor.java @@ -831,7 +831,7 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor { Enum[] enums = editor.getEnums(); final JComboBox> applyComboBox = new GComboBox<>(enums); - applyComboBox.addActionListener(e -> changesMade(true)); + applyComboBox.addItemListener(e -> changesMade(true)); return applyComboBox; } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/FontPropertyEditor.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/FontPropertyEditor.java index 3765180b9d..06c574c885 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/FontPropertyEditor.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/FontPropertyEditor.java @@ -16,7 +16,7 @@ package docking.options.editor; import java.awt.*; -import java.awt.event.ActionListener; +import java.awt.event.ItemListener; import java.beans.PropertyEditorSupport; import java.util.*; import java.util.List; @@ -65,7 +65,7 @@ public class FontPropertyEditor extends PropertyEditorSupport { private GComboBox fontCombo; private GComboBox sizeCombo; private GComboBox styleCombo; - private ActionListener actionListener = e -> fontChanged(); + private ItemListener itemListener = e -> fontChanged(); private List systemFontNames; public FontChooserPanel() { @@ -78,9 +78,9 @@ public class FontPropertyEditor extends PropertyEditorSupport { } updatePreviewLabel(font); - fontCombo.removeActionListener(actionListener); - sizeCombo.removeActionListener(actionListener); - styleCombo.removeActionListener(actionListener); + fontCombo.removeItemListener(itemListener); + sizeCombo.removeItemListener(itemListener); + styleCombo.removeItemListener(itemListener); FontWrapper fontWrapper = new FontWrapper(font.getName()); updateComboBoxModeIfNeeded(fontWrapper); @@ -91,10 +91,9 @@ public class FontPropertyEditor extends PropertyEditorSupport { sizeCombo.setSelectedItem(size); styleCombo.setSelectedIndex(styleChoice); - fontCombo.addActionListener(actionListener); - sizeCombo.addActionListener(actionListener); - styleCombo.addActionListener(actionListener); - + fontCombo.addItemListener(itemListener); + sizeCombo.addItemListener(itemListener); + styleCombo.addItemListener(itemListener); } private void updateComboBoxModeIfNeeded(FontWrapper fontWrapper) { @@ -144,7 +143,7 @@ public class FontPropertyEditor extends PropertyEditorSupport { styleCombo = new GComboBox<>(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD & ITALIC" }); styleCombo.setMaximumRowCount(9); - styleCombo.addActionListener(actionListener); + styleCombo.addItemListener(itemListener); styleCombo.getAccessibleContext().setAccessibleName("Style"); panel.add(styleCombo); panel.getAccessibleContext().setAccessibleName("Style"); @@ -163,7 +162,7 @@ public class FontPropertyEditor extends PropertyEditorSupport { sizeCombo = new GComboBox<>(IntStream.rangeClosed(1, 72).boxed().toArray(Integer[]::new)); sizeCombo.setMaximumRowCount(9); - sizeCombo.addActionListener(actionListener); + sizeCombo.addItemListener(itemListener); sizeCombo.getAccessibleContext().setAccessibleName("Size"); panel.add(sizeCombo); panel.getAccessibleContext().setAccessibleName("Size"); @@ -182,7 +181,7 @@ public class FontPropertyEditor extends PropertyEditorSupport { systemFontNames = getSystemFontNames(); fontCombo = new GComboBox<>(systemFontNames.toArray(new FontWrapper[0])); fontCombo.setMaximumRowCount(9); - fontCombo.addActionListener(actionListener); + fontCombo.addItemListener(itemListener); fontCombo.getAccessibleContext().setAccessibleName("Font"); panel.add(fontCombo); panel.getAccessibleContext().setAccessibleName("Font"); diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java index 6c5a32ce5d..3655f3b17c 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java @@ -15,6 +15,7 @@ */ package docking.widgets.combobox; +import java.util.Collection; import java.util.Vector; import javax.swing.*; @@ -71,8 +72,8 @@ public class GComboBox extends JComboBox implements GComponent { * * @param items a vector containing objects of generic type {@code E} to insert into the combo box */ - public GComboBox(Vector items) { - super(items); + public GComboBox(Collection items) { + super(new Vector<>(items)); init(); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java index 231d2f9f9b..b1489076ff 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java @@ -64,8 +64,6 @@ public class GhidraComboBox extends JComboBox implements GComponent { private List keyListeners = new ArrayList<>(); private boolean setSelectedFlag = false; - private boolean forwardEnter; - private Action defaultSystemEnterForwardingAction; private Document document; private PassThroughActionListener passThroughActionListener; private PassThroughKeyListener passThroughKeyListener; @@ -125,20 +123,6 @@ public class GhidraComboBox extends JComboBox implements GComponent { setDocument(document); } - // HACK ALERT: see setEnterKeyForwarding(boolean) - ActionMap am = getActionMap(); - if (am != null) { - defaultSystemEnterForwardingAction = am.get("enterPressed"); - am.put("enterPressed", new AbstractAction() { - @Override - public void actionPerformed(ActionEvent e) { - if (forwardEnter) { - defaultSystemEnterForwardingAction.actionPerformed(e); - } - } - }); - } - // As mentioned above, the default editor gets replaced. In that case, restore the columns // if the client has set the value. if (oldColumns > 0) { @@ -147,23 +131,6 @@ public class GhidraComboBox extends JComboBox implements GComponent { } } - /** - * HACK ALERT: By default, the JComboBoxUI forwards the <Enter> key actions to the root - * pane of the JComboBox's container (which is used primarily by any installed 'default - * button'). The problem is that the forwarding does not happen always. In the case that the - * <Enter> key will trigger a selection in the combo box, the action is NOT forwarded. - *

- * By default Ghidra disables the forwarding altogether, since most users of - * {@link GhidraComboBox} will add an action listener to handle <Enter> actions. - *

- * To re-enable the default behavior, set the forwardEnter value to true. - * - * @param forwardEnter true to enable default <Enter> key handling. - */ - public void setEnterKeyForwarding(boolean forwardEnter) { - this.forwardEnter = forwardEnter; - } - /** * Returns the text in combobox's editor text component * @return the text in combobox's editor text component diff --git a/Ghidra/Framework/Docking/src/main/java/ghidra/docking/settings/SettingsDefinition.java b/Ghidra/Framework/Docking/src/main/java/ghidra/docking/settings/SettingsDefinition.java index 033a2244ae..4c87077e2d 100644 --- a/Ghidra/Framework/Docking/src/main/java/ghidra/docking/settings/SettingsDefinition.java +++ b/Ghidra/Framework/Docking/src/main/java/ghidra/docking/settings/SettingsDefinition.java @@ -97,7 +97,7 @@ public interface SettingsDefinition { public String getDescription(); /** - * Removes any values in the given settings object assocated with this settings definition + * Removes any values in the given settings object associated with this settings definition * @param settings the settings object to be cleared. */ public void clear(Settings settings);