org.argouml.uml.ui
Class ActionPaste

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.argouml.uml.ui.ActionPaste
All Implemented Interfaces:
Action, ActionListener, CaretListener, Cloneable, EventListener, FocusListener, Serializable

public class ActionPaste
extends AbstractAction
implements CaretListener, FocusListener

Action to paste the content of either the GEF clipboard or the system clipboard. The action is enabled if there is content on either clipboard AND either the mouse hovers over the JGraph (the diagram) or the caret in a UMLTextField2 or UMLTextArea2 is enabled.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private  boolean inJGraph
          Flag to indicate that the mouse is hovering over the JGraph.
private static ActionPaste instance
           
private static String LOCALIZE_KEY
           
private  JTextComponent textSource
          The source textcomponent where the caret is positioned
 
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
private ActionPaste()
          Default constructor for action.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Copies some text or a fig.
 void caretUpdate(CaretEvent e)
           
 void focusGained(FocusEvent e)
           
 void focusLost(FocusEvent e)
           
static ActionPaste getInstance()
          Singleton implementation.
private  boolean isSystemClipBoardEmpty()
           
 
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

instance

private static ActionPaste instance

LOCALIZE_KEY

private static final String LOCALIZE_KEY
See Also:
Constant Field Values

textSource

private JTextComponent textSource
The source textcomponent where the caret is positioned


inJGraph

private boolean inJGraph
Flag to indicate that the mouse is hovering over the JGraph.

Constructor Detail

ActionPaste

private ActionPaste()
Default constructor for action. We cannot use UMLChangeAction as a parent for this class since it works with shouldBeEnabled etc. which doesn't give enough control about enabling/disabling this action.

Method Detail

getInstance

public static ActionPaste getInstance()
Singleton implementation.

Returns:
The singleton

actionPerformed

public void actionPerformed(ActionEvent ae)
Copies some text or a fig.

Specified by:
actionPerformed in interface ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

isSystemClipBoardEmpty

private boolean isSystemClipBoardEmpty()

focusLost

public void focusLost(FocusEvent e)
Specified by:
focusLost in interface FocusListener
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)

caretUpdate

public void caretUpdate(CaretEvent e)
Specified by:
caretUpdate in interface CaretListener
See Also:
CaretListener.caretUpdate(javax.swing.event.CaretEvent)

focusGained

public void focusGained(FocusEvent e)
Specified by:
focusGained in interface FocusListener
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)


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