org.eclipse.xtext.ui.editor.autoedit
Class SingleLineTerminalsStrategy

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
      extended by org.eclipse.xtext.ui.editor.autoedit.AbstractTerminalsEditStrategy
          extended by org.eclipse.xtext.ui.editor.autoedit.SingleLineTerminalsStrategy
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener, org.eclipse.swt.internal.SWTEventListener

public class SingleLineTerminalsStrategy
extends AbstractTerminalsEditStrategy

This strategies automatically inserts the closing terminal when the opening terminal is typed. It also deletes both when the opening terminal is deleted. When the closing terminal is typed before the already existing closing terminals, the cursor is just moved. This strategy can be used together with MultiLineTerminalsEditStrategy

Author:
Sven Efftinge - Initial contribution and API

Nested Class Summary
static class SingleLineTerminalsStrategy.Factory
           
static interface SingleLineTerminalsStrategy.StrategyPredicate
           
 
Field Summary
static SingleLineTerminalsStrategy.StrategyPredicate DEFAULT
           
 
Fields inherited from class org.eclipse.xtext.ui.editor.autoedit.AbstractTerminalsEditStrategy
util
 
Fields inherited from class org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
debug, DEBUG
 
Constructor Summary
SingleLineTerminalsStrategy(java.lang.String left, java.lang.String right, SingleLineTerminalsStrategy.StrategyPredicate strategy)
           
 
Method Summary
protected  java.lang.String appliedText(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void handleDeletion(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void handleInsertLeftTerminal(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void handleInsertRightTerminal(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  boolean isInsertClosingTerminal(org.eclipse.jface.text.IDocument document, int i)
           
 
Methods inherited from class org.eclipse.xtext.ui.editor.autoedit.AbstractTerminalsEditStrategy
allowsEqualTerminals, findStartTerminal, findStopTerminal, getDocumentUtil, getLeftTerminal, getRightTerminal, setDocumentUtil
 
Methods inherited from class org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
count, customizeDocumentCommand, getDocumentContent, handleBadLocationException, isIdentifierPart, verifyKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static SingleLineTerminalsStrategy.StrategyPredicate DEFAULT
Constructor Detail

SingleLineTerminalsStrategy

public SingleLineTerminalsStrategy(java.lang.String left,
                                   java.lang.String right,
                                   SingleLineTerminalsStrategy.StrategyPredicate strategy)
Method Detail

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

handleInsertLeftTerminal

protected void handleInsertLeftTerminal(org.eclipse.jface.text.IDocument document,
                                        org.eclipse.jface.text.DocumentCommand command)
                                 throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

isInsertClosingTerminal

protected boolean isInsertClosingTerminal(org.eclipse.jface.text.IDocument document,
                                          int i)

appliedText

protected java.lang.String appliedText(org.eclipse.jface.text.IDocument document,
                                       org.eclipse.jface.text.DocumentCommand command)
                                throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

handleDeletion

protected void handleDeletion(org.eclipse.jface.text.IDocument document,
                              org.eclipse.jface.text.DocumentCommand command)
                       throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

handleInsertRightTerminal

protected void handleInsertRightTerminal(org.eclipse.jface.text.IDocument document,
                                         org.eclipse.jface.text.DocumentCommand command)
                                  throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException