01: /*
02: * SaveDataAsAction.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.WbTable;
16: import workbench.gui.dialogs.export.DataStoreExporter;
17:
18: import workbench.resource.ResourceMgr;
19:
20: /**
21: * Save the content of the ResultSet as an external file
22: * @see workbench.gui.dialogs.export.DataStoreExporter
23: * @author support@sql-workbench.net
24: */
25: public class SaveDataAsAction extends WbAction {
26: private WbTable client;
27:
28: public SaveDataAsAction(WbTable aClient) {
29: super ();
30: this .client = aClient;
31: this .initMenuDefinition("MnuTxtSaveDataAs");
32: this .setIcon(ResourceMgr.getImage("SaveAs"));
33: this .setMenuItemName(ResourceMgr.MNU_TXT_DATA);
34: this .setEnabled(false);
35: }
36:
37: public void executeAction(ActionEvent e) {
38: if (client.getDataStore().getUpdateTable() == null) {
39: client.detectDefinedPkColumns();
40: }
41: DataStoreExporter exporter = new DataStoreExporter(this.client
42: .getDataStore(), this.client);
43: exporter.saveAs();
44: }
45: }
|