com.borland.primetime.editor
Class EditorActions.SmartIndentAction

java.lang.Object
  |
  +--javax.swing.AbstractAction
        |
        +--com.borland.primetime.editor.EditorAction
              |
              +--com.borland.primetime.editor.EditorActions.SmartIndentAction
Enclosing class:
EditorActions

public static class EditorActions.SmartIndentAction
extends EditorAction

This is the SmartIndent action. It inserts a newline character in the text and positions the caret at the "logical" place on the new line. The rules it uses are as follows:

  1. If the caret is at the start of the line, and the character to the right is a space or tab, simply insert a newline.
  2. If the caret is at the start of the line, and the character to the right is text or a newline, then insert a newline and enough space to line up the caret with the first non-whitespace character on the first non-blank line, counting backwards from the current line.
  3. If the caret is not at the start of the line, insert a newline and enough whitespace to line up just under the first non-whitespace character to the left. If there are no non-whitespace characters to the left, the caret will end up in the same column as it started in, but on the next line.
  4. As an extension to the point above, if the first non-whitespace char on the line is a '/' or '*', do special checking for JavaDoc comment blocks. If the caret is already in a JavaDoc comment block, insert enough whitespace to line things up, as above, plus put in an extra ' * ' sequence to continue the JavaDoc comment. If the caret is just starting a JavaDoc comment, we'll want to put in the closing comment block as well as position the caret in the right place.

See Also:
Serialized Form

Inner classes inherited from class com.borland.primetime.editor.EditorAction
EditorAction.SubKeymapAction
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Constructor Summary
EditorActions.SmartIndentAction(java.lang.String nm)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 
Methods inherited from class com.borland.primetime.editor.EditorAction
getEditorTarget, getFocusedEditor, setFocusedEditor
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorActions.SmartIndentAction

public EditorActions.SmartIndentAction(java.lang.String nm)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Overrides:
actionPerformed in class javax.swing.AbstractAction