ca.sqlpower.wabit.swingui.action
Class SaveWorkspaceAction

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

public class SaveWorkspaceAction
extends javax.swing.AbstractAction

This will save the active session in the context to the file where the user last loaded or saved the session. If the user has not yet saved or loaded the sessions it will prompt the user for a file location.

See Also:
Serialized Form

Field Summary
 
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
SaveWorkspaceAction(WabitSwingSessionContext context)
          This will save the active session in the context to the file where the user last loaded or saved the session.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
static boolean save(WabitSwingSessionContext context, WabitSwingSession session)
          Saves the given workspace to the given file or if the file does not exist the save as method will be called to let the user choose a file to save the workspace to.
static boolean saveAllSessions(WabitSwingSessionContext context)
          This method will save all of the sessions in the given context to their recent 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
 

Constructor Detail

SaveWorkspaceAction

public SaveWorkspaceAction(WabitSwingSessionContext context)
This will save the active session in the context to the file where the user last loaded or saved the session. If the user has not yet saved or loaded the sessions it will prompt the user for a file location.

Parameters:
context - The context to use to get the active session from.
Method Detail

actionPerformed

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

save

public static boolean save(WabitSwingSessionContext context,
                           WabitSwingSession session)
Saves the given workspace to the given file or if the file does not exist the save as method will be called to let the user choose a file to save the workspace to.

Parameters:
context - The context that contains the workspace. Used to update the the recent menu in the context.
session - The session whose workspace will be saved to the most recent file it was saved to or loaded from. If the session is new and has no recent file the user will be prompted for it. If this is null false will be returned.
Returns:
If the save was successful or not

saveAllSessions

public static boolean saveAllSessions(WabitSwingSessionContext context)
This method will save all of the sessions in the given context to their recent files. If a session does not have a valid file that it was recently saved to or loaded from the user will be prompted to select a file location.

Parameters:
context - The context to save its sessions to files
Returns:
True if all of the sessions were saved successfully. False otherwise.


Copyright © 2009. All Rights Reserved.