org.argouml.uml.ui
Class ActionFileOperations

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.argouml.uml.ui.ActionFileOperations
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable
Direct Known Subclasses:
ActionNew, ActionOpenProject, ActionReopenProject, ActionRevertToSaved, ActionSaveProject

public abstract class ActionFileOperations
extends AbstractAction

This class provides common functions for all FileOperations like new, save, load, and reopen.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private static Logger LOG
           
 
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
ActionFileOperations(String name)
          The constructor.
ActionFileOperations(String name, Icon icon)
          The constructor.
 
Method Summary
protected  boolean askConfirmationAndSave()
          If the current project is dirty (needs saving) then this function will ask confirmation from the user.
 boolean loadProject(File file, boolean showUI)
          Loads the project file and opens all kinds of error message windows if it doesn't work for some reason.
private  void reportError(String message, boolean showUI)
          Open a Message Dialog with an error message.
private  void reportError(String message, boolean showUI, Throwable ex)
          Open a Message Dialog with an error message.
 
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
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

LOG

private static final Logger LOG
Constructor Detail

ActionFileOperations

public ActionFileOperations(String name)
The constructor.

Parameters:
name - the name of the action

ActionFileOperations

public ActionFileOperations(String name,
                            Icon icon)
The constructor.

Parameters:
name - the name of the action
icon - the icon to represent this action graphically
Method Detail

askConfirmationAndSave

protected boolean askConfirmationAndSave()
If the current project is dirty (needs saving) then this function will ask confirmation from the user. If the user indicates that saving is needed, then saving is attempted.

Returns:
true if we can continue with opening

loadProject

public boolean loadProject(File file,
                           boolean showUI)
Loads the project file and opens all kinds of error message windows if it doesn't work for some reason. In those cases it preserves the old project.

Parameters:
file - the file to open.
showUI - true if an error message may be shown to the user, false if run in commandline mode
Returns:
true if the file was successfully opened

reportError

private void reportError(String message,
                         boolean showUI)
Open a Message Dialog with an error message.

Parameters:
message - the message to display.
showUI - true if an error message may be shown to the user, false if run in commandline mode

reportError

private void reportError(String message,
                         boolean showUI,
                         Throwable ex)
Open a Message Dialog with an error message.

Parameters:
message - the message to display.
showUI - true if an error message may be shown to the user, false if run in commandline mode


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook