comparison src/name/blackcap/clipman/Menus.kt @ 49:bb80148e2cb3

Log exit from File? Quit.
author David Barts <n5jrn@me.com>
date Sun, 12 Apr 2020 17:03:11 -0700
parents 19d9da731c43
children 22725d4d7849
comparison
equal deleted inserted replaced
48:7a75c743f973 49:bb80148e2cb3
6 import java.awt.Container 6 import java.awt.Container
7 import java.awt.Toolkit 7 import java.awt.Toolkit
8 import java.awt.event.ActionEvent 8 import java.awt.event.ActionEvent
9 import java.awt.event.ActionListener 9 import java.awt.event.ActionListener
10 import java.awt.event.KeyEvent 10 import java.awt.event.KeyEvent
11 import java.util.logging.Level
12 import java.util.logging.Logger
11 import javax.swing.* 13 import javax.swing.*
12 import kotlin.collections.HashSet 14 import kotlin.collections.HashSet
13 15
14 /** 16 /**
15 * Listen to actionEvents from both menu bar and popup menu selections. 17 * Listen to actionEvents from both menu bar and popup menu selections.
16 */ 18 */
17 class MenuItemListener: ActionListener { 19 class MenuItemListener: ActionListener {
18 override fun actionPerformed(e: ActionEvent) { 20 override fun actionPerformed(e: ActionEvent) {
19 when (e.actionCommand) { 21 when (e.actionCommand) {
20 "File.Quit" -> System.exit(0) 22 "File.Quit" -> {
23 LOGGER.log(Level.INFO, "execution complete")
24 System.exit(0)
25 }
21 "File.Preferences" -> Application.settingsDialog.setVisible(true) 26 "File.Preferences" -> Application.settingsDialog.setVisible(true)
22 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) } 27 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) }
23 "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) } 28 "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) }
24 "Edit.Find" -> Application.searchDialog.setVisible(true) 29 "Edit.Find" -> Application.searchDialog.setVisible(true)
25 "Edit.FindAgain" -> Application.searchDialog.find() 30 "Edit.FindAgain" -> Application.searchDialog.find()