01: /*
02: * CopyAsSqlInsertAction.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.InputEvent;
16: import java.awt.event.KeyEvent;
17:
18: import javax.swing.KeyStroke;
19: import workbench.gui.components.ClipBoardCopier;
20:
21: import workbench.gui.components.WbTable;
22: import workbench.resource.ResourceMgr;
23:
24: /**
25: * Action to copy the contents of a table to the clipboard as SQL INSERT statements
26: * @see workbench.gui.components.ClipBoardCopier
27: * @author support@sql-workbench.net
28: */
29: public class CopyAsSqlInsertAction extends WbAction {
30: private WbTable client;
31:
32: public CopyAsSqlInsertAction(WbTable aClient) {
33: super ();
34: this .client = aClient;
35: this .initMenuDefinition("MnuTxtCopyAsSqlInsert", KeyStroke
36: .getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK));
37: this .setMenuItemName(ResourceMgr.MNU_TXT_DATA);
38: this .setEnabled(false);
39: }
40:
41: public boolean hasCtrlModifier() {
42: return true;
43: }
44:
45: public boolean hasShiftModifier() {
46: return true;
47: }
48:
49: public void executeAction(ActionEvent e) {
50: ClipBoardCopier copier = new ClipBoardCopier(this .client);
51: copier.copyAsSqlInsert(false, isCtrlPressed(e));
52: }
53:
54: }
|