Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison src/name/blackcap/clipman/Menus.kt @ 30:0e88c6bed11e
Remove the troublesome delete command(s).
author | David Barts <n5jrn@me.com> |
---|---|
date | Wed, 29 Jan 2020 21:56:12 -0800 |
parents | f1fcc1281dad |
children | 0c6c18a733b7 |
comparison
equal
deleted
inserted
replaced
29:c4f53bc01732 | 30:0e88c6bed11e |
---|---|
15 */ | 15 */ |
16 class MenuItemListener: ActionListener { | 16 class MenuItemListener: ActionListener { |
17 override fun actionPerformed(e: ActionEvent) { | 17 override fun actionPerformed(e: ActionEvent) { |
18 when (e.actionCommand) { | 18 when (e.actionCommand) { |
19 "File.Quit" -> System.exit(0) | 19 "File.Quit" -> System.exit(0) |
20 "Edit.Clone" -> onlyIfSelected { queue.v.add(it) } | 20 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) } |
21 "Edit.Coerce" -> onlyIfSelected { doCoerceFonts(it) } | 21 "Edit.Coerce" -> onlyIfSelected { doCoerceFonts(it) } |
22 "Edit.Delete" -> onlyIfSelected { | |
23 queue.v.delete(it) | |
24 SelectionRequired.disable() | |
25 } | |
26 "Edit.Find" -> searchDialog.setVisible(true) | 22 "Edit.Find" -> searchDialog.setVisible(true) |
27 "Edit.FindAgain" -> searchDialog.find() | 23 "Edit.FindAgain" -> searchDialog.find() |
28 else -> throw RuntimeException("unexpected actionCommand!") | 24 else -> throw RuntimeException("unexpected actionCommand!") |
29 } | 25 } |
30 } | 26 } |
74 setEnabled(false) | 70 setEnabled(false) |
75 actionCommand = "Edit.Coerce" | 71 actionCommand = "Edit.Coerce" |
76 addActionListener(menuItemListener) | 72 addActionListener(menuItemListener) |
77 makeShortcut(KeyEvent.VK_K) | 73 makeShortcut(KeyEvent.VK_K) |
78 })) | 74 })) |
79 add(SelectionRequired.add(JMenuItem("Delete").apply { | |
80 setEnabled(false) | |
81 actionCommand = "Edit.Delete" | |
82 addActionListener(menuItemListener) | |
83 setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)) | |
84 })) | |
85 add(JMenuItem("Find…").apply { | 75 add(JMenuItem("Find…").apply { |
86 actionCommand = "Edit.Find" | 76 actionCommand = "Edit.Find" |
87 addActionListener(menuItemListener) | 77 addActionListener(menuItemListener) |
88 makeShortcut(KeyEvent.VK_F) | 78 makeShortcut(KeyEvent.VK_F) |
89 }) | 79 }) |
128 })) | 118 })) |
129 add(SelectionRequired.add(JMenuItem("Coerce…").apply { | 119 add(SelectionRequired.add(JMenuItem("Coerce…").apply { |
130 actionCommand = "Edit.Coerce" | 120 actionCommand = "Edit.Coerce" |
131 addActionListener(menuItemListener) | 121 addActionListener(menuItemListener) |
132 })) | 122 })) |
133 add(SelectionRequired.add(JMenuItem("Delete").apply { | |
134 actionCommand = "Edit.Delete" | |
135 addActionListener(menuItemListener) | |
136 })) | |
137 } | 123 } |
138 } | 124 } |
139 | 125 |
140 val popupMenu = MyPopupMenu() | 126 val popupMenu = MyPopupMenu() |
141 | 127 |