ca.sqlpower.wabit.swingui.action
Class SaveWorkspaceAsAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by ca.sqlpower.wabit.swingui.action.SaveWorkspaceAsAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class SaveWorkspaceAsAction
extends javax.swing.AbstractAction

This action will save the active workspace in the given context to a user specified file. This class also contains a static method for saving all sessions to user selected files.

See Also:
Serialized Form

Nested Class Summary
static class SaveWorkspaceAsAction.SaveException
          This exception is used to show exceptions during saving.
 
Field Summary
static java.lang.String WABIT_FILE_EXTENSION
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
SaveWorkspaceAsAction(WabitSwingSessionContext context)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
static boolean save(WabitSwingSessionContext context, WabitSwingSession session)
          Saves the workspace in the given session to a user specified file.
static boolean saveAllSessions(WabitSwingSessionContext context)
          This method will save all of the sessions in the context to their files.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WABIT_FILE_EXTENSION

public static final java.lang.String WABIT_FILE_EXTENSION
See Also:
Constant Field Values
Constructor Detail

SaveWorkspaceAsAction

public SaveWorkspaceAsAction(WabitSwingSessionContext context)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

save

public static boolean save(WabitSwingSessionContext context,
                           WabitSwingSession session)
Saves the workspace in the given session to a user specified file. Returns true if the file was saved. Returns false if the file was not saved or cancelled. If the given session is null false will be returned.

Parameters:
context - The context to parent dialogs to and update its recent menu.
session - The session to save.

saveAllSessions

public static boolean saveAllSessions(WabitSwingSessionContext context)
This method will save all of the sessions in the context to their files. Before the sessions are saved the user will be prompted with a dialog that displays the workspaces and their target files and allows the user to edit the target file for each session.

Parameters:
context - The context whose sessions will be saved to user specified files. This cannot be null.
Returns:
True if the sessions were saved successfully. False otherwise.


Copyright © 2009. All Rights Reserved.