01: /*
02: * DeleteListEntryAction.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.actions;
13:
14: import java.awt.event.ActionEvent;
15: import java.awt.event.KeyEvent;
16: import javax.swing.KeyStroke;
17:
18: import workbench.interfaces.FileActions;
19: import workbench.log.LogMgr;
20: import workbench.resource.ResourceMgr;
21:
22: /**
23: * Delete an etry from a List
24: * @author support@sql-workbench.net
25: */
26: public class DeleteListEntryAction extends WbAction {
27: private FileActions client;
28:
29: public DeleteListEntryAction(FileActions aClient) {
30: this (aClient, "LblDeleteListEntry");
31: }
32:
33: public DeleteListEntryAction(FileActions aClient, String aKey) {
34: this .client = aClient;
35: this .setMenuTextByKey(aKey);
36: this .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,
37: 0));
38: this .setIcon(ResourceMgr.getImage("Delete"));
39: }
40:
41: public void executeAction(ActionEvent e) {
42: try {
43: this .client.deleteItem();
44: } catch (Exception ex) {
45: LogMgr.logError(this , "Error saving profiles", ex);
46: }
47: }
48: }
|