org.eclipse.xtext.ui.editor.autoedit
Class MultiLineTerminalsEditStrategy
java.lang.Object
org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
org.eclipse.xtext.ui.editor.autoedit.AbstractTerminalsEditStrategy
org.eclipse.xtext.ui.editor.autoedit.MultiLineTerminalsEditStrategy
- All Implemented Interfaces:
- java.util.EventListener, org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener, org.eclipse.swt.internal.SWTEventListener
- Direct Known Subclasses:
- AutoEditStrategyProvider.MultiLineTerminalsEditStrategyInRichString
public class MultiLineTerminalsEditStrategy
- extends AbstractTerminalsEditStrategy
This strategy applies auto edits when typing a newline character within a block (denoted by a start and end terminal).
- Author:
- Sven Efftinge - Initial contribution and API
Method Summary |
protected boolean |
atEndOfLineInput(org.eclipse.jface.text.IDocument document,
int offset)
determines whether the given offset is at the end of the input in the line. trailing whitespace is disregarded. |
protected CommandInfo |
handleCursorBetweenStartAndStopLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
adds a new line with required indentation after the cursor. |
protected CommandInfo |
handleCursorInFirstLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
Expects the cursor to be in the same line as the start terminal
puts any text between start terminal and cursor into a separate newline before the cursor. |
protected CommandInfo |
handleCursorInStopLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
delegates to handleCursorBetweenStartAndStopLine(IDocument, DocumentCommand, IRegion, IRegion) . |
protected CommandInfo |
handleNoStopTerminal(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
Expects the cursor not to be in the first line of the block
inserts a closing terminal if not existent. |
protected void |
internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiLineTerminalsEditStrategy
public MultiLineTerminalsEditStrategy(java.lang.String leftTerminal,
java.lang.String indentationString,
java.lang.String rightTerminal)
internalCustomizeDocumentCommand
protected void internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command)
throws org.eclipse.jface.text.BadLocationException
- Specified by:
internalCustomizeDocumentCommand
in class AbstractEditStrategy
- Throws:
org.eclipse.jface.text.BadLocationException
handleCursorInFirstLine
protected CommandInfo handleCursorInFirstLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
throws org.eclipse.jface.text.BadLocationException
- Expects the cursor to be in the same line as the start terminal
puts any text between start terminal and cursor into a separate newline before the cursor.
puts any text between cursor and end terminal into a separate newline after the cursor.
puts the closing terminal into a separate line at the end.
adds a closing terminal if not existent.
- Throws:
org.eclipse.jface.text.BadLocationException
handleNoStopTerminal
protected CommandInfo handleNoStopTerminal(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
throws org.eclipse.jface.text.BadLocationException
- Expects the cursor not to be in the first line of the block
inserts a closing terminal if not existent.
- Throws:
org.eclipse.jface.text.BadLocationException
handleCursorBetweenStartAndStopLine
protected CommandInfo handleCursorBetweenStartAndStopLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
throws org.eclipse.jface.text.BadLocationException
- adds a new line with required indentation after the cursor.
- Throws:
org.eclipse.jface.text.BadLocationException
handleCursorInStopLine
protected CommandInfo handleCursorInStopLine(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.DocumentCommand command,
org.eclipse.jface.text.IRegion startTerminal,
org.eclipse.jface.text.IRegion stopTerminal)
throws org.eclipse.jface.text.BadLocationException
- delegates to
handleCursorBetweenStartAndStopLine(IDocument, DocumentCommand, IRegion, IRegion)
.
- Throws:
org.eclipse.jface.text.BadLocationException
atEndOfLineInput
protected boolean atEndOfLineInput(org.eclipse.jface.text.IDocument document,
int offset)
throws org.eclipse.jface.text.BadLocationException
- determines whether the given offset is at the end of the input in the line. trailing whitespace is disregarded.
- Throws:
org.eclipse.jface.text.BadLocationException