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

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener, org.eclipse.swt.internal.SWTEventListener
Direct Known Subclasses:
AbstractTerminalsEditStrategy, CompoundMultiLineTerminalsEditStrategy, PartitionDeletionEditStrategy, PartitionEndSkippingEditStrategy, PartitionInsertEditStrategy, RichStringPartitionDelimiterSkippingStrategy, ShortCutEditStrategy

public abstract class AbstractEditStrategy
extends java.lang.Object
implements org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener

Author:
Sven Efftinge - Initial contribution and API

Field Summary
protected  boolean debug
          Boolean field that can be used to debug edit strategies.
static java.lang.String DEBUG
          Named binding key to bind boolean constant 'true' the debug / test mode for the edit strategies.
 
Constructor Summary
AbstractEditStrategy()
           
 
Method Summary
 int count(java.lang.String toFind, java.lang.String searchMe)
           
 void customizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  java.lang.String getDocumentContent(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void handleBadLocationException(org.eclipse.jface.text.BadLocationException e)
          Logs the exception.
protected abstract  void internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  boolean isIdentifierPart(org.eclipse.jface.text.IDocument doc, int offset)
           
 void verifyKey(org.eclipse.swt.events.VerifyEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final java.lang.String DEBUG
Named binding key to bind boolean constant 'true' the debug / test mode for the edit strategies.

Since:
2.0
See Also:
Constant Field Values

debug

@Inject(optional=true)
protected boolean debug
Boolean field that can be used to debug edit strategies. BadLocationException will be re-thrown if set to true

Since:
2.0
Constructor Detail

AbstractEditStrategy

public AbstractEditStrategy()
Method Detail

verifyKey

public void verifyKey(org.eclipse.swt.events.VerifyEvent event)
Specified by:
verifyKey in interface org.eclipse.swt.custom.VerifyKeyListener

customizeDocumentCommand

public void customizeDocumentCommand(org.eclipse.jface.text.IDocument document,
                                     org.eclipse.jface.text.DocumentCommand command)
Specified by:
customizeDocumentCommand in interface org.eclipse.jface.text.IAutoEditStrategy

handleBadLocationException

protected void handleBadLocationException(org.eclipse.jface.text.BadLocationException e)
Logs the exception. Will throw a RuntimeException if debug is set to true.

Since:
2.0

internalCustomizeDocumentCommand

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

count

public int count(java.lang.String toFind,
                 java.lang.String searchMe)
          throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

getDocumentContent

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

isIdentifierPart

protected boolean isIdentifierPart(org.eclipse.jface.text.IDocument doc,
                                   int offset)
                            throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException