01: /*
02: * NewListEntryAction.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:
17: import workbench.interfaces.FileActions;
18: import workbench.log.LogMgr;
19: import workbench.resource.ResourceMgr;
20: import workbench.util.StringUtil;
21:
22: /**
23: * @author support@sql-workbench.net
24: */
25: public class NewListEntryAction extends WbAction {
26: private FileActions client;
27: private boolean checkShift = true;
28:
29: public NewListEntryAction(FileActions aClient, String aKey) {
30: this .client = aClient;
31: this .initMenuDefinition(aKey);
32: this .setIcon(ResourceMgr.getImage("New"));
33: }
34:
35: public NewListEntryAction(FileActions aClient) {
36: this .client = aClient;
37: this .setIcon(ResourceMgr.getImage("New"));
38: this .checkShift = true;
39: String tip = ResourceMgr
40: .getDescription("LblNewListEntry", true);
41: this .initMenuDefinition(ResourceMgr
42: .getString("LblNewListEntry"), tip, null);
43: }
44:
45: public void executeAction(ActionEvent e) {
46: try {
47: this .client.newItem(isShiftPressed(e));
48: } catch (Exception ex) {
49: LogMgr.logError("NewListEntryAction.executeAction()",
50: "Error creating new list entry", ex);
51: }
52:
53: }
54: }
|