- Timestamp:
- 2021-08-02T02:17:16+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r17188 r18111 10 10 import java.util.Optional; 11 11 12 import javax.swing.MenuElement; 13 import javax.swing.MenuSelectionManager; 12 14 import javax.swing.SwingUtilities; 13 15 … … 51 53 if (e.getActionCommand() == null) { 52 54 String topic; 53 if (e.getSource() instanceof Component) { 55 MenuElement[] menuPath = MenuSelectionManager.defaultManager().getSelectedPath(); 56 if (menuPath.length > 0) { 57 // Get help topic from last element in selected menu path (usually a JMenuItem). 58 // If a JMenu is selected, which shows a JPopupMenu, then the last path element 59 // is a JPopupMenu and it is necessary to look also into previous path elements. 60 topic = null; 61 for (int i = menuPath.length - 1; i >= 0; i--) { 62 Component c = menuPath[i].getComponent(); 63 topic = HelpUtil.getContextSpecificHelpTopic(c); 64 if (topic != null) { 65 break; 66 } 67 } 68 } else if (e.getSource() instanceof Component) { 54 69 Component c = SwingUtilities.getRoot((Component) e.getSource()); 55 70 Point mouse = c.getMousePosition();
Note:
See TracChangeset
for help on using the changeset viewer.