ca.sqlpower.wabit.swingui.action
Class OpenWorkspaceAction

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

public class OpenWorkspaceAction
extends javax.swing.AbstractAction

This action will load in workspaces from a user selected file to a given context.

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, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
OpenWorkspaceAction(WabitSwingSessionContext context)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
static void loadFiles(WabitSwingSessionContext context, java.net.URI... importFiles)
          Attempts to read the workspaces at the given URIs, adding them to the given context only after every workspace has been loaded successfully.
 
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

OpenWorkspaceAction

public OpenWorkspaceAction(WabitSwingSessionContext context)
Method Detail

actionPerformed

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

loadFiles

public static void loadFiles(WabitSwingSessionContext context,
                             java.net.URI... importFiles)
Attempts to read the workspaces at the given URIs, adding them to the given context only after every workspace has been loaded successfully. Any URIs that could not be resolved are discarded after warning the user that the URI(s) was/were unrecognized. The work of loading the workspaces itself is done on a separate worker thread after this method returns; the results of loading are integrated into the context on the Swing Event Dispatch Thread after the worker thread has terminated.

The progress of the worker is made visible by use of a dialog with a progress bar and a reasonably fine-grained status message. While that dialog is visible, the session's frame is made unresponsive to mouse and keyboard input.

If any of the workspaces whose URIs were deemed valid could not be opened (probably due to IO errors or file corruption), a message to that effect will be displayed to the user. No sessions will be added to the context, even the ones that were loaded successfully before the IO error was encountered.

Parameters:
context - The context to open new workspaces into
importFiles - The URIs to read workspace data from (Wabit XML format)


Copyright © 2009. All Rights Reserved.