modesteditor.core.modest
Class ModestAutoIndentStrategy
java.lang.Object
org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy
modesteditor.core.modest.ModestAutoIndentStrategy
- All Implemented Interfaces:
- org.eclipse.jface.text.IAutoEditStrategy
public class ModestAutoIndentStrategy
- extends org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy
- Author:
- Christophe Boutter
TODO look if cusomizeDocumentCommand does the right thing,
maybe the smart procedures have to be changed
Method Summary |
void |
customizeDocumentCommand(org.eclipse.jface.text.IDocument d,
org.eclipse.jface.text.DocumentCommand c)
|
protected int |
findMatchingOpenBracket(org.eclipse.jface.text.IDocument document,
int line,
int end,
int closingBracketIncrease)
Returns the line number of the next bracket after end. |
protected java.lang.String |
getIndentOfLine(org.eclipse.jface.text.IDocument document,
int line)
Returns the content of the given line without the leading whitespace. |
protected void |
smartIndentAfterNewLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
Set the indent of a new line based on the command provided in the supplied document. |
protected void |
smartInsertAfterBracket(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
Set the indent of a bracket based on the command provided in the supplied document. |
Methods inherited from class org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy |
findEndOfWhiteSpace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ModestAutoIndentStrategy
public ModestAutoIndentStrategy()
customizeDocumentCommand
public void customizeDocumentCommand(org.eclipse.jface.text.IDocument d,
org.eclipse.jface.text.DocumentCommand c)
- Specified by:
customizeDocumentCommand
in interface org.eclipse.jface.text.IAutoEditStrategy
- Overrides:
customizeDocumentCommand
in class org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy
smartIndentAfterNewLine
protected void smartIndentAfterNewLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
- Set the indent of a new line based on the command provided in the supplied document.
- Parameters:
document
- - the document being parsedcommand
- - the command being performed
smartInsertAfterBracket
protected void smartInsertAfterBracket(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
- Set the indent of a bracket based on the command provided in the supplied document.
- Parameters:
document
- - the document being parsedcommand
- - the command being performed
findMatchingOpenBracket
protected int findMatchingOpenBracket(org.eclipse.jface.text.IDocument document,
int line,
int end,
int closingBracketIncrease)
throws org.eclipse.jface.text.BadLocationException
- Returns the line number of the next bracket after end.
- Parameters:
document
- - the document being parsedline
- - the line to start searching back fromend
- - the end position to search back fromclosingBracketIncrease
- - the number of brackets to skip
- Returns:
- the line number of the next matching bracket after end
- Throws:
org.eclipse.jface.text.BadLocationException
- in case the line numbers are invalid in the document
getIndentOfLine
protected java.lang.String getIndentOfLine(org.eclipse.jface.text.IDocument document,
int line)
throws org.eclipse.jface.text.BadLocationException
- Returns the content of the given line without the leading whitespace.
- Parameters:
document
- - the document being parsedline
- - the line being searched
- Returns:
- the content of the given line without the leading whitespace
- Throws:
org.eclipse.jface.text.BadLocationException
- in case line
is invalid in the document