edu.rice.cs.drjava.model.definitions.indent
Class ActionStartPrevLinePlusMultilinePreserve

java.lang.Object
  extended by edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
      extended by edu.rice.cs.drjava.model.definitions.indent.IndentRuleAction
          extended by edu.rice.cs.drjava.model.definitions.indent.ActionStartPrevLinePlusMultilinePreserve
All Implemented Interfaces:
IndentRule

 class ActionStartPrevLinePlusMultilinePreserve
extends IndentRuleAction

Indents the current line in the document to the indent level of the start of the previous line, preserving any text on the current line, and adds several lines of text at that indent level, and moves the cursor to a particular line and position.

Version:
$Id: ActionStartPrevLinePlusMultilinePreserve.java 5175 2010-01-20 08:46:32Z mgricken $

Field Summary
private  int _cursorLine
           
private  int _cursorPos
           
private  int _psrvLine
           
private  int _psrvPos
           
private  String[] _suffices
           
 
Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
NO, TERMINUS_RULE, YES
 
Constructor Summary
ActionStartPrevLinePlusMultilinePreserve(String[] suffices, int cursorLine, int cursorPos, int psrvLine, int psrvPos)
          Creates a multiline insert rule, properly preserving any text on current line.
 
Method Summary
 boolean indentLine(AbstractDJDocument doc, Indenter.IndentReason reason)
          Forwards the call to the enclosed ActionStartPrevLinePlusMultiline.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRuleWithTrace
_addToIndentTrace, getRuleName, getTrace, indentLine, printLastIndentTrace, setRuleTraceEnabled, testIndentLine, testIndentLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_suffices

private String[] _suffices

_cursorLine

private int _cursorLine

_cursorPos

private int _cursorPos

_psrvLine

private int _psrvLine

_psrvPos

private int _psrvPos
Constructor Detail

ActionStartPrevLinePlusMultilinePreserve

public ActionStartPrevLinePlusMultilinePreserve(String[] suffices,
                                                int cursorLine,
                                                int cursorPos,
                                                int psrvLine,
                                                int psrvPos)
Creates a multiline insert rule, properly preserving any text on current line.

Parameters:
suffices - the new lines to be added
cursorLine - the line on which to place the cursor
cursorPos - the character within the line string before which to place the cursor
psrvLine - the line in suffices on which to place the preserved text
psrvPos - the character within the line string in suffices before which to place the preserved text
Throws:
IllegalArgumentException - if the integer params are negative or outside the appropriate bounds
Method Detail

indentLine

public boolean indentLine(AbstractDJDocument doc,
                          Indenter.IndentReason reason)
Forwards the call to the enclosed ActionStartPrevLinePlusMultiline. Only runs in event thread.

Specified by:
indentLine in interface IndentRule
Overrides:
indentLine in class IndentRuleWithTrace
Parameters:
doc - AbstractDJDocument containing the line to be indented.
reason - The reason that the indentation is taking place
Returns:
this is always false, since we are updating the cursor location