jsyntaxpane.actions
Class TemplateAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by javax.swing.text.TextAction
          extended by jsyntaxpane.actions.DefaultSyntaxAction
              extended by jsyntaxpane.actions.TemplateAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, SyntaxAction

public class TemplateAction
extends DefaultSyntaxAction

This action replaces the selection with the configured template in the config ACTION-NAME.Template There are two kinds of templates:

  • Simple Templates are replaced as is
  • Whole Line Templates will ensure a whole line is selected. Each line in the selection will be prefixed, and postfixed with whatever appears on the line in the template
  • See Also:
    Serialized Form

    Field Summary
     
    Fields inherited from class jsyntaxpane.actions.DefaultSyntaxAction
    ACTION_PREFIX, LARGE_ICONS_LOC_PREFIX, SMALL_ICONS_LOC_PREFIX
     
    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
    TemplateAction()
               
     
    Method Summary
     void actionPerformed(javax.swing.text.JTextComponent target, SyntaxDocument sdoc, int dot, java.awt.event.ActionEvent e)
              Convenience method that will be called if the Action is performed on a JTextComponent.
     void setMustHaveSelection(java.lang.String value)
               
     void setTemplate(java.lang.String t)
               
     void setWholeLines(java.lang.String value)
               
     
    Methods inherited from class jsyntaxpane.actions.DefaultSyntaxAction
    actionPerformed, config, setLargeIcon, setMenuText, setSmallIcon, setToolTip, toString
     
    Methods inherited from class javax.swing.text.TextAction
    augmentList, getFocusedComponent, getTextComponent
     
    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, wait, wait, wait
     
    Methods inherited from interface javax.swing.Action
    addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
     

    Constructor Detail

    TemplateAction

    public TemplateAction()
    Method Detail

    actionPerformed

    public void actionPerformed(javax.swing.text.JTextComponent target,
                                SyntaxDocument sdoc,
                                int dot,
                                java.awt.event.ActionEvent e)
    Description copied from class: DefaultSyntaxAction
    Convenience method that will be called if the Action is performed on a JTextComponent. SyntaxActions should generally override this method.

    Overrides:
    actionPerformed in class DefaultSyntaxAction
    Parameters:
    target - (non-null JTextComponent from Action.getSource
    sdoc - (SyntaxDOcument of the text component, could be null)
    dot - (position of caret at text document)
    e - actual ActionEvent passed to actionPerformed

    setWholeLines

    public void setWholeLines(java.lang.String value)

    setTemplate

    public void setTemplate(java.lang.String t)

    setMustHaveSelection

    public void setMustHaveSelection(java.lang.String value)