01: /*
02: * CopySelectedAsSqlDeleteInsertAction.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 workbench.gui.components.ClipBoardCopier;
16:
17: import workbench.gui.components.WbTable;
18: import workbench.resource.ResourceMgr;
19:
20: /**
21: * Action to copy the selected content of a table to the clipboard as pairs of
22: * DELETE/INSERT statements
23: * @see workbench.gui.components.ClipBoardCopier
24: * @author support@sql-workbench.net
25: */
26: public class CopySelectedAsSqlDeleteInsertAction extends WbAction {
27: private WbTable client;
28:
29: public CopySelectedAsSqlDeleteInsertAction(WbTable aClient) {
30: super ();
31: this .client = aClient;
32: this .initMenuDefinition("MnuTxtCopySelectedAsSqlDeleteInsert");
33: this .setMenuItemName(ResourceMgr.MNU_TXT_COPY_SELECTED);
34: this .setEnabled(false);
35: }
36:
37: public boolean hasCtrlModifier() {
38: return true;
39: }
40:
41: public boolean hasShiftModifier() {
42: return true;
43: }
44:
45: public void executeAction(ActionEvent e) {
46: ClipBoardCopier copier = new ClipBoardCopier(this .client);
47: copier.copyAsSqlDeleteInsert(true, isCtrlPressed(e));
48: }
49:
50: }
|