01: /*
02: * CutCopyPastePopup.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.menu;
13:
14: import javax.swing.JPopupMenu;
15:
16: import workbench.gui.actions.CopyAction;
17: import workbench.gui.actions.CutAction;
18: import workbench.gui.actions.PasteAction;
19: import workbench.gui.actions.WbAction;
20: import workbench.interfaces.ClipboardSupport;
21:
22: /**
23: * A popup menu with the usual Cut, Copy and Paste entries for text fields.
24: *
25: * @author support@sql-workbench.net
26: */
27: public class CutCopyPastePopup extends JPopupMenu {
28: private CopyAction copy;
29: private PasteAction paste;
30: private CutAction cut;
31:
32: public CutCopyPastePopup(ClipboardSupport aClient) {
33: this .cut = new CutAction(aClient);
34: this .add(cut.getMenuItem());
35: this .copy = new CopyAction(aClient);
36: this .add(this .copy.getMenuItem());
37: this .paste = new PasteAction(aClient);
38: this .add(this .paste.getMenuItem());
39: }
40:
41: public void addAction(WbAction anAction, boolean withSep) {
42: if (withSep)
43: this .addSeparator();
44: this .add(anAction.getMenuItem());
45: }
46:
47: public WbAction getCopyAction() {
48: return this .copy;
49: }
50:
51: public WbAction getCutAction() {
52: return this .cut;
53: }
54:
55: public WbAction getPasteAction() {
56: return this.paste;
57: }
58: }
|