org.eclipse.emf.codegen.jet.editor.util
Class JETTemplateAutoEditStrategy

java.lang.Object
  extended by org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy
      extended by org.eclipse.emf.codegen.jet.editor.util.JETTemplateAutoEditStrategy
All Implemented Interfaces:
org.eclipse.jface.text.IAutoEditStrategy

public class JETTemplateAutoEditStrategy
extends org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy

Version:
$Revision: 1.2 $

Constructor Summary
JETTemplateAutoEditStrategy()
           
 
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 String at line with the leading whitespace removed.
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
 

Constructor Detail

JETTemplateAutoEditStrategy

public JETTemplateAutoEditStrategy()
Method Detail

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

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 parsed
line - - the line to start searching back from
end - - the end position to search back from
closingBracketIncrease - - the number of brackets to skip
Returns:
int
Throws:
org.eclipse.jface.text.BadLocationException

getIndentOfLine

protected java.lang.String getIndentOfLine(org.eclipse.jface.text.IDocument document,
                                           int line)
                                    throws org.eclipse.jface.text.BadLocationException
Returns the String at line with the leading whitespace removed.

Parameters:
document - - the document being parsed
line - - the line being searched
Returns:
String
Throws:
org.eclipse.jface.text.BadLocationException

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 parsed
command - - 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 parsed
command - - the command being performed

Copyright 2006 IBM Corporation and others.
All Rights Reserved.